Commit Graph

18 Commits

Author SHA1 Message Date
Leo 4988fdaa21 Markets category replaces Kiosk in seed data
- Updated seed categories: Kiosk → Markets
2026-05-31 01:09:44 -04:00
Leo ae6685a401 feat: add Coffee () category to seed data 2026-05-31 00:52:31 -04:00
Leo fb2db1e76a Add Kiosk category to seed data, clean .gitignore
- Kiosk (🏪) added to fresh-install seed data in admin_server.py
- .gitignore now excludes .venv/, *.db, *.xlsx, admin.db
2026-05-31 00:40:22 -04:00
shawn d58834bc56 feat: category icons sync + unknown type dashboard widget
- Synced categories table: added Equipment/Appliances with icons,
  removed unused Furniture/Utensils & Serveware
- Updated seed data to match real asset categories
- Added category_health query to /api/stats (finds asset categories
  not in the categories lookup table)
- Added Category Health card to dashboard UI (red warning, shown
  only when unmapped categories exist)
2026-05-31 00:28:07 -04:00
shawn 750cde68c9 feat: multi-role support — same as prod 2026-05-25 23:10:53 -04:00
Leo f8fad7ac14 feat(cantaloupe_sync): add dex_report_date, deployed, pulled_date column handling
- Add heuristic entries: dex_report_date, deployed, pulled_date
- Include in COMPARE_FIELDS for diff detection
- Add to approve_batch() UPDATE field_map and INSERT statement
- Add v4 DB migration for three new TEXT columns
- Datetime serialization already handled by parse_excel()

Kanban: t_3bef3c9c
2026-05-23 17:30:09 -04:00
Leo 4070214fe7 v5 migration: add dex_report_date and install_date columns to assets table 2026-05-23 17:26:13 -04:00
Leo 8d5deb735b Fix route ordering: /search before /{asset_id}
- /api/assets/search must be registered before /api/assets/{asset_id}
  to prevent FastAPI path param from catching 'search' as an asset_id.
  Returning a 422 with array detail caused frontend to show [object Object].
- Improve error message extraction in clearAssetGps catch block.
2026-05-22 23:45:26 -04:00
Leo 9794d8076c Add clear asset GPS endpoint + UI
- DELETE /api/assets/{id}/gps: clears lat/lng to NULL
- GET /api/assets/{id}: asset lookup by ID
- GET /api/assets/search?machine_id=: asset lookup by machine ID
- Export & Admin page: Clear Asset GPS card with lookup + confirmation
- Tests: 204 success + 404 not found
2026-05-22 23:36:40 -04:00
Leo ae20c0507f fix: dynamic VALID_CATEGORIES from DB categories table
Same issue as canteen-asset-tracker — hardcoded category set was
{Furniture, Appliances, Utensils, Equipment, Other}, missing all
vending-machine categories (Bev, Snack, GF Bev, GF Food, etc.).

- admin_server.py: _load_categories() from DB at startup
- cantaloupe_sync.py: reads from categories table instead of
  hardcoded set (was silently downgrading GF Bev→Other on sync!)
2026-05-22 19:46:36 -04:00
Leo 301c3d5fb1 Add missing /api/auth/me endpoint to admin server
The /api/auth/me endpoint was never added after the admin server was
split from the main server. Without it, auth tokens couldn't be validated
against the admin server — the SPA catch-all would serve the frontend instead.
2026-05-22 15:17:05 -04:00
Leo 6056f3078d Fix admin seed: use INSERT OR IGNORE so admin/changeme user is always ensured, not just on empty DB 2026-05-22 15:08:44 -04:00
Leo cb71bcaaef Fix: move SPA catch-all route to end so API routes match first
The catch-all @app.get('/{full_path:path}') was defined before API routes,
causing GET requests for /api/* endpoints to be intercepted and served
the admin SPA index.html instead of the actual API response. Moving
the catch-all to after all API routes ensures proper route resolution.
2026-05-22 15:02:00 -04:00
Leo 08c77669b2 Session expiry: tokens expire after 1 day (auth consistency) 2026-05-21 22:53:25 -04:00
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 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 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