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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user