fix(comment): Create proper DTO class for comment creation
- Create CreateCommentDto class with proper validation decorators - Update comment controller to use the DTO for request body - This resolves the global ValidationPipe rejection due to forbidNonWhitelisted - Set MaxLength to 50000 to match manual validation logic Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
import { IsString, MinLength } from 'class-validator';
|
||||
import {
|
||||
IsString,
|
||||
IsOptional,
|
||||
IsArray,
|
||||
MinLength,
|
||||
MaxLength,
|
||||
} from 'class-validator';
|
||||
|
||||
export class CreateCommentDto {
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
content!: string;
|
||||
@MaxLength(50000)
|
||||
content: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
files?: string[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user