feat: 优化目标任务生成逻辑,增加自定义重复规则支持

- 在GoalTaskService中添加对自定义重复规则的支持,允许用户指定生成任务的星期几。
- 增加日志记录,便于调试和监控任务生成过程。
- 确保生成的任务不会与现有任务冲突,提升任务管理的灵活性和准确性。
This commit is contained in:
2025-08-24 09:46:24 +08:00
parent cba56021de
commit 475f928990
2 changed files with 44 additions and 26 deletions

View File

@@ -33,6 +33,7 @@ export class GoalsService {
*/
async createGoal(userId: string, createGoalDto: CreateGoalDto): Promise<Goal> {
try {
this.logger.log(`createGoal: ${JSON.stringify(createGoalDto, null, 2)}`);
// 验证自定义重复规则
if (createGoalDto.repeatType === GoalRepeatType.CUSTOM && !createGoalDto.customRepeatRule) {
throw new BadRequestException('自定义重复类型必须提供自定义重复规则');