Skip to content

Commit

Permalink
Fix linting (golangci-lint)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobortolan committed Oct 18, 2024
1 parent bf61b6d commit 51c018b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions api/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ func (r tokenRoutes) createToken(c *gin.Context) {
// or: rtmp://proxy.example.com/<lecturer-token>?slug=ABC-123 <-- optional slug parameter in case the lecturer is streaming multiple courses simultaneously
//
// Proxy returns: rtmp://ingest.example.com/ABC-123?secret=610f609e4a2c43ac8a6d648177472b17
func (s *tokenRoutes) fetchStreamKey(c *gin.Context) {
func (r *tokenRoutes) fetchStreamKey(c *gin.Context) {
// Optional slug parameter to get the stream key of a specific course (in case the lecturer is streaming multiple courses simultaneously)
slug := c.Query("slug")
t := c.Param("token")

// Get user from token
token, err := s.TokenDao.GetToken(t)
token, err := r.TokenDao.GetToken(t)
if err != nil {
_ = c.Error(tools.RequestError{
Status: http.StatusBadRequest,
Expand All @@ -160,7 +160,7 @@ func (s *tokenRoutes) fetchStreamKey(c *gin.Context) {
}

// Get user and check if he has the right to start a stream
user, err := s.UsersDao.GetUserByID(c, token.UserID)
user, err := r.UsersDao.GetUserByID(c, token.UserID)
if err != nil {
_ = c.Error(tools.RequestError{
Status: http.StatusInternalServerError,
Expand All @@ -180,7 +180,7 @@ func (s *tokenRoutes) fetchStreamKey(c *gin.Context) {

// Find current/next stream and course of which the user is a lecturer
year, term := tum.GetCurrentSemester()
streamKey, courseSlug, err := s.StreamsDao.GetSoonStartingStreamInfo(&user, slug, year, term)
streamKey, courseSlug, err := r.StreamsDao.GetSoonStartingStreamInfo(&user, slug, year, term)
if err != nil || streamKey == "" || courseSlug == "" {
_ = c.Error(tools.RequestError{
Status: http.StatusNotFound,
Expand Down
5 changes: 4 additions & 1 deletion dao/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,10 @@ func (d streamsDao) CreateOrGetTestCourse(user *model.User) (model.Course, error
return model.Course{}, err
}

CoursesDao.AddAdminToCourse(NewDaoWrapper().CoursesDao, user.ID, course.ID)
err = CoursesDao.AddAdminToCourse(NewDaoWrapper().CoursesDao, user.ID, course.ID)
if err != nil {
return model.Course{}, err
}

return course, nil
}
Expand Down

0 comments on commit 51c018b

Please sign in to comment.