16 Commits
Author SHA1 Message Date
john-okeefe 6b518462f9 test: update Bruno API collection with new test data values
Update test environment and request files to use different test data:
- Update job_id variable to new test job UUID
- Change search test queries from Foundation/Asimov to 1984/Orwell
- Change series search from Foundation to Haley
- Add force parameter to scanner test

These updates provide fresh test data for API testing and
demonstrate search functionality with different media items.
2026-03-26 15:35:25 -04:00
john-okeefe d802236874 scanner: fix library isolation, file mtime, force rescan, and deletion handling
Fix 1 - File modification time for created_at:
- Get file.ModTime() in processMediaFile and pass to CreateMediaItem
- Modified SQL INSERT to include created_at column

Fix 2 - Force rescan UPDATE instead of DELETE+INSERT:
- Changed force rescan logic to call updateMediaItem instead of delete + create
- Preserves created_at timestamp on force rescan

Fix 3 - GetMediaItemByFilePath filters by library_id:
- Added library_id to WHERE clause in SQL query
- Created GetMediaItemByFilePathAnyLibrary for cross-library lookups (KOReader)
- Added SetLibraryID method to MediaScanner
- Updated handler to call SetLibraryID for watch mode

Fix 4 - File deletion handling with persistent logging:
- Added fsnotify.Remove handler in WatchChanges
- Added orphan cleanup in ScanFolders after scan completes
- Created scanner_logger.go with daily log rotation (7 days)
- Logs to /app/logs/scanner-deletes-YYYY-MM-DD.log and scanner-errors-YYYY-MM-DD.log
- Individual deletes with enhanced safety logging

Note: Integration tests can now safely scan /app/uploads because
GetMediaItemByFilePath now filters by library_id, preventing
cross-library interference.
2026-02-26 16:39:42 -05:00
john-okeefe b4421b0500 fix(bruno): correct JSON syntax in Scan Media Items request
Fix critical bug where library_id variable was not quoted in the request
body, causing invalid JSON that was rejected by the API parser.

Changes:
- Quote library_id variable: {{library_id}} → "{{library_id}}"
- Add explicit Content-Type header
- Update request body format to use proper YAML multi-line string

Root Cause:
- Unquoted UUID in JSON: {"library_id": 551ac19c-896a-...}
- Produced invalid JSON that failed c.Bind() in scanner handler
- Handler returned 400 "invalid request" error

Impact:
- Bruno requests for scanning now work correctly
- API scan endpoint accepts request successfully
- Enables proper testing of scan functionality via Bruno

Testing:
- Verified scan request completes successfully
- Job ID returned correctly
- Scanner processes files as expected

File: bruno/scanner/Scan Media Items.yml
2026-02-24 21:33:16 -05:00
john-okeefe f859b2714d refactor(bruno): reorganize file structure from bruno-yaml to flat bruno directory
- Move all files from bruno-yaml/* to bruno/*
- Maintains existing directory structure within categories
- Updates bruno/user/auth files with OAuth2 refresh token flow
- Updates bruno/user/profile files for user profile management
- Adds bruno/dashboard/ directory with dashboard API tests
- Preserves all existing test scenarios and OpenCollection YAML format
- No functional changes - file reorganization only
2026-02-17 20:22:21 -05:00
john-okeefe 96730d9475 docs: add Carousel dashboard implementation plan 2026-02-17 17:00:46 -05:00
john-okeefe 2d39b44f1f docs(bruno): update API test files for media terminology
- Rename ebook_id environment variable to media_item_id
- Update scanner endpoint example paths and documentation
- Update library endpoint documentation
- Keep library type 'ebooks' where appropriate (valid type value)
2026-02-08 14:33:28 -05:00
john-okeefe ba31e1491e refactor: update Bruno API collection for media-items system
- Remove all ebook-specific API requests (15 files deleted)
- Rename Scan Ebooks.bru to Scan Media Items.bru
- Update API paths from /api/ebooks to /api/media-items
- Update base URL and environment configuration
- Maintain all existing media-items, library, auth, and progress tests

Aligns Bruno collection with unified media-items API architecture
2026-01-30 13:52:06 -05:00
john-okeefe fc61b6de6e docs(scanner): update Bruno requests for new scanner endpoints
- Update Scan Ebooks.bru to reflect async background scanning
- Add Get Scan Status.bru for checking job progress
- Add Start Watch Mode.bru for instant file monitoring
- Add Stop Watch Mode.bru for stopping library monitoring
- Add Get Watch Mode Status.bru for checking watched libraries
- Document all new endpoints with examples and status codes
2026-01-29 09:50:46 -05:00
john-okeefe 8db5939892 refactor: standardize Bruno API requests with bruToJsonV2 format
- Convert all JSON tests to JavaScript functions for bruToJsonV2 compatibility
- Update authentication to use 'inherit' instead of manual headers
- Fix hardcoded URLs to use {{base_url}} variables
- Standardize variable syntax from {{ _.var }} to {{var}}
- Add comprehensive API documentation to all requests
- Update environment variables with missing required fields
- Apply consistent structure: meta, http method, headers, tests, vars, settings, docs
- Enhanced validation with proper error handling and field checks
2026-01-28 20:13:56 -05:00
john-okeefe ad64c044a7 fix: Remove hardcoded example from Scan Ebooks Bruno request
- Remove hardcoded folder_paths example from request body
- Allow flexible folder path configuration per request
- Improve request flexibility for different scan scenarios
2026-01-27 16:25:01 -05:00
john-okeefe 9262a35f68 feat: Restore manual scanner requests for testing
- Recreate Scan Ebooks request with optional folder_paths parameter
- Recreate Start Scanner request for real-time monitoring
- Recreate Stop Scanner request for monitoring control
- All scanner requests remain admin-only as intended
- Essential for testing ebook discovery and scanning functionality
2026-01-26 21:21:43 -05:00
john-okeefe f2994f9147 refactor: Reorganize Bruno requests by role permissions
- Create separate admin folder for admin-only operations
- Move admin endpoints (Create/Update/Delete Ebook, Scanner, Folder Management) to /bruno/admin/
- Add admin dashboard, profile, and library page requests
- Add Register Admin User request with explicit admin role
- Update Register User request to include role field
- Remove empty scanner folder structure

API organization:
- Admin requests: /bruno/admin/ (require admin role)
- User requests: /bruno/user/ (available to all authenticated users)
- Environment: Single {{token}} variable works for both roles
2026-01-26 21:19:19 -05:00
john-okeefe 48b6796bcd docs: Update documentation for role-based access control
- Update README.md with admin system documentation
- Add admin setup instructions and role permissions
- Update API endpoint documentation with access requirements
- Update Bruno collection to reflect admin-only operations
- Document shared library concept and security model
- Add comprehensive admin setup guide
2026-01-26 16:56:35 -05:00
john-okeefe 64afdf6803 Clean up Bruno scanner documentation formatting
- Remove example request body template
- Improve documentation spacing and formatting
- Clarify API endpoint usage and response structure
2026-01-26 11:29:40 -05:00
john-okeefe 08e80ae84b refactor: reorganize project structure and update configurations
- Move migrations/ to database/schema/ for clarity on database schema definitions
- Move sqlc.yaml to internal/database/ to group with database code
- Move static/ to cmd/server/static/ to co-locate with server
- Update all configuration files and documentation
- Follow Go project conventions for better organization
2026-01-24 23:40:31 -05:00
john-okeefe 6c33ee4364 feat: add Bruno API testing files for multiple folder functionality
- Add auth/Add Ebook Folder.bru - test adding folders to user account
- Add auth/Get Ebook Folders.bru - test listing user's folders
- Add auth/Delete Ebook Folder.bru - test removing folders
- Add scanner/Scan Ebooks.bru - test manual scanning of multiple folders
- Add scanner/Start Scanner.bru - test starting folder monitoring
- Add scanner/Stop Scanner.bru - test stopping folder monitoring
- Update all scanner endpoints to use folder_paths array format
2026-01-23 09:03:15 -05:00