Skip to content

Fix(backend): implement missing routes and controllers for note reordering and stack grouping (#133)#138

Open
Pratyush-Panda-2006 wants to merge 2 commits into
niharika-mente:mainfrom
Pratyush-Panda-2006:fix-notes-reordering-and-grouping-issue-133
Open

Fix(backend): implement missing routes and controllers for note reordering and stack grouping (#133)#138
Pratyush-Panda-2006 wants to merge 2 commits into
niharika-mente:mainfrom
Pratyush-Panda-2006:fix-notes-reordering-and-grouping-issue-133

Conversation

@Pratyush-Panda-2006

Copy link
Copy Markdown
Contributor

This PR implements the missing Express backend endpoints PATCH /api/notes/:id/reorder and POST /api/notes/group to support dragging, reordering, and stacking note cards on the React frontend. It also adds a virtual groupId field mapping to parentId for frontend compatibility, and sorts notes by position and createdAt on retrieve.

Comment on lines +194 to +197
const siblingNotes = await Note.find({
userId: req.user._id,
parentId: targetParentId
}).sort({ position: 1, createdAt: -1 });

router.post("/group", groupNotes);

router.get("/:id", getNoteById);

router.patch("/:id/reorder", reorderNotes);

export default router; No newline at end of file
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants