src/messages/dto/create-message.dto.ts
Properties |
| body |
Type : string
|
Decorators :
@ApiProperty({description: 'Message body — 1 to 5000 characters'})
|
|
Defined in src/messages/dto/create-message.dto.ts:48
|
|
Message body. Hard cap at 5000 characters — anything longer is almost certainly a paste of an entire log file or accidental upload, and would bloat the DB and slow every read of the conversation. The frontend mirrors this with a counter. |
| Optional driverId |
Type : string
|
Decorators :
@ApiPropertyOptional({description: 'Driver ID to send to (required for new threads, optional when replying)'})
|
|
Defined in src/messages/dto/create-message.dto.ts:20
|
| Optional priority |
Type : MessagePriority
|
Decorators :
@ApiPropertyOptional({enum: MessagePriority})
|
|
Defined in src/messages/dto/create-message.dto.ts:53
|
| Optional replyToId |
Type : string
|
Decorators :
@ApiPropertyOptional({description: 'Parent message ID — set this to reply to an existing message thread'})
|
|
Defined in src/messages/dto/create-message.dto.ts:27
|
| Optional subject |
Type : string
|
Decorators :
@ApiPropertyOptional({description: 'Subject line — max 200 characters'})
|
|
Defined in src/messages/dto/create-message.dto.ts:34
|
import {
IsNotEmpty,
IsString,
IsOptional,
IsEnum,
IsUUID,
MaxLength,
MinLength,
} from 'class-validator';
import { Transform } from 'class-transformer';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { MessagePriority } from '@prisma/client';
export class CreateMessageDto {
@ApiPropertyOptional({
description: 'Driver ID to send to (required for new threads, optional when replying)',
})
@IsOptional()
@IsUUID()
driverId?: string;
@ApiPropertyOptional({
description: 'Parent message ID — set this to reply to an existing message thread',
})
@IsOptional()
@IsUUID()
replyToId?: string;
@ApiPropertyOptional({ description: 'Subject line — max 200 characters' })
@IsOptional()
@IsString()
@MaxLength(200, { message: 'subject must be 200 characters or fewer' })
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
subject?: string;
/**
* Message body. Hard cap at 5000 characters — anything longer is
* almost certainly a paste of an entire log file or accidental
* upload, and would bloat the DB and slow every read of the
* conversation. The frontend mirrors this with a counter.
*/
@ApiProperty({ description: 'Message body — 1 to 5000 characters' })
@IsString()
@IsNotEmpty()
@MinLength(1)
@MaxLength(5000, { message: 'body must be 5000 characters or fewer' })
@Transform(({ value }) => (typeof value === 'string' ? value.trim() : value))
body: string;
@ApiPropertyOptional({ enum: MessagePriority })
@IsOptional()
@IsEnum(MessagePriority)
priority?: MessagePriority;
}