feat: Phase 1.5 - Flexible Goal System (DB-Registry) Part 1/2
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>
This commit is contained in:
1 parent
27a8af7008
commit
65ee5f898f
5 files changed
+835
-81
No files matched your search
@@ -339,6 +339,12 @@ export const api = {
|
||||
updateGoal: (id,d) => req(`/goals/${id}`, jput(d)),
|
||||
deleteGoal: (id) => req(`/goals/${id}`, {method:'DELETE'}),
|
||||
|
||||
// Goal Type Definitions (Phase 1.5)
|
||||
listGoalTypeDefinitions: () => req('/goals/goal-types'),
|
||||
createGoalType: (d) => req('/goals/goal-types', json(d)),
|
||||
updateGoalType: (id,d) => req(`/goals/goal-types/${id}`, jput(d)),
|
||||
deleteGoalType: (id) => req(`/goals/goal-types/${id}`, {method:'DELETE'}),
|
||||
|
||||
// Training Phases
|
||||
listTrainingPhases: () => req('/goals/phases'),
|
||||
createTrainingPhase: (d) => req('/goals/phases', json(d)),
|
||||
|
||||
Reference in new issue
Block a user