308 lines
7.8 KiB
YAML
308 lines
7.8 KiB
YAML
basePath: /api/v1
|
||
definitions:
|
||
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
|
||
host: localhost:2222
|
||
info:
|
||
contact: {}
|
||
description: MengStack 平台 API 文档
|
||
title: MengStack API
|
||
version: 0.1.0
|
||
paths:
|
||
/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
|
||
/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
|
||
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"
|