From dc4fe558b7fba073538b2902f8aebee3d068c631 Mon Sep 17 00:00:00 2001 From: Blake Ridgway Date: Sun, 17 May 2026 20:39:47 -0500 Subject: [PATCH] lots of stuff, don't truly remember --- TODO.md | 155 +++++-- cmd/server/main.go | 58 ++- internal/ai/handler.go | 133 ++++++ internal/ai/model.go | 170 ++++++++ internal/ai/prompt.go | 214 ++++++++++ internal/ai/repository.go | 66 +++ internal/ai/service.go | 478 ++++++++++++++++++++++ internal/ai/validator.go | 156 +++++++ internal/auth/handler.go | 90 +++- internal/config/jwt.go | 13 +- internal/email/service.go | 10 +- internal/event/handler.go | 194 +++++++++ internal/event/model.go | 18 + internal/event/repository.go | 65 +++ internal/event/service.go | 105 +++++ internal/export/fit_encoder.go | 62 ++- internal/goal/handler.go | 210 ++++++++++ internal/goal/model.go | 42 ++ internal/goal/repository.go | 49 +++ internal/integration/intervals_client.go | 308 ++++++++++++++ internal/integration/intervals_handler.go | 167 ++++++++ internal/middleware/auth.go | 31 +- internal/nutrition/handler.go | 63 +++ internal/nutrition/service.go | 290 +++++++++++++ internal/stats/handler.go | 67 +++ internal/stats/repository.go | 74 ++++ internal/stats/service.go | 38 ++ internal/user/handler.go | 44 +- internal/user/model.go | 11 +- internal/user/repository.go | 2 - internal/user/service.go | 23 +- internal/workout/handler.go | 115 +++++- internal/workout/model.go | 39 +- internal/workout/repository.go | 40 +- internal/workout/service.go | 13 +- 35 files changed, 3501 insertions(+), 112 deletions(-) create mode 100644 internal/ai/handler.go create mode 100644 internal/ai/model.go create mode 100644 internal/ai/prompt.go create mode 100644 internal/ai/repository.go create mode 100644 internal/ai/service.go create mode 100644 internal/ai/validator.go create mode 100644 internal/event/handler.go create mode 100644 internal/event/model.go create mode 100644 internal/event/repository.go create mode 100644 internal/event/service.go create mode 100644 internal/goal/handler.go create mode 100644 internal/goal/model.go create mode 100644 internal/goal/repository.go create mode 100644 internal/integration/intervals_client.go create mode 100644 internal/integration/intervals_handler.go create mode 100644 internal/nutrition/handler.go create mode 100644 internal/nutrition/service.go diff --git a/TODO.md b/TODO.md index ac4d71d..611d26b 100644 --- a/TODO.md +++ b/TODO.md @@ -4,37 +4,79 @@ - [x] **User Registration & Login**: Email authentication with JWT tokens - [x] **User Profile**: Bio, stats, zones (HR/Power), equipment, FTP, weight - [x] **Password Recovery**: Email-based reset with secure tokens -- [ ] **OAuth Integration**: Google, Apple, Strava, Garmin -- [ ] **Onboarding & Baselines**: Guided setup, baseline tests, auto zone calc +- [x] **Onboarding Wizard**: Guided setup with profile, metrics, equipment, and preferences steps +- [~] **OAuth Integration**: Garmin & Wahoo OAuth implemented; Google, Apple, Strava pending - [ ] **Account Roles**: Athlete, Coach, Admin; team/org workspaces - [ ] **Multi-device Sessions**: Seamless handoff across web/mobile ## Workout Planning +- [x] **Workout Scheduling**: Calendar view with monthly navigation, rich workout cards (duration, TSS, zone-colored segment charts, status borders) +- [x] **Templates Library**: 11 built-in templates (Recovery, Endurance, Tempo, Sweet Spot, Threshold, Over-Unders, VO2max, Sprint, Ramp Test) with category browsing +- [x] **Template Scheduling**: Browse and schedule templates directly from calendar Add Workout modal +- [x] **Structured Workout Builder**: Interval builder with warmup/main/cooldown sections, power targets (%FTP), cadence, repeats, rest intervals, and live preview chart +- [x] **Export Structured Workouts**: .zwo (Zwift), Garmin FIT/Workout, Wahoo - [ ] **AI-Powered Planning**: Generate plans by goal, time, fitness level - [ ] **Adaptive Scheduling**: Auto-reschedule based on missed sessions, fatigue, weather -- [ ] **Workout Scheduling**: Calendar view, drag-drop, ICS sync (Google/Apple/Outlook) - [ ] **Goal Setting & Tracking**: SMART goals with real-time progress bars -- [x] **Templates Library**: Plan & session templates (endurance, threshold, VO2, strength) -- [x] **Export Structured Workouts**: .zwo (Zwift), Garmin FIT/Workout, Wahoo, TrainerRoad - [ ] **Race/Event Planner**: Target events, taper builder, gear checklist ## Workout Tracking -- [ ] **Workout Logging**: Exercises, sets/reps/weight; power, HR, cadence, GPS +- [x] **Workout CRUD**: Create, read, update, delete workouts with calendar integration - [x] **Device Capture**: File upload (FIT/TCX/GPX activity import with metric extraction) -- [ ] **Tags & Notes**: RPE, mood, conditions, injuries, equipment used -- [x] **Equipment Tracking**: Bike/components mileage auto-tracking, service reminders +- [x] **ZWO Import**: Client-side Zwift workout file parsing +- [x] **Equipment Tracking**: Bike/components mileage auto-tracking, service interval reminders, distance/duration since last service +- [~] **Tags & Notes**: RPE & Notes fields implemented in backend; mood, conditions, injuries, and tag system still pending +- [ ] **Drag-drop Calendar**: Reorder/reschedule workouts by dragging + +## Workout Visualization +- [x] **Workout Detail Modal**: Interval chart, auto-generated workout summary, zone distribution, completed metrics, equipment, Garmin/Wahoo push +- [x] **Power Zone System**: 7-zone model (Recovery through Neuromuscular) with color-coded visualization +- [x] **Mini Segment Charts**: Compact zone-colored bars on calendar cards +- [x] **Zone Distribution**: Horizontal stacked bar with time-in-zone breakdown +- [x] **TSS/IF Calculation**: Training Stress Score and Intensity Factor from segment data + +## Dashboard +- [x] **Stats Overview**: Total rides, distance, time, elevation gain +- [x] **Calendar Widget**: Compact monthly calendar with workout cards, month navigation +- [x] **Next Workout**: Upcoming workout display with link to calendar +- [x] **Today's Progress**: Completion percentage for daily workouts +- [x] **Profile Display**: Welcome message with first/last name from user profile +- [ ] **Interactive Charts**: Activity trends (CTL/ATL/TSB), power curves ## Advanced Analytics -- [ ] **Interactive Dashboards**: Charts for load (CTL/ATL/TSB), power curves, trends +- [x] **Stats Page**: Summary, weekly, and monthly aggregated statistics +- [x] **Personal Bests**: Personal records tracking +- [ ] **Interactive Dashboards**: Charts for training load, power curves, trends - [ ] **Progress Insights (AI)**: Automatic highlights, plateau detection, anomaly alerts - [ ] **Comparisons**: Before/after, season-over-season, segment/time comparisons - [ ] **Custom Reports**: Export CSV/PDF; shareable report links +## Workout Library +- [x] **Browse Library**: System and user workouts with search, category, type, and difficulty filters +- [x] **Workout Detail Page**: Full workout view with interval chart and segment breakdown +- [x] **Create Custom Workouts**: Interval builder with warmup/main/cooldown structure +- [x] **My Workouts**: User's custom workout collection +- [x] **Favorites**: Save and browse favorite workouts +- [x] **Ratings**: Star rating system with comments +- [ ] **Community Sharing**: Public/private workout sharing + ## Training & Coaching +- [x] **Structured Workouts**: Interval builder with targets (%FTP, cadence, repeats) - [ ] **Coaching & Guidance**: Coach portal, athlete assignments, plan reviews - [ ] **Virtual Training Rides**: Integrations with Zwift/Rouvy/RGT; video routes -- [ ] **Structured Workouts**: Interval builder with targets (%FTP, %HRR, RPE) -- [ ] **Messaging**: Coach–athlete chat, comments on sessions, file attachments +- [ ] **Messaging**: Coach-athlete chat, comments on sessions, file attachments + +## Integrations & Data +- [x] **Garmin Connect**: OAuth2 PKCE flow, push workouts, connection management +- [x] **Wahoo Cloud API**: OAuth2 flow, push workouts as plans, connection management +- [x] **Activity Import**: FIT (session metrics), TCX (lap aggregation), GPX (Haversine distance, elevation) +- [x] **Workout Export**: FIT (Garmin-compatible), ZWO (Zwift-compatible) +- [ ] **Strava Sync**: OAuth login + activity sync +- [ ] **TrainingPeaks**: Calendar + workout push +- [x] **Intervals.icu**: Integration (push workouts + sync activities) +- [ ] **COROS, Apple Health, Google Fit**: Wearable sync +- [ ] **Music Integration**: Spotify/Apple Music workout-matched playlists +- [ ] **Public API & Webhooks**: For partners, coaches, clubs ## Nutrition & Recovery - [ ] **Nutrition Planning**: Meal plans, macros, carb periodization @@ -54,13 +96,6 @@ - [ ] **Personalized Recommendations (AI)**: Next best workout, videos, articles - [ ] **Rewards & Incentives**: Points store, partner discounts, raffles -## Integrations & Data -- [~] **Wearable Sync**: Garmin, Wahoo, COROS, Apple Health, Google Fit (Garmin + Wahoo OAuth & push implemented) -- [ ] **Platform Sync**: Strava, TrainingPeaks, Intervals.icu (calendar + workout push) -- [ ] **Music Integration**: Spotify/Apple Music workout-matched playlists -- [~] **Data Import/Export**: FIT/TCX/GPX activity import implemented; CSV/JSON export & bulk import pending -- [ ] **Public API & Webhooks**: For partners, coaches, clubs - ## Notifications & Comms - [ ] **Reminders**: Email, push, SMS; smart timing - [ ] **Digest Emails**: Weekly plan, monthly progress @@ -100,7 +135,7 @@ --- -## Completed - Phase 1: Authentication & User Management ✅ +## Completed - Phase 1: Authentication & User Management ### Infrastructure - [x] Migrated from Python/Flask to Go with Chi router @@ -130,37 +165,27 @@ --- -## Completed - Phase 2: User Profiles, Equipment & Workouts ✅ +## Completed - Phase 2: Profiles, Equipment & Workouts -### Profile & Equipment (completed earlier) +### API Endpoints - [x] GET/PUT `/api/protected/profile` - Full profile management - [x] POST/GET/PUT/DELETE `/api/protected/equipment` - Bike/gear CRUD - [x] GET `/api/protected/zones` - Calculate HR & power training zones -- [x] Equipment tracking (brand, model, weight) -- [x] Equipment usage stats from workouts - -### Workouts (completed earlier) - [x] POST/GET/PUT/DELETE `/api/protected/workouts` - Full workout CRUD - [x] GET `/api/protected/workouts/month` - Calendar month filtering - [x] GET `/api/protected/workout-types` - Predefined workout types - [x] POST `/api/protected/workouts/upload` - ZWO file import & parsing -- [x] Structured workout segments (JSONB) with power/cadence targets - -### Stats - [x] GET `/api/protected/stats/summary` - Overall ride statistics - [x] GET `/api/protected/stats/weekly` - Weekly aggregated stats - [x] GET `/api/protected/stats/monthly` - Monthly aggregated stats - [x] GET `/api/protected/stats/personal-bests` - Personal records - -### Workout Templates -- [x] GET `/api/protected/workout-templates` - List predefined templates (with category filter) -- [x] GET `/api/protected/workout-templates/detail` - Get template with full segment data +- [x] GET `/api/protected/workout-templates` - List templates (with category filter) +- [x] GET `/api/protected/workout-templates/detail` - Template with full segments - [x] POST `/api/protected/workouts/from-template` - Create workout from template -- [x] 11 built-in templates: Recovery, Endurance, Tempo, Sweet Spot, Threshold, Over-Unders, VO2max, Sprint, Ramp Test --- -## Completed - Phase 2.5: Workout Export & Device Integration ✅ +## Completed - Phase 2.5: Export & Device Integration ### Workout Export - [x] GET `/api/protected/workouts/export/fit` - FIT workout file export (Garmin-compatible) @@ -191,7 +216,7 @@ --- -## Completed - Phase 2.6: Activity Import & Equipment Mileage ✅ +## Completed - Phase 2.6: Activity Import & Equipment Mileage ### Activity File Import (FIT/TCX/GPX) - [x] POST `/api/protected/workouts/import` - Import activity files (multipart upload) @@ -209,11 +234,60 @@ - [x] Distance and duration since last service counters - [x] POST `/api/protected/equipment/service` - Record service (resets counters) - [x] GET `/api/protected/equipment/service-status` - Check if equipment needs servicing -- [x] Service status in GET `/api/protected/equipment` response (total_distance, total_rides, etc.) --- -## Next Phase: Phase 3 - OAuth Login & Platform Sync +## Completed - Phase 3: Frontend & Full-Stack Features + +### Vue 3 Frontend (Tailwind CSS v4) +- [x] Vue 3 Composition API with `