Skip to content

Commit 4180548

Browse files
authored
Merge pull request #738 from Alt-Org/feature/validate-message-input-dto
Validate message content no longer than 64 characters
2 parents 18455fe + a2494ee commit 4180548

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/chat/dto/createMessage.dto.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
IsNotEmpty,
55
IsOptional,
66
IsString,
7+
MaxLength,
78
ValidateIf,
89
} from 'class-validator';
910
import { ChatType } from '../enum/chatMessageType.enum';
@@ -31,12 +32,14 @@ export class CreateChatMessageDto {
3132
sender_id: string | ObjectId;
3233

3334
/**
34-
* Text content of the message
35-
*
35+
* Text content of the message.
36+
* Content must not exceed 64 characters
37+
*
3638
* @example "Let’s meet at Soul Arena!"
3739
*/
3840
@IsString()
3941
@IsNotEmpty()
42+
@MaxLength(64)
4043
content: string;
4144

4245
/**

0 commit comments

Comments
 (0)