Skip to content

Commit

Permalink
Limit post comment contents length
Browse files Browse the repository at this point in the history
  • Loading branch information
violet-dev committed Sep 7, 2024
1 parent f339745 commit 6f447d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion violet-server/src/comment/dtos/comment-post.dto.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -10,6 +10,7 @@ export class CommentPostDto {
})
@Type(() => String)
@Matches(`^(general|\d+)$`, 'i')
@MaxLength(20)
where: string;

@IsString()
Expand All @@ -18,6 +19,7 @@ export class CommentPostDto {
required: true,
})
@Type(() => String)
@MaxLength(500)
body: string;

@IsString()
Expand Down

0 comments on commit 6f447d9

Please sign in to comment.