From 0b3bf49a3b30161ad889408ed86682c4abb4c3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=98=81=EC=9A=B0?= Date: Mon, 15 Jul 2024 22:33:16 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20epic,=20story,=20task=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0,=20DTO=EC=97=90=20=EB=8C=80=ED=95=B4=20?= =?UTF-8?q?=EC=A0=9C=EC=95=BD=EC=A1=B0=EA=B1=B4=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - epic - name을 1자 이상 10자 이하로 설정 - story - title을 1자 이상 100자 이하로 설정 - point을 1 포인트 이상 100 포인트 이하로 설정 - task - title을 1자 이상 100자 이하로 설정 --- backend/src/project/dto/epic/EpicCreateRequest.dto.ts | 10 +++++++++- backend/src/project/dto/epic/EpicUpdateRequest.dto.ts | 2 ++ .../src/project/dto/story/StoryCreateRequest.dto.ts | 6 ++++++ .../src/project/dto/story/StoryUpdateRequest.dto.ts | 8 +++++++- backend/src/project/dto/task/TaskCreateRequest.dto.ts | 2 +- backend/src/project/dto/task/TaskUpdateRequest.dto.ts | 2 ++ backend/src/project/entity/epic.entity.ts | 2 +- backend/src/project/entity/story.entity.ts | 2 +- backend/src/project/entity/task.entity.ts | 2 +- 9 files changed, 30 insertions(+), 6 deletions(-) diff --git a/backend/src/project/dto/epic/EpicCreateRequest.dto.ts b/backend/src/project/dto/epic/EpicCreateRequest.dto.ts index 775039a..4acff8f 100644 --- a/backend/src/project/dto/epic/EpicCreateRequest.dto.ts +++ b/backend/src/project/dto/epic/EpicCreateRequest.dto.ts @@ -1,9 +1,17 @@ import { Type } from 'class-transformer'; -import { IsEnum, IsNotEmpty, IsString, Matches, ValidateNested } from 'class-validator'; +import { + IsEnum, + IsNotEmpty, + IsString, + Length, + Matches, + ValidateNested, +} from 'class-validator'; import { EpicColor } from 'src/project/entity/epic.entity'; class Epic { @IsString() + @Length(1, 10) name: string; @IsEnum(EpicColor) diff --git a/backend/src/project/dto/epic/EpicUpdateRequest.dto.ts b/backend/src/project/dto/epic/EpicUpdateRequest.dto.ts index abce63f..29cf6e2 100644 --- a/backend/src/project/dto/epic/EpicUpdateRequest.dto.ts +++ b/backend/src/project/dto/epic/EpicUpdateRequest.dto.ts @@ -7,6 +7,7 @@ import { IsString, Matches, ValidateNested, + Length, } from 'class-validator'; import { EpicColor } from 'src/project/entity/epic.entity'; @@ -17,6 +18,7 @@ class Epic { @IsOptional() @IsString() + @Length(1, 10) name?: string; @IsOptional() diff --git a/backend/src/project/dto/story/StoryCreateRequest.dto.ts b/backend/src/project/dto/story/StoryCreateRequest.dto.ts index 13cdb9f..71bf166 100644 --- a/backend/src/project/dto/story/StoryCreateRequest.dto.ts +++ b/backend/src/project/dto/story/StoryCreateRequest.dto.ts @@ -4,16 +4,22 @@ import { IsInt, IsNotEmpty, IsString, + Length, Matches, + Max, + Min, ValidateNested, } from 'class-validator'; import { StoryStatus } from 'src/project/entity/story.entity'; class Story { @IsString() + @Length(1, 100) title: string; @IsInt() + @Min(0) + @Max(100) point: number; @IsEnum(StoryStatus) diff --git a/backend/src/project/dto/story/StoryUpdateRequest.dto.ts b/backend/src/project/dto/story/StoryUpdateRequest.dto.ts index 4e4d22a..cea3c75 100644 --- a/backend/src/project/dto/story/StoryUpdateRequest.dto.ts +++ b/backend/src/project/dto/story/StoryUpdateRequest.dto.ts @@ -5,7 +5,10 @@ import { IsNotEmpty, IsOptional, IsString, + Length, Matches, + Max, + Min, ValidateNested, } from 'class-validator'; import { StoryStatus } from 'src/project/entity/story.entity'; @@ -20,10 +23,13 @@ class Story { @IsOptional() @IsString() + @Length(1, 100) title?: string; - + @IsOptional() @IsInt() + @Min(0) + @Max(100) point?: number; @IsOptional() diff --git a/backend/src/project/dto/task/TaskCreateRequest.dto.ts b/backend/src/project/dto/task/TaskCreateRequest.dto.ts index 40b1625..e2486c5 100644 --- a/backend/src/project/dto/task/TaskCreateRequest.dto.ts +++ b/backend/src/project/dto/task/TaskCreateRequest.dto.ts @@ -41,7 +41,7 @@ export function IsOneDecimalPlace(validationOptions?: ValidationOptions) { class Task { @IsString() - @Length(0, 100, { message: 'Title must be 100 characters or less' }) + @Length(1, 100, { message: 'Title must be 100 characters or less' }) title: string; @IsOptional() diff --git a/backend/src/project/dto/task/TaskUpdateRequest.dto.ts b/backend/src/project/dto/task/TaskUpdateRequest.dto.ts index ce444aa..72b867d 100644 --- a/backend/src/project/dto/task/TaskUpdateRequest.dto.ts +++ b/backend/src/project/dto/task/TaskUpdateRequest.dto.ts @@ -5,6 +5,7 @@ import { IsNotEmpty, IsOptional, IsString, + Length, Matches, ValidateNested, } from 'class-validator'; @@ -21,6 +22,7 @@ class Task { @IsOptional() @IsString() + @Length(1, 100) title?: string; @IsOptional() diff --git a/backend/src/project/entity/epic.entity.ts b/backend/src/project/entity/epic.entity.ts index 3fbe3ce..5823ccd 100644 --- a/backend/src/project/entity/epic.entity.ts +++ b/backend/src/project/entity/epic.entity.ts @@ -33,7 +33,7 @@ export class Epic { @JoinColumn({ name: 'project_id' }) project: Project; - @Column({ type: 'varchar', length: 255, nullable: false }) + @Column({ type: 'varchar', length: 10, nullable: false }) name: string; @Column({ type: 'varchar', length: 255, nullable: false }) diff --git a/backend/src/project/entity/story.entity.ts b/backend/src/project/entity/story.entity.ts index e0a2506..6747180 100644 --- a/backend/src/project/entity/story.entity.ts +++ b/backend/src/project/entity/story.entity.ts @@ -35,7 +35,7 @@ export class Story { @JoinColumn({ name: 'epic_id' }) epic: Epic; - @Column({ type: 'varchar', length: 255, nullable: false }) + @Column({ type: 'varchar', length: 100, nullable: false }) title: string; @Column({ type: 'int', nullable: false }) diff --git a/backend/src/project/entity/task.entity.ts b/backend/src/project/entity/task.entity.ts index 63901e7..e13aed8 100644 --- a/backend/src/project/entity/task.entity.ts +++ b/backend/src/project/entity/task.entity.ts @@ -34,7 +34,7 @@ export class Task { @JoinColumn({ name: 'story_id' }) story: Story; - @Column({ type: 'varchar', length: 99, nullable: false }) + @Column({ type: 'varchar', length: 100, nullable: false }) title: string; @Column({ type: 'int', nullable: false })