Commit Graph

8 Commits

Author SHA1 Message Date
Leo 070e8c2ddb Add Cantaloupe Sync admin UI page
- New 'Cantaloupe Sync' nav item in sidebar with sync icon
- Section 1: Sync Overview showing latest batch status, diff badges
- Section 2: Pending Batch Review with approve/reject buttons and diff detail
- Section 3: Import History with expandable rows for full diff view
- Added static file serving (FileResponse) to admin_server.py
- Fixed formatDate to handle space-separated SQLite datetimes
- Dark theme matching existing admin UI, vanilla JS with fetch()
2026-05-21 19:38:36 -04:00
Leo e9d18cb8b7 fix: cantaloupe export subprocess cwd points to cantaloupe-downloader project
The subprocess.run for cantaloupe export was using cwd=admin_server_dir,
which meant 'python -m cantaloupe' couldn't find the local cantaloupe module.
Changed cwd to ~/projects/cantaloupe-downloader where the module lives.

Also added scripts/cantaloupe-sync.sh — the 6h cron job wrapper script.
2026-05-21 19:32:44 -04:00
Leo f7ffa0e6cc cantaloupe_sync: fix column mapping heuristic, add comprehensive tests
- Fix greedy matching where 'name' keyword matched 'Location Name' header
- Use word-subset matching instead of substring matching
- Normalize keywords (replace _ and # with spaces) to match header normalization
- Reorder heuristics: multi-word specific patterns before single-word generics
- Add 10 unit tests for mapping, diff, and Excel parsing
- Add 23 integration tests for all sync API endpoints
- All 33 tests pass
2026-05-21 19:16:53 -04:00
Leo d2c76aea7f feat: Add Cantaloupe sync API with staged import workflow
- New cantaloupe_sync.py module with complete pipeline
- Heuristic Excel column mapping (20+ keyword patterns)
- Diff engine: detects new/changed/removed/unchanged assets
- 5 API endpoints: sync, list batches, view batch, approve, reject
- cantaloupe_sync_batches table with status workflow
- Admin server port changed to 8090
- openpyxl added to requirements.txt
2026-05-21 19:00:19 -04:00
Leo 377b3868cb fix: move admin server to port 8090 (avoids webhook receiver on 8900), set CANTEEN_DB_PATH to shared assets.db 2026-05-21 18:56:10 -04:00
Leo 19bdbf0ec3 t_6549bb2b: Align SPA with admin server API (reset endpoint, initAuth, remove SQL query) 2026-05-21 17:19:39 -04:00
Leo d1c7853877 Initial commit: Admin API server extracted from canteen-asset-tracker 2026-05-21 17:19:14 -04:00
shawn c4e45c2569 t_6549bb2b: Create admin frontend SPA with full CRUD, dashboard, activity, export 2026-05-21 17:18:36 -04:00