feat(challenges): 在挑战列表和详情中添加勋章信息展示

为睡眠挑战类型添加勋章信息支持,在挑战列表和详情接口中返回 sleepChallengeMonth 勋章配置数据。

- 在 ChallengesModule 中注册 BadgeConfig 模型
- 在 ChallengesService 中注入 BadgeConfig 仓库
- 查询列表时,若存在睡眠挑战则预加载勋章配置
- 查询详情时,若为睡眠挑战则附加勋章信息
- 在 DTO 中新增 BadgeInfoDto 接口定义勋章数据结构
- 仅对激活状态的 sleepChallengeMonth 勋章进行查询和展示
This commit is contained in:
richarjiang
2025-11-14 17:26:41 +08:00
parent 7b4d7c4459
commit bac75f82ba
4 changed files with 62 additions and 1 deletions

View File

@@ -1,6 +1,14 @@
import { ChallengeProgressDto, RankingItemDto } from './challenge-progress.dto';
import { ChallengeType } from '../models/challenge.model';
export interface BadgeInfoDto {
code: string;
name: string;
description: string;
imageUrl: string;
category: string;
}
export interface ChallengeDetailDto {
id: string;
title: string;
@@ -20,4 +28,5 @@ export interface ChallengeDetailDto {
userRank?: number;
type: ChallengeType;
unit: string;
badge?: BadgeInfoDto;
}