Implement complete bookmark functionality for Bible reading

Add both chapter-level and verse-level bookmarking capabilities:

Database Changes:
- Add ChapterBookmark table for chapter-level bookmarks
- Update schema with proper relationships to User and BibleBook models
- Maintain existing Bookmark table for verse-level bookmarks

API Endpoints:
- /api/bookmarks/chapter (GET, POST, DELETE) with check endpoint
- /api/bookmarks/verse (GET, POST, DELETE) with check and bulk-check endpoints
- JWT authentication required for all bookmark operations
- Multilingual error messages (Romanian/English)

Frontend Implementation:
- Chapter bookmark button in Bible page header with visual state feedback
- Individual verse bookmark icons with hover-to-reveal UI
- Highlighted background for bookmarked verses
- Efficient bulk checking for verse bookmarks per chapter
- Real-time UI updates without page refresh

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
andupetcu
2025-09-21 01:25:50 +03:00
parent e4acac270e
commit 1b43b4e1e3
9 changed files with 890 additions and 31 deletions

View File

@@ -21,6 +21,7 @@ model User {
sessions Session[]
bookmarks Bookmark[]
chapterBookmarks ChapterBookmark[]
notes Note[]
chatMessages ChatMessage[]
prayerRequests PrayerRequest[]
@@ -68,6 +69,7 @@ model BibleBook {
orderNum Int
bookKey String // For cross-version matching (e.g., "genesis", "exodus")
chapters BibleChapter[]
chapterBookmarks ChapterBookmark[]
version BibleVersion @relation(fields: [versionId], references: [id])
@@ -151,6 +153,21 @@ model Bookmark {
@@index([userId])
}
model ChapterBookmark {
id String @id @default(uuid())
userId String
bookId String
chapterNum Int
note String?
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
book BibleBook @relation(fields: [bookId], references: [id])
@@unique([userId, bookId, chapterNum])
@@index([userId])
}
model Note {
id String @id @default(uuid())
userId String