From ec9774fa03f88cb1b6dd2ac5051a8852b45f93aa Mon Sep 17 00:00:00 2001 From: mj Date: Wed, 31 Jul 2024 23:43:22 +0900 Subject: [PATCH] Feat update validation for nickname and title length --- backend/src/users/dto/change-nickname.dto.ts | 4 +++- backend/src/workspaces/dto/create-workspace.dto.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/src/users/dto/change-nickname.dto.ts b/backend/src/users/dto/change-nickname.dto.ts index ee610194..fa089c90 100644 --- a/backend/src/users/dto/change-nickname.dto.ts +++ b/backend/src/users/dto/change-nickname.dto.ts @@ -1,6 +1,8 @@ import { ApiProperty } from "@nestjs/swagger"; +import { MinLength } from "class-validator"; export class ChangeNicknameDto { - @ApiProperty({ type: String, description: "Nickname of user to update" }) + @ApiProperty({ type: String, description: "Nickname of user to update", minLength: 2 }) + @MinLength(2) nickname: string; } diff --git a/backend/src/workspaces/dto/create-workspace.dto.ts b/backend/src/workspaces/dto/create-workspace.dto.ts index 2397bf18..c8c57a35 100644 --- a/backend/src/workspaces/dto/create-workspace.dto.ts +++ b/backend/src/workspaces/dto/create-workspace.dto.ts @@ -1,6 +1,8 @@ import { ApiProperty } from "@nestjs/swagger"; +import { MinLength } from "class-validator"; export class CreateWorkspaceDto { - @ApiProperty({ description: "Title of project to create", type: String }) + @ApiProperty({ description: "Title of project to create", type: String, minLength: 2 }) + @MinLength(2) title: string; }