kan icon indicating copy to clipboard operation
kan copied to clipboard

feat: added board ordering in project using dnd

Open kotserge opened this issue 9 months ago • 1 comments

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

kotserge avatar Feb 21 '26 16:02 kotserge

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 userBoardFavorites table with boardUsers (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); indexes board_user_user_idx, board_user_board_idx
  • basic extensions of repository, api, hooks to handle member-joining and reorders
  • frontend adjustments to allow board card drag-n-drop
    • dnd-kit as new dependency for functionality

kotserge avatar Jun 04 '26 15:06 kotserge