feat(share): 分享挑战关卡进度记录功能

- 新增 Level.timeLimit 字段支持关卡时间限制
- 新增 ShareLevelProgress 实体记录单关通关进度
- 新增 ShareLevelProgressRepository
- 新增 DTO: ReportLevelProgressDto, ReportLevelProgressResponseDto
- 新增 POST /v1/share/progress 接口用于上报进度
- 支持仅首次通关有效判断
- 支持时间限制内通关判断
- 不可变模式更新进度记录
- 数据库迁移脚本

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
richarjiang
2026-04-08 11:46:54 +08:00
parent 2dd22b10b1
commit 3d52cfe843
12 changed files with 960 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, IsNotEmpty, IsNumber, IsString, Min } from 'class-validator';
export class ReportLevelProgressDto {
@ApiProperty({ description: '分享码' })
@IsString()
@IsNotEmpty()
shareCode!: string;
@ApiProperty({ description: '关卡 ID' })
@IsString()
@IsNotEmpty()
levelId!: string;
@ApiProperty({ description: '是否通过' })
@IsBoolean()
passed!: boolean;
@ApiProperty({ description: '通关时间(秒)' })
@IsNumber()
@Min(0)
timeSpent!: number;
}