feat(users): add drag-and-drop reordering for PICs

Introduce pic_sort_order to persist custom user ordering
Replace data table with a custom draggable grid layout
Add API endpoint to handle bulk order updates
This commit is contained in:
2026-05-04 14:07:43 +08:00
parent 30753fdc61
commit 4e40bfd804
6 changed files with 355 additions and 91 deletions

View File

@@ -73,3 +73,19 @@ export function parseUserProfileInput(body: {
role
}
}
export function parseUserOrderInput(body: {
userIds?: unknown
}) {
assertBadRequest(Array.isArray(body.userIds), 'User ids must be an array')
assertBadRequest(body.userIds.every((value) => typeof value === 'string' && value.trim()), 'Every user id is required')
const userIds = body.userIds.map((value) => value.trim())
const uniqueUserIds = new Set(userIds)
assertBadRequest(uniqueUserIds.size === userIds.length, 'User ids must be unique')
return {
userIds
}
}