Some checks failed
CI / Build & Test (push) Failing after 33s
- 37 个端点全部添加 godoc Swagger 注解(RBAC 11 / Org 5 / Audit 1 / Settings 7 / Notification 7) - 重新生成 docs/(swagger.json/yaml/docs.go) - M8 质量横切:IP 限流、安全头、Body 限制、结构化日志增强、优雅关闭 - 新增 Dockerfile 多阶段构建 + .dockerignore - 新增 testutil 测试工具包 - 修复 testutil.go 编译错误
2441 lines
81 KiB
JSON
2441 lines
81 KiB
JSON
{
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"description": "MengStack 平台 API 文档",
|
||
"title": "MengStack API",
|
||
"contact": {},
|
||
"version": "0.1.0"
|
||
},
|
||
"host": "localhost:2222",
|
||
"basePath": "/api/v1",
|
||
"paths": {
|
||
"/api/v1/audit/logs": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "分页查询审计日志,支持按用户、操作、资源筛选",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Audit"
|
||
],
|
||
"summary": "查询审计日志",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "按用户 ID 筛选",
|
||
"name": "user_id",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "按操作筛选",
|
||
"name": "action",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "按资源类型筛选",
|
||
"name": "resource",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"description": "页码(默认 1)",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"description": "每页条数(默认 20)",
|
||
"name": "page_size",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/notifications": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "向指定用户发送通知",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Notification"
|
||
],
|
||
"summary": "创建通知",
|
||
"parameters": [
|
||
{
|
||
"description": "通知内容",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.CreateNotificationRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.NotificationDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/notifications/read-all": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "将当前用户的所有通知标记为已读",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Notification"
|
||
],
|
||
"summary": "全部标记已读",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/notifications/unread-count": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "获取当前用户的未读通知数量",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Notification"
|
||
],
|
||
"summary": "获取未读通知数",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/notifications/user/{userId}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "分页获取指定用户的通知列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Notification"
|
||
],
|
||
"summary": "获取用户通知列表",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "用户 ID",
|
||
"name": "userId",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"description": "页码(默认 1)",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"description": "每页条数(默认 20)",
|
||
"name": "page_size",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/notifications/{id}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "根据 ID 获取指定通知的详细信息",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Notification"
|
||
],
|
||
"summary": "获取通知详情",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "通知 ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.NotificationDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "删除指定通知",
|
||
"tags": [
|
||
"Notification"
|
||
],
|
||
"summary": "删除通知",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "通知 ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/notifications/{id}/read": {
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "将指定通知标记为已读",
|
||
"tags": [
|
||
"Notification"
|
||
],
|
||
"summary": "标记通知已读",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "通知 ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/org/tenants": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "获取系统中的所有租户列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Org"
|
||
],
|
||
"summary": "列出所有租户",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/domain.TenantDTO"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "创建新的租户(组织),需提供名称和 slug",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Org"
|
||
],
|
||
"summary": "创建租户",
|
||
"parameters": [
|
||
{
|
||
"description": "租户信息",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.CreateTenantRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.TenantDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"409": {
|
||
"description": "Conflict",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/org/tenants/{id}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "根据 ID 获取指定租户的详细信息",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Org"
|
||
],
|
||
"summary": "获取租户详情",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "租户 ID (UUID)",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.TenantDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "更新租户的名称、slug 或状态",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Org"
|
||
],
|
||
"summary": "更新租户",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "租户 ID (UUID)",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "更新内容",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.UpdateTenantRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.TenantDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "删除指定租户及其所有关联数据",
|
||
"tags": [
|
||
"Org"
|
||
],
|
||
"summary": "删除租户",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "租户 ID (UUID)",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/rbac/permissions": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "获取所有权限列表,可按模块筛选",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "列出权限",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "按模块筛选",
|
||
"name": "module",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/domain.PermissionDTO"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/rbac/roles": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "获取当前租户下的所有角色",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "列出角色",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/domain.RoleDTO"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "在当前租户下创建新角色",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "创建角色",
|
||
"parameters": [
|
||
{
|
||
"description": "角色信息",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.CreateRoleRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.RoleDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"409": {
|
||
"description": "Conflict",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/rbac/roles/{id}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "根据 ID 获取角色信息,包含权限列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "获取角色详情",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "角色 ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.RoleDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "更新角色名称或描述",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "更新角色",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "角色 ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "更新内容",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.UpdateRoleRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.RoleDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "删除指定角色(系统角色不可删除)",
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "删除角色",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "角色 ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"403": {
|
||
"description": "Forbidden",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/rbac/roles/{id}/permissions": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "获取指定角色已分配的权限列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "获取角色权限列表",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "角色 ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/domain.PermissionDTO"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "为角色批量设置权限(覆盖原有权限)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "设置角色权限",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "角色 ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "权限 ID 列表",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.SetRolePermissionsRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/rbac/users/{userId}/roles": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "获取指定用户的所有角色及权限",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "获取用户角色",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "用户 ID",
|
||
"name": "userId",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/domain.RoleDTO"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "为指定用户分配一个角色",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "分配角色给用户",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "用户 ID",
|
||
"name": "userId",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "角色 ID",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.AssignRoleRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"409": {
|
||
"description": "Conflict",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/rbac/users/{userId}/roles/{roleId}": {
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "从指定用户移除一个角色",
|
||
"tags": [
|
||
"RBAC"
|
||
],
|
||
"summary": "移除用户角色",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "用户 ID",
|
||
"name": "userId",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"description": "角色 ID",
|
||
"name": "roleId",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/settings": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "获取所有全局配置项",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "列出全局配置",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/domain.SettingDTO"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/settings/global/{key}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "根据 key 获取全局(非租户)配置项",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "获取全局配置",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "配置键名",
|
||
"name": "key",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.SettingDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "创建或更新全局配置项",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "更新全局配置",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "配置键名",
|
||
"name": "key",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "配置值",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.UpdateSettingRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/settings/tenant": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "获取当前租户的所有配置项",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "列出租户配置",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/domain.SettingDTO"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "Internal Server Error",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/settings/tenant/{key}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "根据 key 获取当前租户的配置项",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "获取租户配置",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "配置键名",
|
||
"name": "key",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.SettingDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "创建或更新当前租户的配置项",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "更新租户配置",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "配置键名",
|
||
"name": "key",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "配置值",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.UpdateSettingRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "删除当前租户的指定配置项",
|
||
"tags": [
|
||
"Settings"
|
||
],
|
||
"summary": "删除租户配置",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "配置键名",
|
||
"name": "key",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/login": {
|
||
"post": {
|
||
"description": "使用邮箱和密码登录,返回 JWT token",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Auth"
|
||
],
|
||
"summary": "用户登录",
|
||
"parameters": [
|
||
{
|
||
"description": "登录信息",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.LoginRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.TokenPair"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/refresh": {
|
||
"post": {
|
||
"description": "使用 refresh_token 获取新的 token 对",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Auth"
|
||
],
|
||
"summary": "刷新 Token",
|
||
"parameters": [
|
||
{
|
||
"description": "{ \\",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.TokenPair"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/auth/register": {
|
||
"post": {
|
||
"description": "使用邮箱、用户名和密码注册新用户,返回 JWT token",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Auth"
|
||
],
|
||
"summary": "用户注册",
|
||
"parameters": [
|
||
{
|
||
"description": "注册信息",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.RegisterRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.TokenPair"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"409": {
|
||
"description": "Conflict",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/health": {
|
||
"get": {
|
||
"description": "检查 PostgreSQL 和 Redis 连接状态",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"System"
|
||
],
|
||
"summary": "健康检查",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"database": {
|
||
"type": "string"
|
||
},
|
||
"redis": {
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"type": "string"
|
||
},
|
||
"timestamp": {
|
||
"type": "integer"
|
||
},
|
||
"trace_id": {
|
||
"type": "string"
|
||
},
|
||
"version": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/password": {
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "使用旧密码验证后设置新密码",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Auth"
|
||
],
|
||
"summary": "修改密码",
|
||
"parameters": [
|
||
{
|
||
"description": "密码修改请求",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/domain.ChangePasswordRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/ping": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "返回 pong,用于验证认证和多租户中间件是否正常",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"System"
|
||
],
|
||
"summary": "健康探测",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/profile": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "返回当前认证用户的个人资料",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Auth"
|
||
],
|
||
"summary": "获取当前用户信息",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/domain.UserDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"domain.AssignRoleRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"role_id"
|
||
],
|
||
"properties": {
|
||
"role_id": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"domain.ChangePasswordRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"new_password",
|
||
"old_password"
|
||
],
|
||
"properties": {
|
||
"new_password": {
|
||
"type": "string",
|
||
"maxLength": 128,
|
||
"minLength": 8
|
||
},
|
||
"old_password": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.CreateNotificationRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"title",
|
||
"user_id"
|
||
],
|
||
"properties": {
|
||
"content": {
|
||
"type": "string"
|
||
},
|
||
"title": {
|
||
"type": "string"
|
||
},
|
||
"type": {
|
||
"type": "string"
|
||
},
|
||
"user_id": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"domain.CreateRoleRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.CreateTenantRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"name",
|
||
"slug"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"slug": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.LoginRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"email",
|
||
"password"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string"
|
||
},
|
||
"password": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.NotificationDTO": {
|
||
"type": "object",
|
||
"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"
|
||
}
|
||
}
|
||
},
|
||
"domain.PermissionDTO": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"module": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.RegisterRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"email",
|
||
"password",
|
||
"username"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string"
|
||
},
|
||
"nickname": {
|
||
"type": "string"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"maxLength": 128,
|
||
"minLength": 8
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"maxLength": 64,
|
||
"minLength": 3
|
||
}
|
||
}
|
||
},
|
||
"domain.RoleDTO": {
|
||
"type": "object",
|
||
"properties": {
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"is_system": {
|
||
"type": "boolean"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"permissions": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/domain.PermissionDTO"
|
||
}
|
||
},
|
||
"tenant_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.SetRolePermissionsRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"permission_ids"
|
||
],
|
||
"properties": {
|
||
"permission_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"domain.SettingDTO": {
|
||
"type": "object",
|
||
"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"
|
||
}
|
||
}
|
||
},
|
||
"domain.TenantDTO": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"slug": {
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"type": "integer"
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.TokenPair": {
|
||
"type": "object",
|
||
"properties": {
|
||
"access_token": {
|
||
"type": "string"
|
||
},
|
||
"expires_in": {
|
||
"type": "integer"
|
||
},
|
||
"refresh_token": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.UpdateRoleRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.UpdateSettingRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"value"
|
||
],
|
||
"properties": {
|
||
"type": {
|
||
"type": "string"
|
||
},
|
||
"value": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"domain.UpdateTenantRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"slug": {
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"domain.UserDTO": {
|
||
"type": "object",
|
||
"properties": {
|
||
"avatar": {
|
||
"type": "string"
|
||
},
|
||
"email": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"nickname": {
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"type": "integer"
|
||
},
|
||
"tenant_id": {
|
||
"type": "string"
|
||
},
|
||
"username": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"response.Response": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer"
|
||
},
|
||
"data": {},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"trace_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"securityDefinitions": {
|
||
"Bearer": {
|
||
"description": "Bearer \u003ctoken\u003e",
|
||
"type": "apiKey",
|
||
"name": "Authorization",
|
||
"in": "header"
|
||
},
|
||
"TenantID": {
|
||
"description": "租户 ID(受保护接口必填)",
|
||
"type": "apiKey",
|
||
"name": "X-Tenant-ID",
|
||
"in": "header"
|
||
}
|
||
}
|
||
} |