Skip to content

Add bookmark read-side support: ArticleBookmarksReadService and bookmarked flag in ArticleData#518

Open
devin-ai-integration[bot] wants to merge 1 commit intodevin/1775649236-bookmark-data-layerfrom
devin/1775649572-bookmark-read-layer
Open

Add bookmark read-side support: ArticleBookmarksReadService and bookmarked flag in ArticleData#518
devin-ai-integration[bot] wants to merge 1 commit intodevin/1775649236-bookmark-data-layerfrom
devin/1775649572-bookmark-read-layer

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot commented Apr 8, 2026

Summary

Adds read-side support for bookmarks, following the existing ArticleFavoritesReadService patterns:

  • New ArticleBookmarksReadService mapper interface with isUserBookmark, userBookmarks (batch), userBookmarkArticleIds, and countUserBookmarks
  • New MyBatis XML with SQL implementations for all four methods
  • ArticleData.bookmarked boolean field added (defaults to false)
  • ArticleQueryService.fillExtraInfo updated in both overloads to populate the bookmarked flag for authenticated users
  • Integration test covering single-article, list, and null-user flows

The userBookmarkArticleIds and countUserBookmarks methods are defined for upcoming bookmark-listing endpoints but are not yet called in this PR.

Review & Testing Checklist for Human

  • Verify bookmarked field appears correctly in JSON API responses — Adding this field to ArticleData means it will now be serialized in all article API responses. Confirm this is acceptable for downstream consumers.
  • Check SQL in ArticleBookmarksReadService.xml — The userBookmarks query goes directly against article_bookmarks (unlike favorites which joins through articles). Verify this is correct for the article_bookmarks schema from Task 1's migration.
  • Validate @AllArgsConstructor field ordering — The new bookmarked boolean sits between favoritesCount (int) and createdAt (DateTime) in ArticleData. All 6 existing test constructor call sites were updated. Compilation passing gives confidence, but worth a quick scan.

Suggested manual test plan: Boot the app, create a user, create an article, bookmark it via the data layer, then GET /articles/{slug} — confirm "bookmarked": true appears. Fetch the same article unauthenticated and confirm "bookmarked" defaults to false.

Notes

  • Depends on Task 1 branch devin/1775649236-bookmark-data-layer which provides the article_bookmarks table and write-side infrastructure.
  • Two read service methods (userBookmarkArticleIds, countUserBookmarks) are forward-looking for a future bookmarks listing API and have no callers yet.

Link to Devin session: https://app.devin.ai/sessions/23f82d42a45f431e90cd635eb519e96e
Requested by: @schaudhry123


Open with Devin

…ookmarked flag in ArticleData

Co-Authored-By: Samir Chaudhry <schaudhry123@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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.

1 participant