515 lines
17 KiB
Go
515 lines
17 KiB
Go
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||
package docs
|
||
|
||
import "github.com/swaggo/swag"
|
||
|
||
const docTemplate = `{
|
||
"schemes": {{ marshal .Schemes }},
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"description": "{{escape .Description}}",
|
||
"title": "{{.Title}}",
|
||
"contact": {},
|
||
"version": "{{.Version}}"
|
||
},
|
||
"host": "{{.Host}}",
|
||
"basePath": "{{.BasePath}}",
|
||
"paths": {
|
||
"/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/mengstack_internal_modules_auth_domain.LoginRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.TokenPair"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_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/mengstack_internal_kernel_response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.TokenPair"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_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/mengstack_internal_modules_auth_domain.RegisterRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/mengstack_internal_modules_auth_domain.TokenPair"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "Bad Request",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
|
||
}
|
||
},
|
||
"409": {
|
||
"description": "Conflict",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_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/mengstack_internal_modules_auth_domain.ChangePasswordRequest"
|
||
}
|
||
}
|
||
],
|
||
"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"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/ping": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "返回 pong,用于验证认证和多租户中间件是否正常",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"System"
|
||
],
|
||
"summary": "健康探测",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/profile": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"Bearer": []
|
||
},
|
||
{
|
||
"TenantID": []
|
||
}
|
||
],
|
||
"description": "返回当前认证用户的个人资料",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Auth"
|
||
],
|
||
"summary": "获取当前用户信息",
|
||
"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"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "Not Found",
|
||
"schema": {
|
||
"$ref": "#/definitions/mengstack_internal_kernel_response.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"mengstack_internal_kernel_response.Response": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer"
|
||
},
|
||
"data": {},
|
||
"message": {
|
||
"type": "string"
|
||
},
|
||
"trace_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"mengstack_internal_modules_auth_domain.ChangePasswordRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"new_password",
|
||
"old_password"
|
||
],
|
||
"properties": {
|
||
"new_password": {
|
||
"type": "string",
|
||
"maxLength": 128,
|
||
"minLength": 8
|
||
},
|
||
"old_password": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"mengstack_internal_modules_auth_domain.LoginRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"email",
|
||
"password"
|
||
],
|
||
"properties": {
|
||
"email": {
|
||
"type": "string"
|
||
},
|
||
"password": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"mengstack_internal_modules_auth_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
|
||
}
|
||
}
|
||
},
|
||
"mengstack_internal_modules_auth_domain.TokenPair": {
|
||
"type": "object",
|
||
"properties": {
|
||
"access_token": {
|
||
"type": "string"
|
||
},
|
||
"expires_in": {
|
||
"type": "integer"
|
||
},
|
||
"refresh_token": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"mengstack_internal_modules_auth_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"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"securityDefinitions": {
|
||
"Bearer": {
|
||
"description": "Bearer \u003ctoken\u003e",
|
||
"type": "apiKey",
|
||
"name": "Authorization",
|
||
"in": "header"
|
||
},
|
||
"TenantID": {
|
||
"description": "租户 ID(受保护接口必填)",
|
||
"type": "apiKey",
|
||
"name": "X-Tenant-ID",
|
||
"in": "header"
|
||
}
|
||
}
|
||
}`
|
||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||
var SwaggerInfo = &swag.Spec{
|
||
Version: "0.1.0",
|
||
Host: "localhost:2222",
|
||
BasePath: "/api/v1",
|
||
Schemes: []string{},
|
||
Title: "MengStack API",
|
||
Description: "MengStack 平台 API 文档",
|
||
InfoInstanceName: "swagger",
|
||
SwaggerTemplate: docTemplate,
|
||
LeftDelim: "{{",
|
||
RightDelim: "}}",
|
||
}
|
||
|
||
func init() {
|
||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||
}
|