docs: 重新生成 Swagger 文档,补充用户CRUD和仪表盘统计接口
Some checks failed
CI / Build & Test (push) Failing after 6m47s

This commit is contained in:
MengStack Dev 2026-10-03 03:49:07 +08:00
parent df809f1045
commit d43205540d
3 changed files with 924 additions and 0 deletions

View File

@ -1939,6 +1939,46 @@ const docTemplate = `{
} }
} }
}, },
"/dashboard/stats": {
"get": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"description": "返回平台核心指标的统计数据",
"produces": [
"application/json"
],
"tags": [
"Dashboard"
],
"summary": "仪表盘统计",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/internal_modules_dashboard_interfaces.StatsResponse"
}
}
}
]
}
}
}
}
},
"/health": { "/health": {
"get": { "get": {
"description": "检查 PostgreSQL 和 Redis 连接状态", "description": "检查 PostgreSQL 和 Redis 连接状态",
@ -2185,6 +2225,248 @@ const docTemplate = `{
} }
} }
} }
},
"/users": {
"get": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"description": "分页获取当前租户下的用户列表,支持搜索和状态过滤",
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "用户列表",
"parameters": [
{
"type": "integer",
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "每页数量",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"description": "搜索关键词",
"name": "search",
"in": "query"
},
{
"type": "integer",
"description": "状态过滤",
"name": "status",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "创建用户",
"parameters": [
{
"description": "用户信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.CreateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO"
}
}
}
]
}
}
}
}
},
"/users/{id}": {
"get": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "获取用户详情",
"parameters": [
{
"type": "integer",
"description": "用户 ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO"
}
}
}
]
}
}
}
},
"put": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "更新用户",
"parameters": [
{
"type": "integer",
"description": "用户 ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "更新内容",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.UpdateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO"
}
}
}
]
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"tags": [
"Users"
],
"summary": "删除用户",
"parameters": [
{
"type": "integer",
"description": "用户 ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
}
}
}
}
} }
}, },
"definitions": { "definitions": {
@ -2240,6 +2522,35 @@ const docTemplate = `{
} }
} }
}, },
"internal_modules_dashboard_interfaces.StatsResponse": {
"type": "object",
"properties": {
"onlineCount": {
"type": "integer"
},
"roleCount": {
"type": "integer"
},
"roleGrowth": {
"type": "number"
},
"tenantCount": {
"type": "integer"
},
"tenantGrowth": {
"type": "number"
},
"todayActiveUsers": {
"type": "integer"
},
"userCount": {
"type": "integer"
},
"userGrowth": {
"type": "number"
}
}
},
"mengstack_internal_app_version.Info": { "mengstack_internal_app_version.Info": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2295,6 +2606,35 @@ const docTemplate = `{
} }
} }
}, },
"mengstack_internal_modules_auth_domain.CreateUserRequest": {
"type": "object",
"required": [
"email",
"password",
"username"
],
"properties": {
"email": {
"type": "string"
},
"nickname": {
"type": "string"
},
"password": {
"type": "string",
"maxLength": 128,
"minLength": 8
},
"status": {
"type": "integer"
},
"username": {
"type": "string",
"maxLength": 64,
"minLength": 3
}
}
},
"mengstack_internal_modules_auth_domain.LoginRequest": { "mengstack_internal_modules_auth_domain.LoginRequest": {
"type": "object", "type": "object",
"required": [ "required": [
@ -2350,6 +2690,20 @@ const docTemplate = `{
} }
} }
}, },
"mengstack_internal_modules_auth_domain.UpdateUserRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"nickname": {
"type": "string"
},
"status": {
"type": "integer"
}
}
},
"mengstack_internal_modules_auth_domain.UserDTO": { "mengstack_internal_modules_auth_domain.UserDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2362,6 +2716,9 @@ const docTemplate = `{
"id": { "id": {
"type": "integer" "type": "integer"
}, },
"last_login": {
"type": "string"
},
"nickname": { "nickname": {
"type": "string" "type": "string"
}, },

View File

@ -1933,6 +1933,46 @@
} }
} }
}, },
"/dashboard/stats": {
"get": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"description": "返回平台核心指标的统计数据",
"produces": [
"application/json"
],
"tags": [
"Dashboard"
],
"summary": "仪表盘统计",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/internal_modules_dashboard_interfaces.StatsResponse"
}
}
}
]
}
}
}
}
},
"/health": { "/health": {
"get": { "get": {
"description": "检查 PostgreSQL 和 Redis 连接状态", "description": "检查 PostgreSQL 和 Redis 连接状态",
@ -2179,6 +2219,248 @@
} }
} }
} }
},
"/users": {
"get": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"description": "分页获取当前租户下的用户列表,支持搜索和状态过滤",
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "用户列表",
"parameters": [
{
"type": "integer",
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "每页数量",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"description": "搜索关键词",
"name": "search",
"in": "query"
},
{
"type": "integer",
"description": "状态过滤",
"name": "status",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "创建用户",
"parameters": [
{
"description": "用户信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.CreateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO"
}
}
}
]
}
}
}
}
},
"/users/{id}": {
"get": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "获取用户详情",
"parameters": [
{
"type": "integer",
"description": "用户 ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO"
}
}
}
]
}
}
}
},
"put": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "更新用户",
"parameters": [
{
"type": "integer",
"description": "用户 ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "更新内容",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.UpdateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO"
}
}
}
]
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
},
{
"TenantID": []
}
],
"tags": [
"Users"
],
"summary": "删除用户",
"parameters": [
{
"type": "integer",
"description": "用户 ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
}
}
}
}
} }
}, },
"definitions": { "definitions": {
@ -2234,6 +2516,35 @@
} }
} }
}, },
"internal_modules_dashboard_interfaces.StatsResponse": {
"type": "object",
"properties": {
"onlineCount": {
"type": "integer"
},
"roleCount": {
"type": "integer"
},
"roleGrowth": {
"type": "number"
},
"tenantCount": {
"type": "integer"
},
"tenantGrowth": {
"type": "number"
},
"todayActiveUsers": {
"type": "integer"
},
"userCount": {
"type": "integer"
},
"userGrowth": {
"type": "number"
}
}
},
"mengstack_internal_app_version.Info": { "mengstack_internal_app_version.Info": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2289,6 +2600,35 @@
} }
} }
}, },
"mengstack_internal_modules_auth_domain.CreateUserRequest": {
"type": "object",
"required": [
"email",
"password",
"username"
],
"properties": {
"email": {
"type": "string"
},
"nickname": {
"type": "string"
},
"password": {
"type": "string",
"maxLength": 128,
"minLength": 8
},
"status": {
"type": "integer"
},
"username": {
"type": "string",
"maxLength": 64,
"minLength": 3
}
}
},
"mengstack_internal_modules_auth_domain.LoginRequest": { "mengstack_internal_modules_auth_domain.LoginRequest": {
"type": "object", "type": "object",
"required": [ "required": [
@ -2344,6 +2684,20 @@
} }
} }
}, },
"mengstack_internal_modules_auth_domain.UpdateUserRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"nickname": {
"type": "string"
},
"status": {
"type": "integer"
}
}
},
"mengstack_internal_modules_auth_domain.UserDTO": { "mengstack_internal_modules_auth_domain.UserDTO": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -2356,6 +2710,9 @@
"id": { "id": {
"type": "integer" "type": "integer"
}, },
"last_login": {
"type": "string"
},
"nickname": { "nickname": {
"type": "string" "type": "string"
}, },

View File

@ -34,6 +34,25 @@ definitions:
manifest: manifest:
$ref: '#/definitions/internal_app_upgrade.Manifest' $ref: '#/definitions/internal_app_upgrade.Manifest'
type: object type: object
internal_modules_dashboard_interfaces.StatsResponse:
properties:
onlineCount:
type: integer
roleCount:
type: integer
roleGrowth:
type: number
tenantCount:
type: integer
tenantGrowth:
type: number
todayActiveUsers:
type: integer
userCount:
type: integer
userGrowth:
type: number
type: object
mengstack_internal_app_version.Info: mengstack_internal_app_version.Info:
properties: properties:
arch: arch:
@ -71,6 +90,27 @@ definitions:
- new_password - new_password
- old_password - old_password
type: object type: object
mengstack_internal_modules_auth_domain.CreateUserRequest:
properties:
email:
type: string
nickname:
type: string
password:
maxLength: 128
minLength: 8
type: string
status:
type: integer
username:
maxLength: 64
minLength: 3
type: string
required:
- email
- password
- username
type: object
mengstack_internal_modules_auth_domain.LoginRequest: mengstack_internal_modules_auth_domain.LoginRequest:
properties: properties:
email: email:
@ -109,6 +149,15 @@ definitions:
refresh_token: refresh_token:
type: string type: string
type: object type: object
mengstack_internal_modules_auth_domain.UpdateUserRequest:
properties:
email:
type: string
nickname:
type: string
status:
type: integer
type: object
mengstack_internal_modules_auth_domain.UserDTO: mengstack_internal_modules_auth_domain.UserDTO:
properties: properties:
avatar: avatar:
@ -117,6 +166,8 @@ definitions:
type: string type: string
id: id:
type: integer type: integer
last_login:
type: string
nickname: nickname:
type: string type: string
status: status:
@ -1430,6 +1481,27 @@ paths:
summary: 用户注册 summary: 用户注册
tags: tags:
- Auth - Auth
/dashboard/stats:
get:
description: 返回平台核心指标的统计数据
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/internal_modules_dashboard_interfaces.StatsResponse'
type: object
security:
- Bearer: []
- TenantID: []
summary: 仪表盘统计
tags:
- Dashboard
/health: /health:
get: get:
description: 检查 PostgreSQL 和 Redis 连接状态 description: 检查 PostgreSQL 和 Redis 连接状态
@ -1581,6 +1653,144 @@ paths:
summary: 就绪探针 summary: 就绪探针
tags: tags:
- System - System
/users:
get:
description: 分页获取当前租户下的用户列表,支持搜索和状态过滤
parameters:
- description: 页码
in: query
name: page
type: integer
- description: 每页数量
in: query
name: page_size
type: integer
- description: 搜索关键词
in: query
name: search
type: string
- description: 状态过滤
in: query
name: status
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 用户列表
tags:
- Users
post:
consumes:
- application/json
parameters:
- description: 用户信息
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_auth_domain.CreateUserRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_auth_domain.UserDTO'
type: object
security:
- Bearer: []
- TenantID: []
summary: 创建用户
tags:
- Users
/users/{id}:
delete:
parameters:
- description: 用户 ID
in: path
name: id
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 删除用户
tags:
- Users
get:
parameters:
- description: 用户 ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_auth_domain.UserDTO'
type: object
security:
- Bearer: []
- TenantID: []
summary: 获取用户详情
tags:
- Users
put:
consumes:
- application/json
parameters:
- description: 用户 ID
in: path
name: id
required: true
type: integer
- description: 更新内容
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_auth_domain.UpdateUserRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_auth_domain.UserDTO'
type: object
security:
- Bearer: []
- TenantID: []
summary: 更新用户
tags:
- Users
securityDefinitions: securityDefinitions:
Bearer: Bearer:
description: Bearer <token> description: Bearer <token>