Skip to content

Commit

Permalink
update documentation to reflect modify-user changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreth committed Aug 16, 2024
1 parent 28617b0 commit 22eb9ec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
7 changes: 4 additions & 3 deletions backend/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,15 @@ func Me(c *gin.Context) {
}

// @Summary Modify a user's details
// @Description This endpoint modifies a user's details such as Telegram bot API key, reminder time, and more. The request must include a valid JWT token.
// @Description This endpoint modifies a user's details such as Telegram bot API key, reminder time, and more. The request must include a valid JWT token. When modifying the email or password, a new JWT token is generated and returned. Otherwise, the user's data is returned without a new token.
// @Accept json
// @Produce json
// @Param user body structs.ModifyUserRequest true "Modify user"
// @Success 200 {object} structs.Success
// @Success 200 {object} structs.LoginSuccess "User data and new token if email or password changed"
// @Success 200 {object} structs.UserData "User data without a new token if no email or password changes"
// @Failure 400 {object} structs.Error "Invalid request"
// @Failure 401 {object} structs.Error "Unauthorized"
// @Failure 500 {object} structs.Error "Failed to update user"
// @Failure 500 {object} structs.Error "Failed to update user or process request"
// @Security Bearer
// @Router /modify-user [put]
// @Tags auth
Expand Down
8 changes: 4 additions & 4 deletions backend/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ const docTemplate = `{
"Bearer": []
}
],
"description": "This endpoint modifies a user's details such as Telegram bot API key, reminder time, and more. The request must include a valid JWT token.",
"description": "This endpoint modifies a user's details such as Telegram bot API key, reminder time, and more. The request must include a valid JWT token. When modifying the email or password, a new JWT token is generated and returned. Otherwise, the user's data is returned without a new token.",
"consumes": [
"application/json"
],
Expand All @@ -432,9 +432,9 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK",
"description": "User data without a new token if no email or password changes",
"schema": {
"$ref": "#/definitions/structs.Success"
"$ref": "#/definitions/structs.UserData"
}
},
"400": {
Expand All @@ -450,7 +450,7 @@ const docTemplate = `{
}
},
"500": {
"description": "Failed to update user",
"description": "Failed to update user or process request",
"schema": {
"$ref": "#/definitions/structs.Error"
}
Expand Down
8 changes: 4 additions & 4 deletions backend/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
"Bearer": []
}
],
"description": "This endpoint modifies a user's details such as Telegram bot API key, reminder time, and more. The request must include a valid JWT token.",
"description": "This endpoint modifies a user's details such as Telegram bot API key, reminder time, and more. The request must include a valid JWT token. When modifying the email or password, a new JWT token is generated and returned. Otherwise, the user's data is returned without a new token.",
"consumes": [
"application/json"
],
Expand All @@ -421,9 +421,9 @@
],
"responses": {
"200": {
"description": "OK",
"description": "User data without a new token if no email or password changes",
"schema": {
"$ref": "#/definitions/structs.Success"
"$ref": "#/definitions/structs.UserData"
}
},
"400": {
Expand All @@ -439,7 +439,7 @@
}
},
"500": {
"description": "Failed to update user",
"description": "Failed to update user or process request",
"schema": {
"$ref": "#/definitions/structs.Error"
}
Expand Down
8 changes: 5 additions & 3 deletions backend/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ paths:
- application/json
description: This endpoint modifies a user's details such as Telegram bot API
key, reminder time, and more. The request must include a valid JWT token.
When modifying the email or password, a new JWT token is generated and returned.
Otherwise, the user's data is returned without a new token.
parameters:
- description: Modify user
in: body
Expand All @@ -446,9 +448,9 @@ paths:
- application/json
responses:
"200":
description: OK
description: User data without a new token if no email or password changes
schema:
$ref: '#/definitions/structs.Success'
$ref: '#/definitions/structs.UserData'
"400":
description: Invalid request
schema:
Expand All @@ -458,7 +460,7 @@ paths:
schema:
$ref: '#/definitions/structs.Error'
"500":
description: Failed to update user
description: Failed to update user or process request
schema:
$ref: '#/definitions/structs.Error'
security:
Expand Down

0 comments on commit 22eb9ec

Please sign in to comment.