Skip to content

Commit

Permalink
🐛 fix: Ensure class code and secret are included in the GetClass resp…
Browse files Browse the repository at this point in the history
…onse

- Modified the GetClass method to properly include the class code and secret in the response if available.
- Reorganized the response construction to ensure that the class code and secret are added to the output correctly.
- Added logging to trace the retrieval of class and class code details.

Related issue: #304
  • Loading branch information
yuminn-k committed Jun 13, 2024
1 parent be34d0a commit a3f1104
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/class_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ func (cc *ClassController) GetClass(ctx *gin.Context) {
}

if classCode != nil {
response["code"] = classCode.Code
classCodeResponse := gin.H{
"code": classCode.Code,
}
if classCode.Secret != nil {
response["secret"] = *classCode.Secret
classCodeResponse["secret"] = classCode.Secret
}
response["classCode"] = classCodeResponse
}

respondWithSuccess(ctx, constants.StatusOK, gin.H{"info": response})
respondWithSuccess(ctx, constants.StatusOK, response)
}

// CreateClass godoc
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ func setupRouter(db *gorm.DB, jwtService services.JWTService) *gin.Engine {
}

ignoredPaths := []string{
"http://localhost:8080/api/gin/swagger/index.html",
"http://localhost:8080/api/gin/swagger/*any",
"http://43.203.66.25/api/gin/swagger/index.html",
"http://43.203.66.25/api/gin/swagger/*any",
}

Expand Down

0 comments on commit a3f1104

Please sign in to comment.