feat: generate Swagger documentation for API endpoints
All checks were successful
Build and Release / release (push) Successful in 1m30s

This commit is contained in:
2026-05-07 11:41:26 +07:00
parent a4fed88b8a
commit d6b113dcda
3 changed files with 1087 additions and 0 deletions

View File

@@ -1661,6 +1661,61 @@ const docTemplate = `{
} }
} }
}, },
"/projects/commits/{commitId}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve a specific commit by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Commits"
],
"summary": "Get commit by ID",
"parameters": [
{
"type": "string",
"description": "Commit ID",
"name": "commitId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/projects/{id}": { "/projects/{id}": {
"get": { "get": {
"security": [ "security": [
@@ -2450,6 +2505,166 @@ const docTemplate = `{
} }
} }
}, },
"/statistics": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Fetch daily system statistics with optional date range filtering",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Search system statistics",
"parameters": [
{
"type": "string",
"description": "Start date in YYYY-MM-DD format",
"name": "start_date",
"in": "query"
},
{
"type": "string",
"description": "End date in YYYY-MM-DD format",
"name": "end_date",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/history-api_internal_dtos_response.StatisticResponse"
}
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/statistics/{date}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Fetch system statistics for a specific date",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Get system statistics by date",
"parameters": [
{
"type": "string",
"description": "Date in YYYY-MM-DD format",
"name": "date",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/history-api_internal_dtos_response.StatisticResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/submissions": { "/submissions": {
"get": { "get": {
"security": [ "security": [
@@ -3311,6 +3526,62 @@ const docTemplate = `{
} }
} }
}, },
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update the profile details of any user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Update user profile (Admin/Mod only)",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Update Profile request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_request.UpdateProfileDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
},
"delete": { "delete": {
"security": [ "security": [
{ {
@@ -3429,6 +3700,64 @@ const docTemplate = `{
} }
} }
}, },
"/users/{id}/password": {
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "Reset the password for any user without requiring the old password",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Reset user password (Admin/Mod only)",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Reset Password request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_request.ResetPasswordDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/users/{id}/project": { "/users/{id}/project": {
"get": { "get": {
"description": "Retrieve project list by specific user ID", "description": "Retrieve project list by specific user ID",
@@ -4343,6 +4672,22 @@ const docTemplate = `{
} }
} }
}, },
"history-api_internal_dtos_request.ResetPasswordDto": {
"type": "object",
"required": [
"new_password"
],
"properties": {
"is_send_email": {
"type": "boolean"
},
"new_password": {
"type": "string",
"maxLength": 64,
"minLength": 8
}
}
},
"history-api_internal_dtos_request.RestoreCommitDto": { "history-api_internal_dtos_request.RestoreCommitDto": {
"type": "object", "type": "object",
"required": [ "required": [
@@ -4627,6 +4972,74 @@ const docTemplate = `{
} }
} }
}, },
"history-api_internal_dtos_response.StatisticResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"date": {
"type": "string"
},
"id": {
"type": "string"
},
"new_commits": {
"type": "integer"
},
"new_entities": {
"type": "integer"
},
"new_geometries": {
"type": "integer"
},
"new_medias": {
"type": "integer"
},
"new_projects": {
"type": "integer"
},
"new_storage_bytes": {
"type": "integer"
},
"new_submissions": {
"type": "integer"
},
"new_users": {
"type": "integer"
},
"new_wikis": {
"type": "integer"
},
"total_commits": {
"type": "integer"
},
"total_entities": {
"type": "integer"
},
"total_geometries": {
"type": "integer"
},
"total_medias": {
"type": "integer"
},
"total_projects": {
"type": "integer"
},
"total_storage_bytes": {
"type": "integer"
},
"total_submissions": {
"type": "integer"
},
"total_users": {
"type": "integer"
},
"total_wikis": {
"type": "integer"
}
}
},
"history-api_pkg_constants.TokenType": { "history-api_pkg_constants.TokenType": {
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",

View File

@@ -1654,6 +1654,61 @@
} }
} }
}, },
"/projects/commits/{commitId}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve a specific commit by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Commits"
],
"summary": "Get commit by ID",
"parameters": [
{
"type": "string",
"description": "Commit ID",
"name": "commitId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/projects/{id}": { "/projects/{id}": {
"get": { "get": {
"security": [ "security": [
@@ -2443,6 +2498,166 @@
} }
} }
}, },
"/statistics": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Fetch daily system statistics with optional date range filtering",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Search system statistics",
"parameters": [
{
"type": "string",
"description": "Start date in YYYY-MM-DD format",
"name": "start_date",
"in": "query"
},
{
"type": "string",
"description": "End date in YYYY-MM-DD format",
"name": "end_date",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/history-api_internal_dtos_response.StatisticResponse"
}
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/statistics/{date}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Fetch system statistics for a specific date",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Statistics"
],
"summary": "Get system statistics by date",
"parameters": [
{
"type": "string",
"description": "Date in YYYY-MM-DD format",
"name": "date",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/history-api_internal_dtos_response.StatisticResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/submissions": { "/submissions": {
"get": { "get": {
"security": [ "security": [
@@ -3304,6 +3519,62 @@
} }
} }
}, },
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update the profile details of any user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Update user profile (Admin/Mod only)",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Update Profile request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_request.UpdateProfileDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
},
"delete": { "delete": {
"security": [ "security": [
{ {
@@ -3422,6 +3693,64 @@
} }
} }
}, },
"/users/{id}/password": {
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "Reset the password for any user without requiring the old password",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Reset user password (Admin/Mod only)",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Reset Password request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_request.ResetPasswordDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/history-api_internal_dtos_response.CommonResponse"
}
}
}
}
},
"/users/{id}/project": { "/users/{id}/project": {
"get": { "get": {
"description": "Retrieve project list by specific user ID", "description": "Retrieve project list by specific user ID",
@@ -4336,6 +4665,22 @@
} }
} }
}, },
"history-api_internal_dtos_request.ResetPasswordDto": {
"type": "object",
"required": [
"new_password"
],
"properties": {
"is_send_email": {
"type": "boolean"
},
"new_password": {
"type": "string",
"maxLength": 64,
"minLength": 8
}
}
},
"history-api_internal_dtos_request.RestoreCommitDto": { "history-api_internal_dtos_request.RestoreCommitDto": {
"type": "object", "type": "object",
"required": [ "required": [
@@ -4620,6 +4965,74 @@
} }
} }
}, },
"history-api_internal_dtos_response.StatisticResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"date": {
"type": "string"
},
"id": {
"type": "string"
},
"new_commits": {
"type": "integer"
},
"new_entities": {
"type": "integer"
},
"new_geometries": {
"type": "integer"
},
"new_medias": {
"type": "integer"
},
"new_projects": {
"type": "integer"
},
"new_storage_bytes": {
"type": "integer"
},
"new_submissions": {
"type": "integer"
},
"new_users": {
"type": "integer"
},
"new_wikis": {
"type": "integer"
},
"total_commits": {
"type": "integer"
},
"total_entities": {
"type": "integer"
},
"total_geometries": {
"type": "integer"
},
"total_medias": {
"type": "integer"
},
"total_projects": {
"type": "integer"
},
"total_storage_bytes": {
"type": "integer"
},
"total_submissions": {
"type": "integer"
},
"total_users": {
"type": "integer"
},
"total_wikis": {
"type": "integer"
}
}
},
"history-api_pkg_constants.TokenType": { "history-api_pkg_constants.TokenType": {
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",

View File

@@ -398,6 +398,17 @@ definitions:
required: required:
- token_id - token_id
type: object type: object
history-api_internal_dtos_request.ResetPasswordDto:
properties:
is_send_email:
type: boolean
new_password:
maxLength: 64
minLength: 8
type: string
required:
- new_password
type: object
history-api_internal_dtos_request.RestoreCommitDto: history-api_internal_dtos_request.RestoreCommitDto:
properties: properties:
commit_id: commit_id:
@@ -597,6 +608,51 @@ definitions:
total_records: total_records:
type: integer type: integer
type: object type: object
history-api_internal_dtos_response.StatisticResponse:
properties:
created_at:
type: string
date:
type: string
id:
type: string
new_commits:
type: integer
new_entities:
type: integer
new_geometries:
type: integer
new_medias:
type: integer
new_projects:
type: integer
new_storage_bytes:
type: integer
new_submissions:
type: integer
new_users:
type: integer
new_wikis:
type: integer
total_commits:
type: integer
total_entities:
type: integer
total_geometries:
type: integer
total_medias:
type: integer
total_projects:
type: integer
total_storage_bytes:
type: integer
total_submissions:
type: integer
total_users:
type: integer
total_wikis:
type: integer
type: object
history-api_pkg_constants.TokenType: history-api_pkg_constants.TokenType:
enum: enum:
- 1 - 1
@@ -2093,6 +2149,41 @@ paths:
summary: Update member role summary: Update member role
tags: tags:
- Projects - Projects
/projects/commits/{commitId}:
get:
consumes:
- application/json
description: Retrieve a specific commit by its ID
parameters:
- description: Commit ID
in: path
name: commitId
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Get commit by ID
tags:
- Commits
/raster-tiles/{z}/{x}/{y}: /raster-tiles/{z}/{x}/{y}:
get: get:
description: Fetch vector or raster map tile data by Z, X, Y coordinates description: Fetch vector or raster map tile data by Z, X, Y coordinates
@@ -2197,6 +2288,103 @@ paths:
summary: Get role by ID summary: Get role by ID
tags: tags:
- Roles - Roles
/statistics:
get:
consumes:
- application/json
description: Fetch daily system statistics with optional date range filtering
parameters:
- description: Start date in YYYY-MM-DD format
in: query
name: start_date
type: string
- description: End date in YYYY-MM-DD format
in: query
name: end_date
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
- properties:
data:
items:
$ref: '#/definitions/history-api_internal_dtos_response.StatisticResponse'
type: array
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Search system statistics
tags:
- Statistics
/statistics/{date}:
get:
consumes:
- application/json
description: Fetch system statistics for a specific date
parameters:
- description: Date in YYYY-MM-DD format
in: path
name: date
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
- properties:
data:
$ref: '#/definitions/history-api_internal_dtos_response.StatisticResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Get system statistics by date
tags:
- Statistics
/submissions: /submissions:
get: get:
consumes: consumes:
@@ -2615,6 +2803,42 @@ paths:
summary: Get user by ID summary: Get user by ID
tags: tags:
- Users - Users
put:
consumes:
- application/json
description: Update the profile details of any user
parameters:
- description: User ID
in: path
name: id
required: true
type: string
- description: Update Profile request
in: body
name: request
required: true
schema:
$ref: '#/definitions/history-api_internal_dtos_request.UpdateProfileDto'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Update user profile (Admin/Mod only)
tags:
- Users
/users/{id}/application: /users/{id}/application:
get: get:
consumes: consumes:
@@ -2665,6 +2889,43 @@ paths:
summary: Get user's media by user ID summary: Get user's media by user ID
tags: tags:
- Users - Users
/users/{id}/password:
patch:
consumes:
- application/json
description: Reset the password for any user without requiring the old password
parameters:
- description: User ID
in: path
name: id
required: true
type: string
- description: Reset Password request
in: body
name: request
required: true
schema:
$ref: '#/definitions/history-api_internal_dtos_request.ResetPasswordDto'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/history-api_internal_dtos_response.CommonResponse'
security:
- BearerAuth: []
summary: Reset user password (Admin/Mod only)
tags:
- Users
/users/{id}/project: /users/{id}/project:
get: get:
consumes: consumes: