Skip to content

Commit 9d21fcd

Browse files
committed
fix: Add to field array support in DTO and Interface
1 parent f0a854c commit 9d21fcd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/services/message/message.dto.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
IsOptional,
55
IsObject,
66
ValidateNested,
7+
ArrayMaxSize,
78
} from 'class-validator'
89

910
class MediaDto {
@@ -18,8 +19,9 @@ class MediaDto {
1819

1920
export class SendMessageDto {
2021
@IsNotEmpty()
21-
@IsString()
22-
to: string
22+
@IsString({ each: true }) // Validates each element of the array to be a string
23+
@ArrayMaxSize(100) // Limit the array to a maximum of 100 elements
24+
to: string[]
2325

2426
@IsNotEmpty()
2527
@IsString()

src/types/message/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface Media {
77

88
export interface ISendMessage {
99
api_key: string
10-
to: string
10+
to: string | string[]
1111
from: string
1212
sms: string
1313
type: string

0 commit comments

Comments
 (0)