refactor(bookmark): 重构书签服务入口文件并整合用户权限功能

将 bookmark.go 重命名为 main.go,并调整包引用路径。将 bookmarks 和 user_np
两个模块的处理逻辑合并到同一个服务中,统一注册路由。同时更新了相关 API
的引用路径,确保生成代码与内部实现正确绑定。

此外,移除了独立的 user_np 服务入口文件,其功能已整合至 bookmark 服务中。

配置文件中调整了 user_np 和 vfs 服务的端口及部分接口定义,完善了用户
相关操作的路径参数和请求体结构。
This commit is contained in:
zzy
2025-09-25 09:50:35 +08:00
parent 1e81e603de
commit 24f238f377
23 changed files with 1173 additions and 601 deletions

View File

@ -4,43 +4,47 @@ info:
description: 虚拟文件系统API服务
version: '1.0'
servers:
- url: http://localhost:8083/api
- url: http://localhost:8080/api
description: 开发环境
- url: https://api.zzyxyz.com/api
description: 生产环境
tags:
- name: vfs
description: 虚拟文件系统相关操作
- name: user
description: 用户相关操作
security:
- ApiKeyAuth: []
paths:
/vfs/v1/users:
/vfs/v1/users/{username}:
parameters:
- name: username
in: path
example: user
required: true
schema:
type: string
post:
summary: 创建用户
description: 创建一个用户
operationId: createUser
tags: [vfs]
requestBody:
required: true
content:
application/json:
schema:
type: string
description: 用户名
tags: [user]
responses:
'201':
description: 创建成功
content:
application/json:
headers:
X-VFS-Token:
schema:
type: string
description: X-VFS-TOKEN
description: 认证令牌
delete:
summary: 删除用户
description: 删除一个用户
operationId: deleteUser
tags: [vfs]
tags: [user]
responses:
'204':
description: 删除成功
@ -106,7 +110,7 @@ paths:
operationId: createVFSNode
tags: [vfs]
requestBody:
required: true
required: false
content:
application/json:
schema:
@ -130,19 +134,25 @@ paths:
patch:
summary: 修改文件或修改目录
description: 修改/移动/重命名 已存在的 文件/目录
description: 修改/移动/重命名/复制 已存在的 文件/目录
operationId: updateVFSNode
tags: [vfs]
parameters:
- name: op
in: query
description: 操作模式
required: true
schema:
type: string
enum: [move, rename, change, copy]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
new_name:
type: string
description: 新名称(用于重命名)
type: string
description: 目的文件夹路径 / 文件名路径
example: "/home/"
responses:
'200':
description: 操作成功
@ -182,6 +192,7 @@ components:
type: apiKey
in: header
name: X-VFS-Token
responses:
ServerInternalError:
description: 服务器内部错误
@ -189,12 +200,14 @@ components:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: 未授权
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
VFSNodeType:
type: string
@ -222,6 +235,7 @@ components:
- type
- created_at
- updated_at
VFSDirectoryEntry:
type: object
properties: