feat: 添加目标体重设置功能
- UserConfig 模型添加 target_weight 字段 - 新增 POST /api/config 端点用于更新用户配置 - 设置页面添加目标体重输入框及目标 BMI 自动计算 - BMI 分析使用用户设置的目标体重计算达成预估 - 修复测试 fixture 的 save_config 参数问题 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -160,6 +160,7 @@ class UserConfig:
|
||||
weight: Optional[float] = None # 公斤
|
||||
activity_level: str = ActivityLevel.MODERATE.value
|
||||
goal: str = Goal.MAINTAIN.value
|
||||
target_weight: Optional[float] = None # 目标体重(公斤)
|
||||
|
||||
@property
|
||||
def bmr(self) -> Optional[int]:
|
||||
@@ -193,6 +194,7 @@ class UserConfig:
|
||||
"weight": self.weight,
|
||||
"activity_level": self.activity_level,
|
||||
"goal": self.goal,
|
||||
"target_weight": self.target_weight,
|
||||
"bmr": self.bmr,
|
||||
"tdee": self.tdee,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user