Commit Graph
71 Commits
Author SHA1 Message Date
john-okeefe 17e0fc2625 test: fix test login password to match bcrypt hash
Fixed loginTestUser to use 'Test@Pass123!' (with @ symbol) to match the
bcrypt hash that was generated using Go's golang.org/x/crypto/bcrypt library.
2026-02-06 13:55:28 -05:00
john-okeefe 034e261c78 test: fix test password hash to use Go-generated bcrypt
Changed login test password from 'Test@Pass123!' to 'testpass123' and updated
bcrypt hash to use Go's golang.org/x/crypto/bcrypt library instead of Python's bcrypt.
2026-02-06 13:52:12 -05:00
john-okeefe 014047a1e3 test: update test helpers to use router package
Changes to test_helpers.go:
- Import router package and use router.RegisterRoutes()
- Create all necessary handlers (auth, device, koreader, ws, conflict, analytics, queue, opds)
- Add proper validator setup
- Add CustomValidator type
- Remove unused pgtype import

This makes integration tests use the same router configuration as production,
ensuring tests cover the actual API behavior and route structure.
2026-02-06 13:37:23 -05:00
john-okeefe 6784c25b2e refactor: complete router package migration
Major refactoring milestone - migrate all routes from main.go to internal/router/ package:

## Changes

### cmd/server/main.go
- Reduced from 858 lines to 163 lines (81% reduction)
- Removed all inline route definitions
- Added router.RegisterRoutes() call with full config
- Clean separation: setup → router registration → server start

### internal/router/ package
Created comprehensive route organization:
- router.go: Main router setup and JWT middleware
- auth.go: Authentication routes (login, register, profile, etc.)
- library.go: Library management routes
- device.go: Device registration and management
- sync.go: KOReader/Kobo sync + book matching + WebSocket
- media.go: Media download, shelves, bulk operations
- conflicts.go: Conflict resolution routes
- analytics.go: Analytics API routes
- queue.go: Sync queue management
- opds.go: OPDS feed routes
- frontend.go: SSR pages (/login, /admin, /dashboard, etc.)
- docs.go: Documentation routes
- helpers.go: Template rendering helpers

## Verification
 All 26 guideline checks pass
 Code compiles successfully
 Zero API behavior changes (100% compatible)
 Follows Go standard project layout

## Breaking Changes
None - API compatibility fully maintained
2026-02-06 11:49:28 -05:00
john-okeefe 2a7338200c feat: add health check and restore frontend routes
Health check endpoint:
- Add /health endpoint that pings database with 2-second timeout
- Returns 200 when DB connected, 503 when unavailable
- Provides true end-to-end health verification

Frontend routes restoration (routes removed in c5f327b):
- Add public routes: /, /login, /register with smart auth detection
- Add redirect routes: /bookshelf, /dashboard
- Add admin routes: /admin, /admin/profile, /admin/library
- Add SSR routes: /api/devices-page, /api/conflicts-page
- Add 'FRONTEND ROUTES - DO NOT DELETE' comment block to prevent future removal

Docker Compose healthcheck:
- Update to use curl on /health endpoint (pg_isready not in Alpine)
- Add 10s start_period for app initialization
- Accurately reflects app + database health status

All changes maintain backward compatibility and existing API behavior.
2026-02-06 10:52:54 -05:00
john-okeefe a89d5c599d feat: implement Hybrid SSR for bookshelf page
- Add LibraryData type to templates/types.go
- Update bookshelf template to accept libraries parameter
- Render libraries server-side for faster initial page load
- Libraries now populated from server data instead of AJAX fetch
- JavaScript still uses API for dynamic content (bookshelf items)
- Update /bookshelf route to fetch libraries server-side before render
- Properly handle UUID and pgtype.Text conversions
- Maintain API endpoint compatibility for JavaScript calls

This improves initial page load performance while preserving
dynamic functionality via API calls.
2026-02-02 16:46:45 -05:00
john-okeefe 542fbaf116 docs: add Lunr.js search with fuzzy matching and highlighting
Phase 4 part 1: Add search infrastructure
- Add SearchDoc struct and GenerateSearchIndex to docs handler
- Add stripHTML helper for plain text extraction
- Add ServeSearchIndex endpoint to http handler
- Add /docs/search-index.json route in main.go
- Search index includes all documentation files with ID, title, content, URL
2026-02-02 09:08:37 -05:00
john-okeefe 5c7137feb8 docs: add interactive documentation system with Go+HTMX
- Add internal/docs package with markdown renderer (goldmark)
- Create docs layout template with sidebar navigation
- Implement hierarchical navigation auto-generated from docs folder
- Add table of contents generator (extract ## headings)
- Add syntax highlighting for code blocks (highlight.js)
- Add mobile responsive design
- Add /docs routes to main.go

The documentation system features:
- Dark theme matching app design
- Collapsible sidebar sections (Getting Started, User Guide, Device Setup, API Reference, Contributing)
- Table of contents for each page
- Breadcrumb navigation
- Full-text search (client-side JavaScript, API endpoint ready)
- Syntax highlighting for code blocks
- Mobile-friendly with hamburger menu

All documentation is served from /docs route, no authentication required.
Markdown files are rendered using goldmark with GFM extensions and syntax highlighting.
2026-02-01 18:33:55 -05:00
john-okeefe 655ed9225f Update code references and tests: Bookmann → Bookhoard
Code changes:
- main.go: Update cache directory path
- sidecar.go: Update file extension (.bookmann.json → .bookhoard.json)
- security.go: Update CORS example URLs
- queue_test.go: Update test database name
- feed_test.go: Update test assertions
- phase1_integration_test.go: Update test email addresses
- TEST_COVERAGE.md: Update project references

Part of project rename to Bookhoard.
2026-02-01 16:21:10 -05:00
john-okeefe 4e1feca124 Rename test file references: Bookmann → Bookhoard
Test file updates:
- Update import paths in test files: bookmann/internal → bookhoard/internal
- Update test helper functions and references
- Update test comments and documentation

This is part 6 of the project rename to Bookhoard.
2026-02-01 16:12:18 -05:00
john-okeefe 00a083b60b Rename backend code references: Bookmann → Bookhoard
Backend changes:
- Update import paths: bookmann/internal → bookhoard/internal
- Rename struct fields: BookmannUUID → BookhoardUUID
- Update handler function names: mapContentIdToBookmannUUID → mapContentIdToBookhoardUUID
- Update HTTP response headers: X-Bookmann-* → X-Bookhoard-*
- Update service and middleware references
- Update main.go imports and references

This is part 2 of the project rename to Bookhoard.
2026-02-01 16:11:54 -05:00
john-okeefe dacbea6f85 test: add comprehensive media-item ISBN validation tests
New test file with 5 test suites:
- TestMediaItemISBNNormalization (8 test cases)
- TestMediaItemISBNEdgeCases (3 test cases)
- TestMediaItemsPagination (5 test cases)
- TestMediaItemLibraryRequirement (2 test cases)
- TestUpdateMediaItemISBN (1 test case)

Features:
- Tests use /api/media-items endpoint (not deprecated /api/ebooks)
- Real API calls (not mock handlers)
- Comprehensive ISBN-10/ISBN-13 normalization coverage
- Pagination validation with limit/offset edge cases
- Library requirement validation

This replaces the functionality lost from isbn_and_library_test.go
with modern, working tests using current API endpoints.

Phase 3: Test Suite Cleanup - Replacement Tests
2026-02-01 14:11:24 -05:00
john-okeefe 01321d1720 test: remove outdated ISBN normalization tests
- Deleted isbn_and_library_test.go (507 lines)
- All tests used deprecated /api/ebooks endpoint
- Tests were mock-based, not real API calls
- Functionality will be replaced with modern tests

This is part of legacy code cleanup Phase 3.
Phase 3: Test Suite Cleanup
2026-02-01 14:11:18 -05:00
john-okeefe 72db266e23 test: remove outdated ebook pagination tests
- Removed TestPaginationAndFiltering function
- Deleted 4 test cases using deprecated /api/ebooks endpoint
- Tests for pagination already exist in library_test.go using /api/media-items

This is part of legacy code cleanup Phase 3.
Phase 3: Test Suite Cleanup
2026-02-01 14:11:17 -05:00
john-okeefe 351c68b0b8 test: add comprehensive test coverage for API endpoints and services 2026-02-01 13:21:34 -05:00
john-okeefe 9b1282cd08 test: remove hardcoded refresh token test from main_test.go 2026-02-01 13:21:32 -05:00
john-okeefe c5f327b991 refactor(routes): add new bulk and analytics endpoints, clean up SSR
New endpoints:
- Analytics: /analytics, /analytics/reading-stats, /analytics/device-usage, /analytics/popular-books
- Sync bulk: /sync/bulk-link-books, /sync/auto-link-books, /sync/unlinked-books/:id/suggestions
- Collections bulk: /collections/bulk-add-books
- Books bulk: /books/bulk-delete, /books/bulk-update
- Conflicts bulk: /conflicts/bulk-resolve, /conflicts/bulk-dismiss
- OPDS: /opds/devices/:deviceId/* (catalog, search, nav, download, cover, formats)

Removed:
- Redundant SSR template routes (consolidated into handler methods)
- Manual JWT parsing in routes (use middleware)
- Legacy dashboard and bookshelf routes

Created conversion service instance for OPDS integration
2026-02-01 12:15:52 -05:00
john-okeefe 40c732481a feat(collections): add real-time updates via WebSocket (Limitation #4)
Implement real-time collection updates when books are added/removed:

Backend Changes:
- Added connManager to CollectionHandler struct
- Updated constructor to accept ConnectionManager
- Updated all NewCollectionHandler() calls in ebook.go and main.go
- Added WebSocket broadcasts in AddBooks() handler
- Added WebSocket broadcasts in BulkRemoveBooks() handler
- Broadcasts collection_updated events with:
  - collection_id: Which collection changed
  - action: books_added or books_removed
  - book_ids: Array of affected book IDs
  - count: Number of books changed

Frontend Changes:
- Added WebSocket connection in collections UI
- connectWebSocket() establishes connection to /ws/sync
- Listens for collection_updated events
- Shows toast notification on collection change
- Auto-reloads page after 1 second to show updated book list
- Auto-reconnect on disconnect (5s delay)
- Error handling for WebSocket failures

WebSocket Event Format:
{
  "type": "collection_updated",
  "timestamp": "2026-02-01T12:00:00Z",
  "data": {
    "collection_id": "uuid",
    "action": "books_added",
    "book_ids": ["uuid1", "uuid2"],
    "count": 2
  }
}

User Experience:
- When another user adds books to a collection, all connected clients see:
  1. Toast notification: "Collection updated: books_added (2 books)"
  2. Page auto-refreshes after 1 second
  3. Updated book list displays
- Same for book removal
- Works across multiple browser tabs/devices
- No manual refresh needed

Technical Notes:
- Broadcasts to ALL connected WebSocket clients
- Client-side filtering by collection_id
- Existing progress/conflict broadcasts continue to work
- Connection manager handles broadcast distribution

Resolves Limitation #4: Real-time Collection Updates
2026-02-01 00:54:41 -05:00
john-okeefe ff98c17531 feat(ssr): add server-side routes for Phase 9 frontend features
Add SSR routes for collections, progress, and devices pages:

Progress Page (/api/progress):
- Fetches all user progress with device sync sources
- Maps device types to icons (Kobo, KOReader, Web, Mobile)
- Server-renders progress visualization with real data

Collections Pages (/api/collections):
- GET /collections: List all user collections with SSR
- GET /collections/🆔 Collection detail page with books SSR
- Fetches collection metadata and book listings
- Converts database models to template data structures

Helper Functions:
- getTemplateUserWithTheme: Fetches user with theme preference
- Proper error handling for missing data

All routes use JWT authentication and fetch data server-side
for better SEO and initial page load performance. Client-side
enhancements can be added via HTMX for interactive features.

These routes support the Phase 9 frontend implementation with
proper SSR rendering for improved performance and accessibility.
2026-02-01 00:27:01 -05:00
john-okeefe 6266a06abb feat: Add SSR for conflicts and queue pages
- Update conflicts.templ to accept pre-rendered data
- Update queue.templ to accept pre-rendered data
- Update /conflicts and /queue routes in main.go for SSR
- Update stats rendering to use server-side values
- Add server-side conflict list rendering
- Add server-side queue list rendering
- Update conflicts.js to use location.reload() after operations
- Update queue.js to use location.reload() after operations
- Remove initial load calls from JavaScript files

Preserves all API endpoints and backward compatibility
2026-01-31 23:14:08 -05:00
john-okeefe 5a7144b98e feat: add device management and queue management routes
- Add /devices route for device management interface
- Add /conflicts route for sync conflict resolution
- Add /queue route for sync queue management
- Add comprehensive tests for device cap management
- Add test suite for queue management
2026-01-31 18:25:28 -05:00
john-okeefe a7f2b83bdd Integrate sync queue system and device cap API
- Start queue processor as background goroutine
- Initialize and register queue handler
- Add queue management routes (7 endpoints)
- Update KOReader handler to use checkpoint sync mode
- Add device cap management route (PUT /api/auth/users/:id/max-devices)
- Register all new endpoints with proper middleware
2026-01-31 13:06:56 -05:00
john-okeefe 8d55b7c5b5 Add comprehensive test suite for device cap management
- Test successful updates (5, 10, 50, 100 devices)
- Test validation failures (0, -1, 101, 1000 devices)
- Test authentication requirements (no token, non-admin)
- Test non-existent user ID
- Test missing user ID in URL
- Test max_devices field in user list response
- Add 20+ test cases across 7 test functions
- Helper functions for admin user creation and login
2026-01-31 13:06:42 -05:00
john-okeefe 5bb273f6aa Improve Phase 1 integration test robustness
Update test credentials and add better error handling for user registration and login scenarios to prevent test failures from incomplete test runs.
2026-01-31 11:45:56 -05:00
john-okeefe 2d2d643873 Add sync conflict detection and resolution system
Implement conflict detection for concurrent reading progress updates from different devices. Adds conflict management endpoints for listing, viewing, and resolving conflicts.

- Add ConflictHandler with CRUD endpoints for conflict management
- Implement automatic conflict detection in KOReader progress updates
- Add WebSocket broadcast for real-time conflict notifications
- Add database query for listing user conflicts by status
- Add integration tests and Bruno API test collection
2026-01-31 11:45:52 -05:00
john-okeefe 9b41b3ecb0 Add refresh token flow integration test
- Test login returns both access_token and refresh_token
- Test refresh endpoint accepts UUID token and returns new access_token
- Verifies end-to-end refresh token flow works correctly
2026-01-31 11:44:47 -05:00
john-okeefe 42c3168fcf feat: add server sync to Kobo endpoint and media routes 2026-01-31 00:29:39 -05:00
john-okeefe a3aa9f67ac feat: add Kobo device sync support and fix device route protection
- Add Kobo sync handler with markup, bookmark, analytics, and initialization endpoints
- Add Kobo integration tests and Bruno API test collection
- Move device approve/reject routes from public to protected routes
- Enhance test infrastructure with DATABASE_URL support and helper functions
- Fix device GetDevice handler nil pointer handling
- Clean up test reports and session files
2026-01-30 23:58:34 -05:00
john-okeefe 77d683277a test: add WebSocket integration tests
Add comprehensive WebSocket test coverage:
- TestWebSocketConnection: Basic connection and JWT auth
- TestWebSocketDeviceAuth: Device token authentication
- TestWebSocketProgressBroadcast: Real-time update delivery
- TestWebSocketPingPong: Heartbeat mechanism
- TestWebSocketConnectionLimit: Multiple concurrent connections
- TestWebSocketInvalidToken: Rejection of invalid tokens
- Helper function for test media item creation

Update test helpers to create ConnectionManager for tests.
Tests verify WebSocket connection, authentication, and
real-time progress broadcast functionality.
2026-01-30 21:48:30 -05:00
john-okeefe d77585a6f5 feat: add WebSocket endpoint and ConnectionManager setup
Add WebSocket infrastructure to main server:
- Import sync package for ConnectionManager
- Create and start ConnectionManager with cleanup task
- Initialize WSHandler with auth dependencies
- Add /ws/sync WebSocket endpoint
- Update handler initialization to pass ConnectionManager

The WebSocket endpoint at /ws/sync enables real-time progress
updates across all connected clients (web, mobile, devices).
2026-01-30 21:48:21 -05:00
john-okeefe f8a6c3d227 Phase 3 Week 7: Add KOReader routes, tests, and documentation
- Add KOReader sync endpoints to main application router
- Create Bruno API collection for testing KOReader endpoints
- Add integration tests for KOReader functionality
- Include comprehensive README with setup instructions
- Test coverage for progress, metadata, library, and bookmarks sync
- Part of Phase 3 KOReader Integration implementation
2026-01-30 20:55:20 -05:00
john-okeefe a9fdd44471 Add library-based scanning and media item endpoints
- Add POST /api/libraries/:id/scan endpoint for admin library scanning
- Add GET /api/libraries/:id/media-items endpoint for library media items
- Move /api/libraries/types to public endpoint (no auth required)
- Update ScanEbooks handler to support library_id parameter
2026-01-30 20:16:22 -05:00
john-okeefe 95fe849eeb Fix test infrastructure and device UUID handling
- Remove manual device ID generation, use database-generated IDs
- Add comprehensive test helpers (setupTestServer, loginTestUser, getTestUserID)
- Add cleanup step for existing test users in integration tests
- Fix UUID parsing from database responses
2026-01-30 20:16:19 -05:00
john-okeefe 9d32e5a0f0 Add comprehensive integration tests for Phase 2 device management
Test Files Added:
- integration_test.sh: Automated integration test script
  * Tests full user flow: register, login, library creation, scanning
  * Tests device registration and management
  * Color-coded output with pass/fail tracking
  * Generates detailed test results report

- cmd/server/tests/device_test.go: Unit tests for device endpoints
  * TestDeviceRegistrationFlow: Full registration flow test
  * TestListDevices: Device listing functionality
  * TestUpdateDevice: Device settings updates
  * TestDeleteDevice: Device removal
  * TestDeviceAuthentication: Device auth middleware test

- cmd/server/tests/phase1_integration_test.go: Phase 1 integration tests
  * Tests universal progress tracking
  * Tests format group detection
  * Tests progress conversion

Test Coverage:
- Device registration with web-based approval flow
- Device management (list, update, delete)
- Device authentication and token validation
- User authentication and authorization
- Library creation and management
- Scanner integration
- Media items listing

Notes:
- Tests designed to run against live server on localhost:8765
- Integration test script uses bash/curl for endpoint testing
- Device tests require helper functions to be implemented
2026-01-30 16:57:01 -05:00
john-okeefe 23ad70158c Phase 2 Week 5: Device Registration & Management
Implement device registration and management system for universal sync.

Database Changes:
- Add device queries to queries.sql (CRUD operations, registration, auth)
- Add sync queue management queries
- Add conflict resolution queries
- Regenerate sqlc models with new device-related types

Device Handler (devices.go):
- InitiateRegistration: Start device registration with auth URL and QR code
- CheckRegistrationStatus: Poll for registration approval
- ListDevices: Get all devices for current user
- GetDevice: Get specific device details
- UpdateDevice: Update device settings (name, sync settings, frequency)
- DeleteDevice: Remove device from account
- ApproveDevice: User approves device registration via web
- RejectDevice: Reject pending device registration
- ListPendingRegistrations: Show all pending registrations
- generateDeviceToken: Generate secure Bearer token for devices

Device Authentication Middleware (device_auth.go):
- Authenticate: Validate device Bearer tokens
- RequirePermission: Check device permissions by type
- hasPermission: Define permissions per device type
- UpdateLastSeen: Auto-update device last_seen timestamp

Configuration:
- Add BaseURL field to Config for device setup URLs

API Endpoints:
POST /api/devices/register - Initiate device registration
POST /api/devices/register/status - Check registration status
GET /api/devices/approve/:id - Approve device (web UI)
POST /api/devices/reject/:id - Reject device
GET /api/devices - List user's devices
GET /api/devices/:id - Get device details
PUT /api/devices/:id - Update device settings
DELETE /api/devices/:id - Delete device
GET /api/devices/pending - List pending registrations

Bruno API Collection:
- Initiate Device Registration
- Check Registration Status
- List Devices
- Get Device
- Update Device
- Delete Device

Dependencies:
- github.com/skip2/go-qrcode for QR code generation

Device Types Supported:
- koreader: Calibre-compatible sync
- kobo: Kobo sync protocol
- web: Web interface
- mobile: Mobile apps

Device Permissions:
- sync:progress
- sync:annotations
- sync:metadata
- device:manage (web only)
2026-01-30 16:45:10 -05:00
john-okeefe 07abcabaa8 refactor: clean up tests and templates for media-items system
- Remove ebook-specific test files (ebook_test.go, integration_test.go, notes_highlights_test.go)
- Update search_test.go for media-items API paths
- Regenerate templates (bookshelf_templ.go, header_templ.go)
- Add ISBN normalization utility function
- Clean up test suite to focus on media-items functionality

Aligns tests and templates with unified media-items architecture
2026-01-30 13:52:11 -05:00
john-okeefe 758c5874eb test: rename Ebooks group to MediaItems and update API paths
Major changes:
- Rename testEbooks() function to testMediaItems()
- Remove all old ebook test cases
- Update all /api/ebooks paths to /api/media-items
- Update TestContext: remove EbookID, add MediaItemID field
- Add admin media-items tests (Create, Update, Delete)
- Fix compilation errors and missing imports

Tests updated to use new API structure while maintaining test coverage.

Breaking change: /api/ebooks endpoints removed (use /api/media-items instead)
2026-01-30 10:22:07 -05:00
john-okeefe f5a01ece46 Add tests for sorting and filtering functionality
- Add integration tests for sorting (sorting_test.go)
  - Test sort by title, author, page_count, copyright_year, genre
  - Test pagination with sorting
  - Test invalid sort parameter defaults
  - Cover no user, user, and admin contexts
- Add integration tests for filtering (filtering_test.go)
  - Test filter by genre, language, year range, has_cover
  - Test combining multiple filters
  - Test filtering with pagination and sorting
  - Cover no user, user, and admin contexts
- Add Bruno API test for sorting
- Add Bruno API test for filtering
2026-01-30 08:33:03 -05:00
john-okeefe ea7abd7476 test: improve integration test error reporting for library creation
- Add explicit status code check (require.Equal 201)
- Remove conditional success/failure branching
- Provide clear error message with actual vs expected status

Now if CreateLibrary returns 500, test will clearly show:
"Failed to create library: expected 201, got 500"

Instead of vague "Library ID is empty" message that hid the 500 error.
2026-01-29 21:16:35 -05:00
john-okeefe cec0b17bde test: add search tests and Bruno API collection
- Add comprehensive search integration tests (search_test.go)
- Test no user, user, and admin contexts
- Test partial matching, fuzzy fallback, special characters
- Add Bruno API test for search endpoint
- Fix missing closing parenthesis in test structure
2026-01-29 20:21:01 -05:00
john-okeefe 183a0b795c Fix /bookshelf route - add direct route with JWT authentication
- Added direct /bookshelf route that works with both Authorization header and cookie token
- Imported missing strings package
- Users can now access /bookshelf directly instead of /api/bookshelf
2026-01-29 16:46:57 -05:00
john-okeefe d9ca3d5a65 feat: add /bookshelf route and update redirects
- Add /bookshelf route as default page for logged-in users
- Update login and register handlers to redirect to /bookshelf
- Update homepage to auto-redirect to /bookshelf when logged in
- Preserve /dashboard route for backward compatibility
- Update test redirects to use /bookshelf

Changes:
- main.go: Add /bookshelf protected route
- auth.go: Change login/register redirects from /api/dashboard to /bookshelf (2 locations)
- edge_cases_test.go: Update test redirect to /bookshelf
- Maintains backward compatibility with existing /dashboard route

This makes the beautiful bookshelf the default landing page
for all authenticated users while keeping the old dashboard accessible.
2026-01-29 15:52:11 -05:00
john-okeefe 399485d53d fix: handle existing user in integration test setup
- Add fallback to login when user registration returns 409 Conflict
- Prevents empty user token error when test user already exists
- Allows integration tests to run reliably across multiple executions
- Test now attempts to log in with existing credentials if registration fails

This fixes the issue where the test would fail if the user
'integrationuser@test.com' already existed from a previous test run.
2026-01-29 15:51:18 -05:00
john-okeefe 8f739af285 fix: correct UUID format string issues in logging and tests
- Fix scheduler.go log.Printf calls to convert pgtype.UUID to string before formatting
- Fix ebook.go fmt.Printf calls to convert pgtype.UUID to string before formatting
- Add missing Enabled field to rate limiter config in security test
- Prevents format string errors when logging library IDs

This resolves compilation errors where pgtype.UUID was being formatted
with %s which expects a string, not a UUID struct.
2026-01-29 15:51:05 -05:00
john-okeefe 16cb9bd89a refactor: remove old frontend directory structure
- Remove cmd/server/static/ (moved to web/)
- Remove tailwind.config.js (converted to .ts)
- Clean up obsolete files after reorganization
2026-01-29 14:09:23 -05:00
john-okeefe 4dab173b16 fix: serve static files from web directory
- Update static file serving from 'static' to 'web/static'
- Maintains /static/ URL path for backwards compatibility
- Frontend assets now properly separated from backend code
2026-01-29 14:08:59 -05:00
john-okeefe 8126002eb9 test: improve integration test isolation and error handling
- Fix SetLibraryVisibility request format (library_ids -> library_id)
- Fix UpdateReadingProgress HTTP method (POST -> PUT)
- Fix DeleteMediaNote expected status (200 -> 204)
- Add cleanupTestData() helper for better test cleanup
- Improve Setup_CreateDuplicateTestUsers to handle existing data
- Add graceful handling of 409 and 429 responses
- Update password test to create/delete temporary user
- Add test requirements comment at top of file

These changes improve test reliability and reduce flakiness.
2026-01-29 13:33:26 -05:00
john-okeefe 4b8cb58c84 feat: add configurable test mode and rate limiting
- Add TestMode, RateLimitEnabled, RequestsPerMinute to Config
- Add getEnvBool() and getEnvInt() helper functions
- Update rate limiter to support enabled/disabled state
- Pass test environment variables through docker-compose
- Configure rate limiter dynamically in main.go

This allows disabling rate limiting for integration testing while
maintaining security in production environments.
2026-01-29 13:33:18 -05:00
john-okeefe c5c2700311 test(server): add integration tests 2026-01-29 12:08:28 -05:00
john-okeefe 66f1eb11a0 feat(ebooks): add ISBN normalization and graceful library requirement handling
- Increase ISBN column from VARCHAR(13) to VARCHAR(17) to support ISBN-13 with hyphens
- Add normalize_isbn() database function to automatically remove hyphens and spaces
- Create trigger to auto-normalize ISBNs on INSERT/UPDATE operations
- Update all Ebook and MediaItem queries to use ISBN normalization
- Add GetEbookLibraryID query to check for existing ebook libraries
- Add graceful error handling when no ebook library exists
- Return helpful error message: 'no ebook library found. Please create an ebook library first'
- Create comprehensive tests for ISBN normalization and library selection
- Add Bruno test files for various ISBN formats and error scenarios
- Update documentation with ISBN normalization details
2026-01-29 10:52:14 -05:00