[feature/backend] implement /users handler + switch to username + add display name + user management cli
This commit is contained in:
parent
1d712d4e6c
commit
86ab334bc9
38 changed files with 1851 additions and 506 deletions
|
@ -60,12 +60,20 @@ User:
|
|||
type: object
|
||||
required:
|
||||
- id
|
||||
- email
|
||||
- username
|
||||
- role
|
||||
- status
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
username:
|
||||
type: string
|
||||
minLength: 3
|
||||
maxLength: 32
|
||||
display_name:
|
||||
type: string
|
||||
maxLength: 64
|
||||
description: 用户显示名称
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
|
@ -74,11 +82,13 @@ User:
|
|||
enum:
|
||||
- admin
|
||||
- editor
|
||||
- contributor
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- active
|
||||
- inactive
|
||||
- banned
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
|
|
|
@ -70,6 +70,8 @@ components:
|
|||
Daily:
|
||||
$ref: './components/schemas.yaml#/Daily'
|
||||
paths:
|
||||
/auth/register:
|
||||
$ref: './paths/auth.yaml#/register'
|
||||
/auth/login:
|
||||
$ref: './paths/auth.yaml#/login'
|
||||
/auth/logout:
|
||||
|
|
|
@ -1,3 +1,63 @@
|
|||
register:
|
||||
post:
|
||||
tags:
|
||||
- auth
|
||||
summary: 用户注册
|
||||
operationId: register
|
||||
security: [] # 注册接口不需要认证
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- username
|
||||
- email
|
||||
- password
|
||||
- role
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
minLength: 3
|
||||
maxLength: 32
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
minLength: 8
|
||||
role:
|
||||
type: string
|
||||
enum:
|
||||
- admin
|
||||
- editor
|
||||
- contributor
|
||||
responses:
|
||||
'200':
|
||||
description: 注册成功
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- token
|
||||
- user
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
user:
|
||||
$ref: '../components/schemas.yaml#/User'
|
||||
'400':
|
||||
description: 用户名已存在
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '../components/schemas.yaml#/Error'
|
||||
'422':
|
||||
$ref: '../components/responses.yaml#/ValidationError'
|
||||
|
||||
login:
|
||||
post:
|
||||
tags:
|
||||
|
@ -12,12 +72,13 @@ login:
|
|||
schema:
|
||||
type: object
|
||||
required:
|
||||
- email
|
||||
- username
|
||||
- password
|
||||
properties:
|
||||
email:
|
||||
username:
|
||||
type: string
|
||||
format: email
|
||||
minLength: 3
|
||||
maxLength: 32
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue