feat(users): add user bookmarks CRUD with ownership and duplicate checks - #1757
Merged
Merged
Conversation
The user_bookmarks table and a list endpoint existed, but create/delete endpoints with ownership enforcement and duplicate rejection were missing. - Add POST /users/me/bookmarks (CreateBookmarkDto) scoped to the authenticated user; returns 409 Conflict on a duplicate bookmark and 404 when the market does not exist. - Add DELETE /users/me/bookmarks/:id scoped to the authenticated user so another user's bookmark is indistinguishable from a missing one (404). - Add UsersService.addBookmark/removeBookmark with ownership + duplicate checks aligned with the DB unique index on (user_id, market_id). - Add unit tests covering ownership enforcement and duplicate rejection.
|
@abimbolaalabi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds the missing User Bookmarks CRUD endpoints. The \user_bookmarks\ table and a list endpoint already existed, but create/delete endpoints with ownership enforcement and duplicate rejection were missing, so users could not fully manage their bookmarks securely.
Related Issue
Closes #1644
Changes
emoveBookmark(userId, bookmarkId)\ — scopes the lookup to the caller's \userId, so another user's bookmark is indistinguishable from a missing one (\404).
The DB-level unique index on (user_id, market_id)\ (existing migration + entity) backs the duplicate prevention.
Verification Results
\
pnpm run test # 111 suites / 1414 tests passed
pnpm run build # passed
pnpm run migration:check-timestamps # passed
eslint changed files # no new errors
\\
Acceptance Criteria