From d2ba8cb1d853d51da5d650f937b15607520cf589 Mon Sep 17 00:00:00 2001 From: zhumeisongsong Date: Mon, 9 Dec 2024 10:06:30 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20Add=20validation=20decorato?= =?UTF-8?q?rs=20to=20UserTaskDto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interface-adapters/src/lib/dto/user-task.dto.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/tasks/interface-adapters/src/lib/dto/user-task.dto.ts b/libs/tasks/interface-adapters/src/lib/dto/user-task.dto.ts index 6325095..790e834 100644 --- a/libs/tasks/interface-adapters/src/lib/dto/user-task.dto.ts +++ b/libs/tasks/interface-adapters/src/lib/dto/user-task.dto.ts @@ -1,29 +1,42 @@ import { Field, ID, ObjectType } from '@nestjs/graphql'; import { UserDto } from '@users/interface-adapters'; +import { IsDate, IsNotEmpty, IsOptional, IsUUID } from 'class-validator'; import { TaskDto } from './task.dto'; @ObjectType() export class UserTaskDto { @Field(() => ID) + @IsNotEmpty() + @IsUUID() id: string; @Field(() => Date) + @IsNotEmpty() + @IsDate() createdAt: Date; @Field(() => Date, { nullable: true }) + @IsOptional() + @IsDate() updatedAt: Date | null; @Field(() => String) + @IsNotEmpty() + @IsUUID() taskId: string; @Field(() => TaskDto, { nullable: true }) + @IsOptional() task: TaskDto | null; @Field(() => String) + @IsNotEmpty() + @IsUUID() userId: string; @Field(() => UserDto, { nullable: true }) + @IsOptional() user: UserDto | null; constructor(