Skip to content

Commit

Permalink
Added swagger.json file for auth APIs (#4103)
Browse files Browse the repository at this point in the history
* Added swagger.json file for auth APIs

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* updated api fielda from snake case to camel case

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* test commit to check if required field is working

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* updated required fields correctly

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

---------

Signed-off-by: Saranya-jena <saranya.jena@harness.io>
  • Loading branch information
Saranya-jena committed Jul 28, 2023
1 parent 37f3e44 commit 28f9079
Show file tree
Hide file tree
Showing 5 changed files with 1,306 additions and 8 deletions.
10 changes: 5 additions & 5 deletions chaoscenter/authentication/api/handlers/rest/user_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ func LoginUser(service services.ApplicationService) gin.HandlerFunc {
}

c.JSON(200, gin.H{
"access_token": token,
"project_id": defaultProject,
"project_role": entities.RoleOwner,
"expires_in": expiryTime,
"type": "Bearer",
"accessToken": token,
"projectID": defaultProject,
"projectRole": entities.RoleOwner,
"expiresIn": expiryTime,
"type": "Bearer",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion chaoscenter/authentication/api/presenter/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/litmuschaos/litmus/chaoscenter/authentication/pkg/utils"
// ErrorResponseStruct defines the structure for error responses
type ErrorResponseStruct struct {
Error string `json:"error"`
ErrorDescription string `json:"error_description"`
ErrorDescription string `json:"errorDescription"`
}

// CreateErrorResponse is a helper function that creates a ErrorResponseStruct
Expand Down
4 changes: 2 additions & 2 deletions chaoscenter/authentication/api/routes/user_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func UserRouter(router *gin.Engine, service services.ApplicationService) {
router.Use(middleware.JwtMiddleware())
router.POST("/update/password", rest.UpdatePassword(service))
router.POST("/reset/password", rest.ResetPassword(service))
router.POST("/create", rest.CreateUser(service))
router.POST("/create_user", rest.CreateUser(service))
router.POST("/update/details", rest.UpdateUser(service))
router.GET("/getUser/:uid", rest.GetUser(service))
router.GET("/get_user/:uid", rest.GetUser(service))
router.GET("/users", rest.FetchUsers(service))
router.GET("/invite_users/:project_id", rest.InviteUsers(service))
router.POST("/update/state", rest.UpdateUserState(service))
Expand Down
3 changes: 3 additions & 0 deletions chaoscenter/authentication/pkg/project/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ func (r repository) GetProjectMembers(projectID string, state string) ([]*entiti
return nil, err
}

if len(res) <= 0 {
return nil, nil
}
return res[0].Members, nil
}

Expand Down
Loading

0 comments on commit 28f9079

Please sign in to comment.