feat(challenges): 支持自定义挑战类型并优化必填字段验证

- 新增 CUSTOM 挑战类型枚举值
- requirementLabel 字段改为可选,允许为空并添加默认值处理
- minimumCheckInDays 最大值从 365 提升至 1000,支持更长周期挑战
- 推送通知模板支持自定义挑战的动态文案生成
- 新增 getCustomEncouragementTemplate 和 getCustomInvitationTemplate 函数
This commit is contained in:
richarjiang
2025-11-27 11:11:26 +08:00
parent 7a05097226
commit ac231a7742
6 changed files with 58 additions and 15 deletions

View File

@@ -34,10 +34,10 @@ export class CreateCustomChallengeDto {
@Max(1000)
targetValue: number;
@ApiProperty({ description: '最少打卡天数', example: 21, minimum: 1, maximum: 365 })
@ApiProperty({ description: '最少打卡天数', example: 21, minimum: 1, maximum: 1000 })
@IsNumber()
@Min(1)
@Max(365)
@Max(1000)
minimumCheckInDays: number;
@ApiProperty({ description: '持续时间标签', example: '持续21天' })
@@ -48,7 +48,7 @@ export class CreateCustomChallengeDto {
@ApiProperty({ description: '挑战要求标签', example: '每日喝水8杯' })
@IsString()
@IsNotEmpty()
@IsOptional()
@MaxLength(255)
requirementLabel: string;