Fix user rank docs
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-06-22 21:58:41 -04:00
parent 018fb4c123
commit e3435419a6
5 changed files with 39 additions and 6 deletions

View File

@@ -472,7 +472,7 @@ const docTemplate = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/Response-User" "$ref": "#/definitions/Response-Rank"
} }
}, },
"404": { "404": {
@@ -663,6 +663,19 @@ const docTemplate = `{
} }
} }
}, },
"Response-Rank": {
"type": "object",
"properties": {
"data": {
"description": "Data contains the actual response payload",
"allOf": [
{
"$ref": "#/definitions/Rank"
}
]
}
}
},
"Response-Time": { "Response-Time": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@@ -465,7 +465,7 @@
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/Response-User" "$ref": "#/definitions/Response-Rank"
} }
}, },
"404": { "404": {
@@ -656,6 +656,19 @@
} }
} }
}, },
"Response-Rank": {
"type": "object",
"properties": {
"data": {
"description": "Data contains the actual response payload",
"allOf": [
{
"$ref": "#/definitions/Rank"
}
]
}
}
},
"Response-Time": { "Response-Time": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@@ -107,6 +107,13 @@ definitions:
- $ref: '#/definitions/Map' - $ref: '#/definitions/Map'
description: Data contains the actual response payload description: Data contains the actual response payload
type: object type: object
Response-Rank:
properties:
data:
allOf:
- $ref: '#/definitions/Rank'
description: Data contains the actual response payload
type: object
Response-Time: Response-Time:
properties: properties:
data: data:
@@ -454,7 +461,7 @@ paths:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/Response-User' $ref: '#/definitions/Response-Rank'
"404": "404":
description: User not found description: User not found
schema: schema:

View File

@@ -1,3 +1,3 @@
package public_api package public_api
//go:generate swag init -g ./cmd/public-api/serve.go //go:generate swag init -g ./cmd/public-api/service.go

View File

@@ -88,7 +88,7 @@ func (h *UserHandler) Get(ctx *gin.Context) {
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Param id path int true "User ID" // @Param id path int true "User ID"
// @Param filter query dto.RankFilter false "Rank query parameters" // @Param filter query dto.RankFilter false "Rank query parameters"
// @Success 200 {object} dto.Response[dto.User] // @Success 200 {object} dto.Response[dto.Rank]
// @Failure 404 {object} dto.Error "User not found" // @Failure 404 {object} dto.Error "User not found"
// @Failure default {object} dto.Error "General error response" // @Failure default {object} dto.Error "General error response"
// @Router /user/{id}/rank [get] // @Router /user/{id}/rank [get]
@@ -137,7 +137,7 @@ func (h *UserHandler) GetRank(ctx *gin.Context) {
return return
} }
// Convert gRPC UserResponse object to dto.UserData object // Convert gRPC Rank object to dto.Rank object
var rank dto.Rank var rank dto.Rank
result := rank.FromGRPC(rankItem) result := rank.FromGRPC(rankItem)