新增书签服务主程序,使用 Gin 框架搭建 HTTP 服务器,并注册书签相关接口处理器。 配置 CORS 中间件以支持跨域请求。服务监听端口为 8081。 feat(user_np): 初始化用户权限服务并注册认证接口 新增用户权限服务主程序,使用 Gin 框架搭建 HTTP 服务器,并注册登录、注册及修改密码等接口处理器。 服务监听端口为 8082。 refactor(config): 重构 OpenAPI 配置文件结构并拆分模块 将原有合并的 OpenAPI 配置文件按功能模块拆分为 bookmark 和 user_np 两个独立目录, 分别管理各自的 server、client 及 API 定义文件,便于后续维护和扩展。 refactor(vfs): 调整虚拟文件系统 API 接口路径与参数定义 更新 VFS API 配置文件,修改部分接口路径及参数结构, 如将文件路径参数由 path 转为 query 参数,并优化响应结构体定义。
128 lines
2.7 KiB
YAML
128 lines
2.7 KiB
YAML
openapi: '3.0.3'
|
|
info:
|
|
title: zzyxyz_user_np_api
|
|
description: 用户节点权限相关操作(user_name and password)
|
|
version: '1.0'
|
|
servers:
|
|
- url: http://localhost:8082/api
|
|
description: 开发环境
|
|
- url: https://api.zzyxyz.com/api
|
|
description: 生产环境
|
|
security:
|
|
- ApiKeyAuth: []
|
|
|
|
paths:
|
|
/auth/login:
|
|
post:
|
|
summary: 用户登录
|
|
description: 使用用户名和密码进行登录
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/LoginRequest'
|
|
responses:
|
|
'200':
|
|
description: 登录成功
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/LoginResponse'
|
|
'400':
|
|
description: 请求参数错误
|
|
'401':
|
|
description: 认证失败
|
|
|
|
/auth/register:
|
|
post:
|
|
summary: 用户注册
|
|
description: 创建新用户账户
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/RegisterRequest'
|
|
responses:
|
|
'201':
|
|
description: 注册成功
|
|
'400':
|
|
description: 请求参数错误
|
|
'409':
|
|
description: 用户名已存在
|
|
|
|
/auth/password:
|
|
put:
|
|
summary: 修改密码
|
|
description: 修改已登录用户的密码
|
|
security:
|
|
- ApiKeyAuth: []
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ChangePasswordRequest'
|
|
responses:
|
|
'200':
|
|
description: 密码修改成功
|
|
'400':
|
|
description: 请求参数错误
|
|
'401':
|
|
description: 认证失败
|
|
|
|
components:
|
|
schemas:
|
|
LoginRequest:
|
|
type: object
|
|
required:
|
|
- username
|
|
- password
|
|
properties:
|
|
username:
|
|
type: string
|
|
password:
|
|
type: string
|
|
|
|
LoginResponse:
|
|
type: object
|
|
properties:
|
|
token:
|
|
type: string
|
|
expires_in:
|
|
type: integer
|
|
user_id:
|
|
type: integer
|
|
format: int64
|
|
|
|
RegisterRequest:
|
|
type: object
|
|
required:
|
|
- username
|
|
- password
|
|
properties:
|
|
username:
|
|
type: string
|
|
password:
|
|
type: string
|
|
email:
|
|
type: string
|
|
|
|
ChangePasswordRequest:
|
|
type: object
|
|
required:
|
|
- old_password
|
|
- new_password
|
|
properties:
|
|
old_password:
|
|
type: string
|
|
new_password:
|
|
type: string
|
|
|
|
securitySchemes:
|
|
ApiKeyAuth:
|
|
type: apiKey
|
|
in: header
|
|
name: Authorization
|