Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: epic, story, task 엔티티, DTO에 대해 제약조건 설정 #312

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion backend/src/project/dto/epic/EpicCreateRequest.dto.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 2 additions & 0 deletions backend/src/project/dto/epic/EpicUpdateRequest.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
IsString,
Matches,
ValidateNested,
Length,
} from 'class-validator';
import { EpicColor } from 'src/project/entity/epic.entity';

Expand All @@ -17,6 +18,7 @@ class Epic {

@IsOptional()
@IsString()
@Length(1, 10)
name?: string;

@IsOptional()
Expand Down
6 changes: 6 additions & 0 deletions backend/src/project/dto/story/StoryCreateRequest.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion backend/src/project/dto/story/StoryUpdateRequest.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import {
IsNotEmpty,
IsOptional,
IsString,
Length,
Matches,
Max,
Min,
ValidateNested,
} from 'class-validator';
import { StoryStatus } from 'src/project/entity/story.entity';
Expand All @@ -20,10 +23,13 @@ class Story {

@IsOptional()
@IsString()
@Length(1, 100)
title?: string;

@IsOptional()
@IsInt()
@Min(0)
@Max(100)
point?: number;

@IsOptional()
Expand Down
2 changes: 1 addition & 1 deletion backend/src/project/dto/task/TaskCreateRequest.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions backend/src/project/dto/task/TaskUpdateRequest.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
IsNotEmpty,
IsOptional,
IsString,
Length,
Matches,
ValidateNested,
} from 'class-validator';
Expand All @@ -21,6 +22,7 @@ class Task {

@IsOptional()
@IsString()
@Length(1, 100)
title?: string;

@IsOptional()
Expand Down
2 changes: 1 addition & 1 deletion backend/src/project/entity/epic.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
2 changes: 1 addition & 1 deletion backend/src/project/entity/story.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
2 changes: 1 addition & 1 deletion backend/src/project/entity/task.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
Loading