Skip to content

Commit

Permalink
Removed unneccessary casts
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobortolan committed Jan 27, 2024
1 parent bfabdab commit 15586eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api_v2/services/course_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func FetchCourses(db *gorm.DB, req *protobuf.GetPublicCoursesRequest, uID *uint)
}
if req.Limit > 0 {
query = query.Limit(int(req.Limit))
if req.Skip >= 0 {
if req.Skip > 0 {
query = query.Offset(int(req.Skip))
}
} else if req.Skip > 0 {
Expand Down
14 changes: 7 additions & 7 deletions api_v2/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (a *API) handleStreamRequest(ctx context.Context, sID uint32) (*model.Strea
return nil, nil, e.WithStatus(http.StatusUnauthorized, err)
}

s, err := s.GetStreamByID(a.db, uint32(sID))
s, err := s.GetStreamByID(a.db, sID)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -67,7 +67,7 @@ func (a *API) handleChatRequest(ctx context.Context, sID uint32) (uint, error) {
return 0, e.WithStatus(http.StatusBadRequest, errors.New("stream id must not be empty"))
}

stream, err := s.GetStreamByID(a.db, uint32(sID))
stream, err := s.GetStreamByID(a.db, sID)
if err != nil {
return 0, err
}
Expand Down Expand Up @@ -183,7 +183,7 @@ func (a *API) handleProgressRequest(ctx context.Context, sID uint32) (uint, erro
return 0, e.WithStatus(http.StatusUnauthorized, err)
}

s, err := s.GetStreamByID(a.db, uint32(sID))
s, err := s.GetStreamByID(a.db, sID)
if err != nil {
return 0, err
}
Expand All @@ -203,7 +203,7 @@ func (a *API) GetProgress(ctx context.Context, req *protobuf.GetProgressRequest)
return nil, err
}

p, err := s.GetProgress(a.db, uint32(req.StreamID), uID)
p, err := s.GetProgress(a.db, req.StreamID, uID)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -240,7 +240,7 @@ func (a *API) MarkAsWatched(ctx context.Context, req *protobuf.MarkAsWatchedRequ
return nil, err
}

p, err := s.MarkAsWatched(a.db, uint32(req.StreamID), uID)
p, err := s.MarkAsWatched(a.db, req.StreamID, uID)
if err != nil {
return nil, err
}
Expand All @@ -259,7 +259,7 @@ func (a *API) GetChatMessages(ctx context.Context, req *protobuf.GetChatMessages
return nil, err
}

chats, err := s.GetChatMessages(a.db, uint32(req.StreamID))
chats, err := s.GetChatMessages(a.db, req.StreamID)
if err != nil {
return nil, e.WithStatus(http.StatusInternalServerError, err)
}
Expand All @@ -281,7 +281,7 @@ func (a *API) PostChatMessage(ctx context.Context, req *protobuf.PostChatMessage
return nil, err
}

chat, err := s.PostChatMessage(a.db, uint32(req.StreamID), uID, req.Message)
chat, err := s.PostChatMessage(a.db, req.StreamID, uID, req.Message)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 15586eb

Please sign in to comment.