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

@@ -216,7 +216,7 @@ export class ChallengeReminderService {
}
// 获取鼓励文案
const template = getEncouragementTemplate(participant.challenge.type);
const template = getEncouragementTemplate(participant.challenge.type, participant.challenge.title);
// 发送推送
const result = await this.pushNotificationsService.sendBatchNotificationToDevices({
@@ -281,7 +281,7 @@ export class ChallengeReminderService {
// 获取邀请文案
const template = reminderType === ReminderType.GENERAL_INVITATION
? getGeneralInvitationTemplate()
: getInvitationTemplate(randomChallenge.type);
: getInvitationTemplate(randomChallenge.type, randomChallenge.title);
// 发送推送
const result = await this.pushNotificationsService.sendBatchNotificationToDevices({