docs: comprehensive implementation plan for collection detail fix
This implementation plan addresses multiple architectural improvements: **Security Fix:** - Add user-scoped WebSocket broadcasts to prevent cross-user data leaks - Current broadcast sends ALL collection updates to ALL users - New BroadcastToUser() method ensures privacy between users **Features:** - Add optional library_id filter to search API (partial + fuzzy) - Add library filter toggle UI in Add Books modal - Remove 265 lines of inline JavaScript from template - Convert to proper TypeScript with type safety **Architecture:** - Full-stack task: backend, database, frontend, documentation - User-scoped broadcasts follow JWT + device auth patterns - Progressive enhancement maintained (SSR + JS enhancement) - WebSocket real-time sync preserved for multi-device support **Testing:** - Integration tests using setupTestServer() helper - Tests for library filtering (no filter, lib1, lib2, invalid) - Tests for user-scoped WebSocket broadcasts - Bruno API tests for new library_id parameter **Documentation:** - API docs at docs/developer/api/search.md - Git strategy: 6 logical commits outlined - Testing checklist for manual + automated verification **Files Modified:** - internal/sync/websocket.go: Add BroadcastToUser() - internal/handlers/collections.go: Use user-scoped broadcasts - internal/database/queries.sql: Add library_id filter - internal/handlers/media.go: Accept library_id parameter - templates/collections.templ: Remove inline JS, add toggle UI - web/src/collections.ts: TypeScript with WebSocket support - internal/router/frontend.go: Pass libraryID to template - Tests, docs, Bruno tests This plan follows all PROJECT_GUIDELINES.md requirements including TypeScript conversion, TailwindCSS only, procedural style, proper commit organization, and comprehensive testing.
This commit is contained in:
+717
-159
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user