diff --git a/apps/backend/apps/client/src/submission/class/create-submission.dto.ts b/apps/backend/apps/client/src/submission/class/create-submission.dto.ts index c793f5826c..e4579e2051 100644 --- a/apps/backend/apps/client/src/submission/class/create-submission.dto.ts +++ b/apps/backend/apps/client/src/submission/class/create-submission.dto.ts @@ -1,8 +1,10 @@ import { Language } from '@prisma/client' import { Type } from 'class-transformer' import { + IsArray, IsBoolean, IsEnum, + IsInt, IsNotEmpty, IsNumber, IsString, @@ -39,6 +41,22 @@ export class CreateSubmissionDto { } export class CreateUserTestSubmissionDto extends CreateSubmissionDto { + @IsArray() + @ValidateNested({ each: true }) + @Type(() => UserTestcase) + userTestcases: UserTestcase[] +} + +export class UserTestcase { + @IsInt() + @IsNotEmpty() + id: number; + + @IsString() + @IsNotEmpty() + in: string + + @IsString() @IsNotEmpty() - userTestcases: { id: number; in: string; out: string }[] + out: string } diff --git a/apps/backend/apps/client/src/submission/submission.controller.ts b/apps/backend/apps/client/src/submission/submission.controller.ts index e71b0e74d8..7f2c98b678 100644 --- a/apps/backend/apps/client/src/submission/submission.controller.ts +++ b/apps/backend/apps/client/src/submission/submission.controller.ts @@ -18,7 +18,7 @@ import { } from '@libs/pipe' import { CreateSubmissionDto, - type CreateUserTestSubmissionDto + CreateUserTestSubmissionDto } from './class/create-submission.dto' import { SubmissionService } from './submission.service'