perf: 优化类型问题

This commit is contained in:
richarjiang
2026-04-07 15:35:44 +08:00
parent 3a1b4d22bf
commit 886e70a106
18 changed files with 101 additions and 111 deletions

View File

@@ -13,7 +13,7 @@ export class CreateShareDto {
@IsString()
@IsNotEmpty({ message: '标题不能为空' })
@MaxLength(100, { message: '标题不能超过100个字符' })
title: string;
title!: string;
@ApiProperty({
description: '6个关卡ID',
@@ -23,5 +23,5 @@ export class CreateShareDto {
@ArrayMinSize(6, { message: '需要恰好6个关卡' })
@ArrayMaxSize(6, { message: '需要恰好6个关卡' })
@IsString({ each: true })
levelIds: string[];
levelIds!: string[];
}

View File

@@ -2,48 +2,48 @@ import { ApiProperty } from '@nestjs/swagger';
export class CreateShareResponseDto {
@ApiProperty({ description: '分享码' })
shareCode: string;
shareCode!: string;
@ApiProperty({ description: '分享标题' })
title: string;
title!: string;
@ApiProperty({ description: '关卡数量' })
levelCount: number;
levelCount!: number;
}
export class ShareLevelDto {
@ApiProperty()
id: string;
id!: string;
@ApiProperty()
level: number;
level!: number;
@ApiProperty()
imageUrl: string;
imageUrl!: string;
@ApiProperty()
answer: string;
answer!: string;
@ApiProperty({ nullable: true })
hint1: string | null;
hint1!: string | null;
@ApiProperty({ nullable: true })
hint2: string | null;
hint2!: string | null;
@ApiProperty({ nullable: true })
hint3: string | null;
hint3!: string | null;
@ApiProperty()
sortOrder: number;
sortOrder!: number;
}
export class JoinShareResponseDto {
@ApiProperty({ description: '分享码' })
shareCode: string;
shareCode!: string;
@ApiProperty({ description: '分享标题' })
title: string;
title!: string;
@ApiProperty({ description: '关卡列表', type: [ShareLevelDto] })
levels: ShareLevelDto[];
levels!: ShareLevelDto[];
}