feat: 实现文件夹和书签的持久排序与拖拽功能

This commit is contained in:
2026-01-18 23:33:31 +08:00
parent 6eb3c730bb
commit dbeb181e5d
49 changed files with 3141 additions and 507 deletions

View File

@@ -64,13 +64,15 @@ components:
visibility:
type: string
enum: [public, private]
sortOrder:
type: integer
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required: [id, userId, parentId, name, visibility, createdAt, updatedAt]
required: [id, userId, parentId, name, visibility, sortOrder, createdAt, updatedAt]
Bookmark:
type: object
properties:
@@ -85,6 +87,8 @@ components:
- type: string
format: uuid
- type: 'null'
sortOrder:
type: integer
title:
type: string
url:
@@ -107,7 +111,7 @@ components:
- type: string
format: date-time
- type: 'null'
required: [id, userId, folderId, title, url, urlNormalized, urlHash, visibility, source, updatedAt, deletedAt]
required: [id, userId, folderId, sortOrder, title, url, urlNormalized, urlHash, visibility, source, updatedAt, deletedAt]
FolderPatch:
type: object
@@ -122,6 +126,23 @@ components:
visibility:
type: string
enum: [public, private]
sortOrder:
type: integer
FolderReorderRequest:
type: object
properties:
parentId:
anyOf:
- type: string
format: uuid
- type: 'null'
orderedIds:
type: array
items:
type: string
format: uuid
required: [parentId, orderedIds]
BookmarkPatch:
type: object
@@ -138,6 +159,23 @@ components:
visibility:
type: string
enum: [public, private]
sortOrder:
type: integer
BookmarkReorderRequest:
type: object
properties:
folderId:
anyOf:
- type: string
format: uuid
- type: 'null'
orderedIds:
type: array
items:
type: string
format: uuid
required: [folderId, orderedIds]
security: []
paths:
/health:
@@ -337,6 +375,31 @@ paths:
type: boolean
required: [ok]
/folders/reorder:
post:
tags: [Folders]
summary: Reorder folders within the same parent
operationId: reorderFolders
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/FolderReorderRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
ok:
type: boolean
required: [ok]
/bookmarks/public:
get:
tags: [Bookmarks]
@@ -414,6 +477,31 @@ paths:
schema:
$ref: '#/components/schemas/Bookmark'
/bookmarks/reorder:
post:
tags: [Bookmarks]
summary: Reorder bookmarks within the same folder
operationId: reorderBookmarks
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BookmarkReorderRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
ok:
type: boolean
required: [ok]
/bookmarks/{id}:
patch:
tags: [Bookmarks]
@@ -544,6 +632,160 @@ paths:
type: boolean
required: [ok]
/admin/users:
get:
tags: [Admin]
summary: List users (admin only)
operationId: adminListUsers
security:
- bearerAuth: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
/admin/users/{id}/bookmarks:
get:
tags: [Admin]
summary: List a user's bookmarks (admin only)
operationId: adminListUserBookmarks
security:
- bearerAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: string
format: uuid
- in: query
name: q
schema:
type: string
required: false
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Bookmark'
/admin/users/{id}/folders:
get:
tags: [Admin]
summary: List a user's folders (admin only)
operationId: adminListUserFolders
security:
- bearerAuth: []
parameters:
- in: path
name: id
required: true
schema:
type: string
format: uuid
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Folder'
/admin/users/{userId}/bookmarks/{bookmarkId}:
delete:
tags: [Admin]
summary: Delete a user's bookmark (admin only)
operationId: adminDeleteUserBookmark
security:
- bearerAuth: []
parameters:
- in: path
name: userId
required: true
schema:
type: string
format: uuid
- in: path
name: bookmarkId
required: true
schema:
type: string
format: uuid
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Bookmark'
/admin/users/{userId}/folders/{folderId}:
delete:
tags: [Admin]
summary: Delete a user's folder (admin only)
operationId: adminDeleteUserFolder
security:
- bearerAuth: []
parameters:
- in: path
name: userId
required: true
schema:
type: string
format: uuid
- in: path
name: folderId
required: true
schema:
type: string
format: uuid
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Folder'
/admin/users/{userId}/bookmarks/{bookmarkId}/copy-to-me:
post:
tags: [Admin]
summary: Copy a user's bookmark to admin account (admin only)
operationId: adminCopyUserBookmarkToMe
security:
- bearerAuth: []
parameters:
- in: path
name: userId
required: true
schema:
type: string
format: uuid
- in: path
name: bookmarkId
required: true
schema:
type: string
format: uuid
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Bookmark'
/sync/pull:
get:
tags: [Sync]