Commit Graph

22 Commits

Author SHA1 Message Date
clawd 6268356c9d fix: Correct relative path to exercises.json from exerciseRecommendations.js 2026-03-06 12:19:24 +01:00
clawd 80654de67b fix: Include exercises.json in src/data for Docker build context 2026-03-06 12:18:15 +01:00
clawd 5af6d5c6e5 fix: Include exercises.json in Docker context for backend 2026-03-06 12:17:41 +01:00
clawd e09017d2e0 feat(08-01): Health monitoring & logging infrastructure
- Set up Winston structured logging with console and file outputs
- Create GET /api/health endpoint with uptime, database status, response times
- Add request logging middleware (method, path, statusCode, duration)
- Create health monitoring module with database connectivity checks
- Log all HTTP requests with timing information
- Log auth events (login, register) and data modifications
- Replace console.log/error with structured logger calls
- Update backend README with logging configuration documentation
- Add tests for health endpoint and logging middleware
- Logs directory: logs/combined.log and logs/error.log

Deliverables met:
✓ Structured logging (Winston) integrated
✓ Enhanced health endpoint with uptime & database info
✓ Request logging middleware attached to all routes
✓ Comprehensive logging documentation in README.md
✓ Tests passing for health and logging functionality
✓ All critical operations logged with context
2026-03-03 21:28:46 +01:00
clawd 1104f6360e chore(07-03): Stage deployment scripts and documentation updates 2026-03-03 19:24:29 +01:00
clawd fa766b21f7 docs(07-03): Deployment testing plan and documentation 2026-03-03 18:23:19 +01:00
clawd 53f4df6e3c feat(07-02): Add CI/CD deployment scripts
- scripts/deploy.sh: Full deploy flow with fresh builds (--no-cache)
- scripts/build-check.sh: Pre-flight staleness check
- Docker labels for build tracking (git commit + timestamp)
- Prevents stale container bug from recurring
2026-03-03 17:20:23 +01:00
clawd fbba2d894d feat(06-01): Exercise recommendations API endpoint + frontend components (coach-assisted suggestions) 2026-03-03 03:54:12 +01:00
clawd f580fa81a6 feat(05-03): Implement API fallback handling for research display
- Enhanced exaSearch service with Exa API + fallback tier system
  * Tier 1: Exa API (primary)
  * Tier 2: Synthetic results with suggested web sources
  * Improved error handling with graceful degradation

- Updated backend exerciseResearch route to return provider info
  * Returns 'provider' field identifying which API was used
  * Returns 'status' field (success/degraded) for UI feedback
  * Better error messages for debugging

- Enhanced ResearchDisplay component with fallback feedback
  * New ResearchProviderBadge shows which provider was used
  * Visual indicators for fallback results (Suggested badge)
  * Support for multiple provider types (exa, fallback, gemini, etc.)
  * Improved error handling and recovery flows

- Updated ExerciseResearchPanel with better error handling
  * Proper response parsing from backend
  * Forwards provider and status info to display component
  * Improved accessibility with tooltip hints

- Added comprehensive Research Display styling
  * Responsive layout for mobile and desktop
  * Visual hierarchy for summaries and sources
  * Provider badge styling with color-coding
  * Fallback state indicators for user awareness
2026-03-02 23:45:07 +01:00
clawd ab87e54630 feat(05-03): Integrate AI fallback system into research search (Exa → Ollama/Gemini/OpenRouter/OpenCode) 2026-03-02 23:44:03 +01:00
clawd 210a2d15a9 config: switch to Ollama-first strategy (local AI priority)
Changed API fallback chain:
- Tier 1: Ollama (local, free, always available)
- Tier 2: Gemini (free tier with quota limits)
- Tier 3: OpenRouter (cheap, flexible fallback)
- Tier 4: OpenCode (final backup)

This saves costs by using local Ollama for most tasks.
OpenRouter only used when Ollama unavailable.
2026-03-02 19:48:41 +01:00
clawd 2f6392a807 config: reorder API fallbacks - Gemini → OpenRouter → OpenCode
Changed priority:
- Tier 1: Gemini (primary, free but quota-limited)
- Tier 2: OpenRouter (secondary, cheaper & more flexible)
- Tier 3: OpenCode (tertiary, final fallback)

OpenRouter is better: supports multiple models, cheaper per-token,
intelligent routing. Moved to primary fallback position.
2026-03-02 19:43:55 +01:00
clawd 2bc4c947ae config: upgrade to 3-tier fallback system (Gemini → OpenCode → OpenRouter)
Added OpenRouter as tertiary fallback:
- Primary: Gemini (free tier, quota-limited)
- Secondary: OpenCode (fallback if Gemini quota exceeded)
- Tertiary: OpenRouter (final fallback, supports multiple models)

gemini-fallback.js now tries all three in sequence with proper error handling.
2026-03-02 19:39:33 +01:00
clawd 0c37d6ea91 config: add OpenCode API fallback for Gemini quota
- Configured OpenCode as fallback when Gemini quota exceeded
- Created gemini-fallback.js utility (tries Gemini → OpenCode)
- API keys stored in .env (excluded from git)
- PM unblocked: can resume 05-03 with fallback system

Flow: Gemini (primary) → OpenCode (fallback) → fail gracefully
2026-03-02 19:38:25 +01:00
clawd 53f026aee2 feat(05-02): exa-search research integration 2026-03-02 14:10:32 +01:00
clawd 994cc9e984 feat(05-01): Exercise database schema + CRUD API 2026-03-02 13:03:30 +01:00
clawd 994f406050 fix: make backend listen on 0.0.0.0 instead of localhost
This allows Traefik and other containers on the docker network to reach the backend API.
2026-03-02 09:25:10 +01:00
clawd 4bd2c9607d feat(phase-4): Backend API for custom workouts
- Add custom_workouts and custom_workout_exercises tables (schema)
- New endpoints:
  - GET /api/exercises - List all exercises for picker
  - POST /api/custom-workouts - Fork program workout
  - GET /api/custom-workouts - List user's custom workouts
  - GET /api/custom-workouts/:id - Get workout with exercises
  - PUT /api/custom-workouts/:id - Update workout exercises
  - DELETE /api/custom-workouts/:id - Delete custom workout
- Updated endpoints for source_type support:
  - GET /api/logs - Filter by source_type and custom_workout_id
  - POST /api/logs - Save with source_type and custom_workout_id
  - DELETE /api/logs - Support custom workout log deletion
- Adds Phase 4 planning overview

Completes: 04-01-schema-migration, 04-02-backend-api
Next: 04-03-frontend-workout-edit
2026-03-02 09:25:10 +01:00
clawd 04bab32e26 design: WorkoutPage Hevy-style redesign + AlternativeModal + backend API
- Add GET /api/exercises/:id/alternatives endpoint
- Add GET /api/exercises/:id/last-workout endpoint
- New AlternativeModal component for swapping exercises
- WorkoutPage: single-tap logging, +/- buttons, rest timer
- Updated Icons with new workout icons
- Polish: card shadows, borders, micro-interactions
- Tasks directory for project management
2026-02-28 21:25:23 +01:00
clawd 889eb50070 feat(02-02): add DELETE /api/logs endpoint to backend
- DELETE /api/logs accepts user_id, program_exercise_id, date, set_number in request body
- Deletes matching workout_logs row by composite key
- Returns 200 + deleted id on success, 404 if row not found
- Consistent with existing POST /api/logs (no auth middleware, user_id from body)
2026-02-21 18:44:18 +01:00
clawd 14f39e178a Refactor: separera user_measurements och user_strength tabeller
- Ny databasstruktur för historik/progress tracking
- Nya endpoints: POST/GET measurements och strength
- Onboarding sparar till rätt tabeller
- Beräknar och sparar body_fat_pct
- Fixar tomma numeriska fält (null istället för '')
- Döljer 1RM för nybörjare
2026-02-01 00:10:48 +01:00
clawd 13ade5e903 Initial commit: Gravl MVP med onboarding 2026-01-31 23:33:20 +01:00