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

@@ -41,6 +41,29 @@ async function initializeDatabase() {
add column if not exists phone_number text
`
await sql`
alter table users
add column if not exists pic_sort_order integer not null default 0
`
await sql`
update users
set pic_sort_order = seed.sort_order
from (
select
id,
row_number() over (
order by
case when role = 'super_admin' then 0 else 1 end,
created_at asc,
full_name asc
) as sort_order
from users
) as seed
where users.id = seed.id
and users.pic_sort_order = 0
`
await sql`
create table if not exists user_passkeys (
id text primary key,