From 6f447d909f565c50099b2f9b22ab4011944b9360 Mon Sep 17 00:00:00 2001 From: violet-dev Date: Sun, 8 Sep 2024 08:38:10 +0900 Subject: [PATCH] Limit post comment contents length --- violet-server/src/comment/dtos/comment-post.dto.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/violet-server/src/comment/dtos/comment-post.dto.ts b/violet-server/src/comment/dtos/comment-post.dto.ts index 485905343..4be7fe0a4 100644 --- a/violet-server/src/comment/dtos/comment-post.dto.ts +++ b/violet-server/src/comment/dtos/comment-post.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; -import { IsString, Matches } from 'class-validator'; +import { IsString, Matches, MaxLength } from 'class-validator'; export class CommentPostDto { @IsString() @@ -10,6 +10,7 @@ export class CommentPostDto { }) @Type(() => String) @Matches(`^(general|\d+)$`, 'i') + @MaxLength(20) where: string; @IsString() @@ -18,6 +19,7 @@ export class CommentPostDto { required: true, }) @Type(() => String) + @MaxLength(500) body: string; @IsString()