kan
kan copied to clipboard
feat: added board ordering in project using dnd
This pull request contains feature for reordering boards by drag-and-drop through the UI:
- Added a position column to the board schema to enable explicit ordering within a workspace
- Implemented position management in the repository layer: auto-assign on create, decrement on delete, CASE-based reorder with duplicate auto-heal
- Added position field to the board update tRPC mutation to trigger reordering
- Built drag-and-drop UI using @dnd-kit with rectSortingStrategy for CSS grid support, programmatic navigation to prevent click-on-drop, and optimistic cache updates with rollback on error
Hey @hjball.
My bad, I let this drag on for so long. While I am not using this anymore (as I do not need multi-tenant features and a local file is enough for me) I do not want to let our time go to waste.
I have incorporated your suggestions and this should now work on a per-user basis. The changes introduce:
- replaced the
userBoardFavoritestable withboardUsers(board_user) (including migration)userId(uuid, FK -> users, cascade),boardId(bigint, FK -> boards, cascade)position(integer, not null),isFavourite(boolean, not null, default false)createdAt(timestamp, default now)- Composite PK
(userId, boardId); indexesboard_user_user_idx,board_user_board_idx
- basic extensions of
repository,api,hooksto handle member-joining and reorders - frontend adjustments to allow board card drag-n-drop
- dnd-kit as new dependency for functionality