mengstack-api/docs/swagger.yaml
MengStack Dev df809f1045
Some checks failed
CI / Build & Test (push) Failing after 1m31s
feat: user CRUD API + dashboard stats + kernel infrastructure
- Add user management endpoints (list/create/get/update/delete) with pagination and search
- Add dashboard stats endpoint with tenant/user/online counts and growth metrics
- Add tenant resolver middleware for multi-tenant request scoping
- Add i18n kernel with zh/en message files and AcceptLanguage middleware
- Add WebSocket hub/handler for real-time communication
- Add job scheduler kernel with cron support
- Add plugin sandbox for isolated execution
- Add storage kernel (local filesystem)
- Add event bus kernel for pub/sub
- Add cache kernel abstraction
- Add database migration runner and version upgrade checker
- Add rate limiting middleware with Redis backend
- Add SQL migrations for rbac, audit_logs, settings, notifications, examples
- Extend user repository with list/delete/count operations
- Register all module routes with tenant resolver
2026-10-03 03:42:58 +08:00

1596 lines
42 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

basePath: /api/v1
definitions:
internal_app_upgrade.Manifest:
properties:
changelog:
type: string
checksum_sha256:
type: string
critical:
type: boolean
download_url:
type: string
min_version:
type: string
published_at:
type: string
size:
type: integer
version:
type: string
type: object
internal_app_upgrade.UpgradeStatus:
properties:
available:
type: boolean
checked_at:
type: string
critical:
type: boolean
current_version:
type: string
latest_version:
type: string
manifest:
$ref: '#/definitions/internal_app_upgrade.Manifest'
type: object
mengstack_internal_app_version.Info:
properties:
arch:
type: string
build_date:
type: string
commit:
type: string
go_version:
type: string
os:
type: string
version:
type: string
type: object
mengstack_internal_kernel_response.Response:
properties:
code:
type: integer
data: {}
message:
type: string
trace_id:
type: string
type: object
mengstack_internal_modules_auth_domain.ChangePasswordRequest:
properties:
new_password:
maxLength: 128
minLength: 8
type: string
old_password:
type: string
required:
- new_password
- old_password
type: object
mengstack_internal_modules_auth_domain.LoginRequest:
properties:
email:
type: string
password:
type: string
required:
- email
- password
type: object
mengstack_internal_modules_auth_domain.RegisterRequest:
properties:
email:
type: string
nickname:
type: string
password:
maxLength: 128
minLength: 8
type: string
username:
maxLength: 64
minLength: 3
type: string
required:
- email
- password
- username
type: object
mengstack_internal_modules_auth_domain.TokenPair:
properties:
access_token:
type: string
expires_in:
type: integer
refresh_token:
type: string
type: object
mengstack_internal_modules_auth_domain.UserDTO:
properties:
avatar:
type: string
email:
type: string
id:
type: integer
nickname:
type: string
status:
type: integer
tenant_id:
type: string
username:
type: string
type: object
mengstack_internal_modules_notification_domain.CreateNotificationRequest:
properties:
content:
type: string
title:
type: string
type:
type: string
user_id:
type: integer
required:
- title
- user_id
type: object
mengstack_internal_modules_notification_domain.NotificationDTO:
properties:
content:
type: string
created_at:
type: string
id:
type: integer
is_read:
type: boolean
tenant_id:
type: string
title:
type: string
type:
type: string
user_id:
type: integer
type: object
mengstack_internal_modules_org_domain.CreateTenantRequest:
properties:
name:
type: string
slug:
type: string
required:
- name
- slug
type: object
mengstack_internal_modules_org_domain.TenantDTO:
properties:
created_at:
type: string
id:
type: string
name:
type: string
slug:
type: string
status:
type: integer
updated_at:
type: string
type: object
mengstack_internal_modules_org_domain.UpdateTenantRequest:
properties:
name:
type: string
slug:
type: string
status:
type: integer
type: object
mengstack_internal_modules_rbac_domain.AssignRoleRequest:
properties:
role_id:
type: integer
required:
- role_id
type: object
mengstack_internal_modules_rbac_domain.CreateRoleRequest:
properties:
description:
type: string
name:
type: string
required:
- name
type: object
mengstack_internal_modules_rbac_domain.PermissionDTO:
properties:
code:
type: string
description:
type: string
id:
type: integer
module:
type: string
name:
type: string
type: object
mengstack_internal_modules_rbac_domain.RoleDTO:
properties:
description:
type: string
id:
type: integer
is_system:
type: boolean
name:
type: string
permissions:
items:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.PermissionDTO'
type: array
tenant_id:
type: string
type: object
mengstack_internal_modules_rbac_domain.SetRolePermissionsRequest:
properties:
permission_ids:
items:
type: integer
type: array
required:
- permission_ids
type: object
mengstack_internal_modules_rbac_domain.UpdateRoleRequest:
properties:
description:
type: string
name:
type: string
type: object
mengstack_internal_modules_settings_domain.SettingDTO:
properties:
id:
type: integer
key:
type: string
scope:
type: string
tenant_id:
type: string
type:
type: string
updated_at:
type: string
updated_by:
type: integer
value:
type: string
type: object
mengstack_internal_modules_settings_domain.UpdateSettingRequest:
properties:
type:
type: string
value:
type: string
required:
- value
type: object
host: localhost:2222
info:
contact: {}
description: MengStack 平台 API 文档
title: MengStack API
version: 0.1.0
paths:
/api/upgrade/check:
get:
description: 检查是否有新版本可用(当前为预留接口,返回当前版本信息)
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/internal_app_upgrade.UpgradeStatus'
summary: 升级检查
tags:
- System
/api/v1/audit/logs:
get:
description: 分页查询审计日志,支持按用户、操作、资源筛选
parameters:
- description: 按用户 ID 筛选
in: query
name: user_id
type: integer
- description: 按操作筛选
in: query
name: action
type: string
- description: 按资源类型筛选
in: query
name: resource
type: string
- description: 页码(默认 1)
in: query
name: page
type: integer
- description: 每页条数(默认 20)
in: query
name: page_size
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 查询审计日志
tags:
- Audit
/api/v1/notifications:
post:
consumes:
- application/json
description: 向指定用户发送通知
parameters:
- description: 通知内容
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_notification_domain.CreateNotificationRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_notification_domain.NotificationDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 创建通知
tags:
- Notification
/api/v1/notifications/{id}:
delete:
description: 删除指定通知
parameters:
- description: 通知 ID
in: path
name: id
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 删除通知
tags:
- Notification
get:
description: 根据 ID 获取指定通知的详细信息
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_notification_domain.NotificationDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取通知详情
tags:
- Notification
/api/v1/notifications/{id}/read:
put:
description: 将指定通知标记为已读
parameters:
- description: 通知 ID
in: path
name: id
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 标记通知已读
tags:
- Notification
/api/v1/notifications/read-all:
put:
description: 将当前用户的所有通知标记为已读
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 全部标记已读
tags:
- Notification
/api/v1/notifications/unread-count:
get:
description: 获取当前用户的未读通知数量
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取未读通知数
tags:
- Notification
/api/v1/notifications/user/{userId}:
get:
description: 分页获取指定用户的通知列表
parameters:
- description: 用户 ID
in: path
name: userId
required: true
type: integer
- description: 页码(默认 1)
in: query
name: page
type: integer
- description: 每页条数(默认 20)
in: query
name: page_size
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取用户通知列表
tags:
- Notification
/api/v1/org/tenants:
get:
description: 获取系统中的所有租户列表
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
items:
$ref: '#/definitions/mengstack_internal_modules_org_domain.TenantDTO'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 列出所有租户
tags:
- Org
post:
consumes:
- application/json
description: 创建新的租户(组织),需提供名称和 slug
parameters:
- description: 租户信息
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_org_domain.CreateTenantRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_org_domain.TenantDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"409":
description: Conflict
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 创建租户
tags:
- Org
/api/v1/org/tenants/{id}:
delete:
description: 删除指定租户及其所有关联数据
parameters:
- description: 租户 ID (UUID)
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 删除租户
tags:
- Org
get:
description: 根据 ID 获取指定租户的详细信息
parameters:
- description: 租户 ID (UUID)
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_org_domain.TenantDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取租户详情
tags:
- Org
put:
consumes:
- application/json
description: 更新租户的名称、slug 或状态
parameters:
- description: 租户 ID (UUID)
in: path
name: id
required: true
type: string
- description: 更新内容
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_org_domain.UpdateTenantRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_org_domain.TenantDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 更新租户
tags:
- Org
/api/v1/rbac/permissions:
get:
description: 获取所有权限列表,可按模块筛选
parameters:
- description: 按模块筛选
in: query
name: module
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
items:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.PermissionDTO'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 列出权限
tags:
- RBAC
/api/v1/rbac/roles:
get:
description: 获取当前租户下的所有角色
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
items:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.RoleDTO'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 列出角色
tags:
- RBAC
post:
consumes:
- application/json
description: 在当前租户下创建新角色
parameters:
- description: 角色信息
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.CreateRoleRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.RoleDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"409":
description: Conflict
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 创建角色
tags:
- RBAC
/api/v1/rbac/roles/{id}:
delete:
description: 删除指定角色(系统角色不可删除)
parameters:
- description: 角色 ID
in: path
name: id
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"403":
description: Forbidden
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 删除角色
tags:
- RBAC
get:
description: 根据 ID 获取角色信息,包含权限列表
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_rbac_domain.RoleDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取角色详情
tags:
- RBAC
put:
consumes:
- application/json
description: 更新角色名称或描述
parameters:
- description: 角色 ID
in: path
name: id
required: true
type: integer
- description: 更新内容
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.UpdateRoleRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.RoleDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 更新角色
tags:
- RBAC
/api/v1/rbac/roles/{id}/permissions:
get:
description: 获取指定角色已分配的权限列表
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:
items:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.PermissionDTO'
type: array
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取角色权限列表
tags:
- RBAC
put:
consumes:
- application/json
description: 为角色批量设置权限(覆盖原有权限)
parameters:
- description: 角色 ID
in: path
name: id
required: true
type: integer
- description: 权限 ID 列表
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.SetRolePermissionsRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 设置角色权限
tags:
- RBAC
/api/v1/rbac/users/{userId}/roles:
get:
description: 获取指定用户的所有角色及权限
parameters:
- description: 用户 ID
in: path
name: userId
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
items:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.RoleDTO'
type: array
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取用户角色
tags:
- RBAC
post:
consumes:
- application/json
description: 为指定用户分配一个角色
parameters:
- description: 用户 ID
in: path
name: userId
required: true
type: integer
- description: 角色 ID
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_rbac_domain.AssignRoleRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"409":
description: Conflict
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 分配角色给用户
tags:
- RBAC
/api/v1/rbac/users/{userId}/roles/{roleId}:
delete:
description: 从指定用户移除一个角色
parameters:
- description: 用户 ID
in: path
name: userId
required: true
type: integer
- description: 角色 ID
in: path
name: roleId
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 移除用户角色
tags:
- RBAC
/api/v1/settings:
get:
description: 获取所有全局配置项
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
items:
$ref: '#/definitions/mengstack_internal_modules_settings_domain.SettingDTO'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 列出全局配置
tags:
- Settings
/api/v1/settings/global/{key}:
get:
description: 根据 key 获取全局(非租户)配置项
parameters:
- description: 配置键名
in: path
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_settings_domain.SettingDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取全局配置
tags:
- Settings
put:
consumes:
- application/json
description: 创建或更新全局配置项
parameters:
- description: 配置键名
in: path
name: key
required: true
type: string
- description: 配置值
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_settings_domain.UpdateSettingRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 更新全局配置
tags:
- Settings
/api/v1/settings/tenant:
get:
description: 获取当前租户的所有配置项
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
items:
$ref: '#/definitions/mengstack_internal_modules_settings_domain.SettingDTO'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 列出租户配置
tags:
- Settings
/api/v1/settings/tenant/{key}:
delete:
description: 删除当前租户的指定配置项
parameters:
- description: 配置键名
in: path
name: key
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 删除租户配置
tags:
- Settings
get:
description: 根据 key 获取当前租户的配置项
parameters:
- description: 配置键名
in: path
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/mengstack_internal_kernel_response.Response'
- properties:
data:
$ref: '#/definitions/mengstack_internal_modules_settings_domain.SettingDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取租户配置
tags:
- Settings
put:
consumes:
- application/json
description: 创建或更新当前租户的配置项
parameters:
- description: 配置键名
in: path
name: key
required: true
type: string
- description: 配置值
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_settings_domain.UpdateSettingRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 更新租户配置
tags:
- Settings
/api/version:
get:
description: 返回构建版本、提交哈希、编译时间等
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_app_version.Info'
summary: 版本信息
tags:
- System
/auth/login:
post:
consumes:
- application/json
description: 使用邮箱和密码登录,返回 JWT token
parameters:
- description: 登录信息
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_auth_domain.LoginRequest'
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.TokenPair'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
summary: 用户登录
tags:
- Auth
/auth/refresh:
post:
consumes:
- application/json
description: 使用 refresh_token 获取新的 token 对
parameters:
- description: '{ \'
in: body
name: request
required: true
schema:
type: object
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.TokenPair'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
summary: 刷新 Token
tags:
- Auth
/auth/register:
post:
consumes:
- application/json
description: 使用邮箱、用户名和密码注册新用户,返回 JWT token
parameters:
- description: 注册信息
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_auth_domain.RegisterRequest'
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.TokenPair'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"409":
description: Conflict
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
summary: 用户注册
tags:
- Auth
/health:
get:
description: 检查 PostgreSQL 和 Redis 连接状态
produces:
- application/json
responses:
"200":
description: OK
schema:
properties:
database:
type: string
redis:
type: string
status:
type: string
timestamp:
type: integer
trace_id:
type: string
version:
type: string
type: object
summary: 健康检查
tags:
- System
/healthz:
get:
description: Kubernetes liveness probe,进程存活即返回 200
produces:
- application/json
responses:
"200":
description: OK
schema:
properties:
status:
type: string
type: object
summary: 存活探针
tags:
- System
/password:
post:
consumes:
- application/json
description: 使用旧密码验证后设置新密码
parameters:
- description: 密码修改请求
in: body
name: request
required: true
schema:
$ref: '#/definitions/mengstack_internal_modules_auth_domain.ChangePasswordRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 修改密码
tags:
- Auth
/ping:
get:
description: 返回 pong,用于验证认证和多租户中间件是否正常
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 健康探测
tags:
- System
/profile:
get:
description: 返回当前认证用户的个人资料
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
"401":
description: Unauthorized
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
"404":
description: Not Found
schema:
$ref: '#/definitions/mengstack_internal_kernel_response.Response'
security:
- Bearer: []
- TenantID: []
summary: 获取当前用户信息
tags:
- Auth
/readyz:
get:
description: Kubernetes readiness probe,检查数据库和 Redis 连接
produces:
- application/json
responses:
"200":
description: OK
schema:
properties:
database:
type: string
redis:
type: string
status:
type: string
type: object
"503":
description: Service Unavailable
schema:
properties:
database:
type: string
redis:
type: string
status:
type: string
type: object
summary: 就绪探针
tags:
- System
securityDefinitions:
Bearer:
description: Bearer <token>
in: header
name: Authorization
type: apiKey
TenantID:
description: 租户 ID(受保护接口必填)
in: header
name: X-Tenant-ID
type: apiKey
swagger: "2.0"