feat(challenges): 新增挑战类型字段并重构进度上报逻辑

- 数据库新增 type 列区分 water/exercise/diet/mood/sleep/weight 六类挑战
- 进度上报由增量模式改为绝对值模式,字段 increment_value → reportedValue
- 服务层按 challenge.targetValue 判断当日是否完成,再按 minimumCheckInDays 统计总进度
- 相关 DTO 与模型同步更新,支持新类型返回

BREAKING CHANGE: 上报接口字段由 increment 改为 value,且为当日绝对值
This commit is contained in:
richarjiang
2025-09-29 15:14:48 +08:00
parent d87fc84575
commit 64460a9d68
7 changed files with 103 additions and 59 deletions

View File

@@ -1,4 +1,5 @@
import { ChallengeProgressDto, RankingItemDto } from './challenge-progress.dto';
import { ChallengeType } from '../models/challenge.model';
export interface ChallengeDetailDto {
id: string;
@@ -17,4 +18,5 @@ export interface ChallengeDetailDto {
progress?: ChallengeProgressDto;
rankings: RankingItemDto[];
userRank?: number;
type: ChallengeType;
}