refactor: remove ebook system, unify on media-items
Phase 1-3: Database layer cleanup - Remove 5 backward compatibility VIEWs (ebooks, ebook_ratings, etc.) - Remove all ebook-specific database queries - Add new admin media-items queries (Create, Update, Delete) - Fix sqlc.yaml to point to schema.sql file - Regenerate database code successfully Phase 4: Remove old ebook handlers - Remove all 23 ebook handler functions: * ListEbooks, GetEbook, CreateEbook, UpdateEbook, DeleteEbook * GetEbookRating, CreateOrUpdateEbookRating, DeleteEbookRating, GetEbookRatings * GetEbookNotes, CreateEbookNote, GetEbookNote, UpdateEbookNote, DeleteEbookNote * GetEbookHighlights, CreateEbookHighlight, GetEbookHighlight, UpdateEbookHighlight, DeleteEbookHighlight * GetReadingProgress, UpdateReadingProgress - Remove ebook request types (CreateEbookRequest, UpdateEbookRequest, etc.) Phase 5: Add new admin media-items handlers - CreateMediaItem (admin only, requires library_id) - UpdateMediaItem (admin only) - DeleteMediaItem (admin only) - Add CreateMediaItemRequest, UpdateMediaItemRequest types - All use MustGetAuthenticatedUser for safe context access - Validate admin role before allowing operations - Validate library exists before creating items Phase 6: Update routes - Remove ALL /api/ebooks routes from SetupRoutes() - Remove ebook progress, rating, notes, highlights routes - Add admin.POST/PUT/DELETE /api/media-items routes - Keep all media-items, scanner, and watch mode routes intact Result: Unified API with only /api/media-items endpoints - All features preserved (filtering, sorting, searching) - Better features than old ebook system (more fields, library scoping) - Cleaner codebase with single system - All code compiles successfully Breaking Change: /api/ebooks endpoints removed (use /api/media-items instead) Status: 85% complete (Phases 1-6 done, Phases 7-8 pending: tests + rebuild) Tests: Need update (rename Ebooks → MediaItems, update API paths) Build: Need rebuild with clean cache
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
version: "2"
|
||||
sql:
|
||||
- engine: "postgresql"
|
||||
schema: "../../database/schema"
|
||||
schema: "../../database/schema/schema.sql"
|
||||
queries: "./queries"
|
||||
gen:
|
||||
go:
|
||||
|
||||
Reference in New Issue
Block a user