65ee5f898f
feat: Phase 1.5 - Flexible Goal System (DB-Registry) Part 1/2
...
Deploy Development / deploy (push) Successful in 43s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 13s
KRITISCHE ARCHITEKTUR-ÄNDERUNG vor Phase 0b:
Ermöglicht dynamische Goal Types ohne Code-Änderungen.
Backend:
- Migration 024: goal_type_definitions Tabelle
→ 8 existierende Typen als Seed-Data migriert
→ Flexible Schema: source_table, aggregation_method, calculation_formula
→ System vs. Custom Types (is_system flag)
- goal_utils.py: Universal Value Fetcher
→ get_current_value_for_goal() ersetzt hardcoded if/elif chain
→ Unterstützt: latest, avg_7d, avg_30d, sum_30d, count_7d, etc.
→ Komplexe Formeln (lean_mass) via calculation_formula JSON
- goals.py: CRUD API für Goal Type Definitions
→ GET /goals/goal-types (public)
→ POST/PUT/DELETE /goals/goal-types (admin-only)
→ Schutz für System-Types (nicht löschbar)
- goals.py: _get_current_value_for_goal_type() delegiert zu Universal Fetcher
Frontend:
- api.js: 4 neue Funktionen (listGoalTypeDefinitions, create, update, delete)
Dokumentation:
- TODO_GOAL_SYSTEM.md: Phase 1.5 hinzugefügt, Roadmap aktualisiert
Part 2/2 (nächster Commit):
- Frontend: Dynamic Goal Types Dropdown
- Admin UI: Goal Type Management Page
- Testing
Warum JETZT (vor Phase 0b)?
- Phase 0b Platzhalter (120+) nutzen Goals für Score-Berechnungen
- Flexible Goals → automatisch in Platzhaltern verfügbar
- Später umbauen = Doppelarbeit (alle Platzhalter anpassen)
Zukünftige Custom Goals möglich:
- 🧘 Meditation (min/Tag)
- 📅 Trainingshäufigkeit (x/Woche)
- 📊 Planabweichung (%)
- 🎯 Ritual-Adherence (%)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 06:45:05 +01:00