feat(storage): implement user-group level file management dashboard and APIs

- Expose user-scoped CRUD APIs under `/api/v1/upload` (my files query, stats, rename, delete)
- Update backend handlers and routers with ownership validation checks
- Create a dedicated frontend personal file manager card-list and upload button under `/files`
- Add comprehensive backend test coverage and update API docs
This commit is contained in:
ryan
2026-06-13 16:14:22 +08:00
parent 8b19ffed90
commit 5b13d5b464
13 changed files with 1421 additions and 21 deletions
+139
View File
@@ -938,6 +938,19 @@ definitions:
total:
type: integer
type: object
upload.listMyFilesResponse:
properties:
items:
items:
$ref: '#/definitions/model.Upload'
type: array
page:
type: integer
page_size:
type: integer
total:
type: integer
type: object
upload.trendItem:
properties:
count:
@@ -947,6 +960,17 @@ definitions:
size:
type: integer
type: object
upload.updateMyFileRequest:
properties:
access_mode:
enum:
- 0
- 1
type: integer
file_name:
maxLength: 255
type: string
type: object
user.changePasswordRequest:
properties:
new_password:
@@ -3470,6 +3494,121 @@ paths:
summary: 上传文件
tags:
- upload
/api/v1/upload/{id}:
delete:
description: 将当前用户本人的文件状态置为 deleted(软删除)
parameters:
- description: 文件 ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: 删除成功
schema:
$ref: '#/definitions/util.ResponseAny'
"403":
description: 无权操作
schema:
$ref: '#/definitions/util.ResponseAny'
"404":
description: 文件不存在
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 删除我的文件
tags:
- upload
put:
consumes:
- application/json
description: 更新当前用户本人的文件名或访问权限模式 (AccessMode)
parameters:
- description: 文件 ID
in: path
name: id
required: true
type: string
- description: 更新字段
in: body
name: request
required: true
schema:
$ref: '#/definitions/upload.updateMyFileRequest'
produces:
- application/json
responses:
"200":
description: 更新成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/model.Upload'
type: object
"403":
description: 无权操作
schema:
$ref: '#/definitions/util.ResponseAny'
"404":
description: 文件不存在
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 更新我的文件信息
tags:
- upload
/api/v1/upload/my:
get:
description: 分页获取当前登录用户上传的文件,支持文件名关键词、业务类型、扩展名过滤
parameters:
- description: 页码(默认 1)
in: query
name: page
type: integer
- description: 每页数量(默认 20,最大 100)
in: query
name: page_size
type: integer
- description: 文件名关键词(模糊匹配)
in: query
name: keyword
type: string
- description: 业务分类过滤
in: query
name: type
type: string
- description: 扩展名过滤
in: query
name: extension
type: string
produces:
- application/json
responses:
"200":
description: 查询成功
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
$ref: '#/definitions/upload.listMyFilesResponse'
type: object
"401":
description: 未登录
schema:
$ref: '#/definitions/util.ResponseAny'
security:
- SessionCookie: []
summary: 获取我的文件列表
tags:
- upload
/api/v1/user-info:
get:
description: 返回当前登录用户的基本信息及余额数据,需要登录。包括用户 ID、用户名、信任等级、各类余额信息等。