feat: Add personal reference values management in settings and API
- Introduced new routes and API endpoints for managing personal reference values. - Updated the SettingsPage to include a section for reference values with navigation to manage them. - Enhanced the backend to support reference values in the data layer and versioning. - Added necessary imports and UI components for a seamless user experience.
This commit is contained in:
1 parent
e7dedd527f
commit
f0e6fd04fb
23 files changed
+1719
-2
No files matched your search
@@ -0,0 +1,13 @@
|
||||
"""Training base profile registrations (scaffold, in-code)."""
|
||||
|
||||
from .registry import (
|
||||
get_training_base_profile,
|
||||
list_training_base_profile_keys,
|
||||
try_get_training_base_profile,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"get_training_base_profile",
|
||||
"list_training_base_profile_keys",
|
||||
"try_get_training_base_profile",
|
||||
]
|
||||
@@ -0,0 +1,52 @@
|
||||
"""
|
||||
Example training base profiles — point to default templates and optional dimension filters.
|
||||
|
||||
Future: DB-backed training types may reference profile keys; this registry is code-only.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict, Optional
|
||||
|
||||
from data_layer.training_profile.models import TrainingBaseProfile
|
||||
|
||||
_PROFILES: Dict[str, TrainingBaseProfile] = {}
|
||||
|
||||
|
||||
def _register(p: TrainingBaseProfile) -> None:
|
||||
if p.key in _PROFILES:
|
||||
raise ValueError(f"Duplicate training base profile key: {p.key}")
|
||||
_PROFILES[p.key] = p
|
||||
|
||||
|
||||
def get_training_base_profile(key: str) -> TrainingBaseProfile:
|
||||
if key not in _PROFILES:
|
||||
raise KeyError(f"Unknown training base profile: {key}")
|
||||
return _PROFILES[key]
|
||||
|
||||
|
||||
def try_get_training_base_profile(key: str) -> Optional[TrainingBaseProfile]:
|
||||
return _PROFILES.get(key)
|
||||
|
||||
|
||||
def list_training_base_profile_keys() -> tuple[str, ...]:
|
||||
return tuple(sorted(_PROFILES.keys()))
|
||||
|
||||
|
||||
_register(
|
||||
TrainingBaseProfile(
|
||||
key="scaffold_aerobic_base",
|
||||
label="Scaffold: aerobic base profile",
|
||||
default_template_id="scaffold_example_aerobic_v1",
|
||||
allowed_dimension_keys=None,
|
||||
)
|
||||
)
|
||||
|
||||
_register(
|
||||
TrainingBaseProfile(
|
||||
key="scaffold_strength_base",
|
||||
label="Scaffold: strength base profile",
|
||||
default_template_id="scaffold_example_strength_v1",
|
||||
allowed_dimension_keys=frozenset({"effort"}),
|
||||
)
|
||||
)
|
||||
Reference in new issue
Block a user