mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 09:00:57 +00:00
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { IsString, IsEnum, IsOptional, IsArray } from 'class-validator';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
export enum NotificationCategoryEnum {
|
|
BOOKING = 'BOOKING',
|
|
PAYMENT = 'PAYMENT',
|
|
DISRUPTION = 'DISRUPTION',
|
|
PROMOTION = 'PROMOTION',
|
|
SYSTEM = 'SYSTEM',
|
|
}
|
|
|
|
export class SendNotificationDto {
|
|
@ApiProperty() @IsString() passengerId: string;
|
|
@ApiProperty({ example: 'Platform Change' }) @IsString() title: string;
|
|
@ApiProperty({ example: 'Your train departs from Platform 3' }) @IsString() body: string;
|
|
@ApiProperty({ enum: NotificationCategoryEnum }) @IsEnum(NotificationCategoryEnum) category: NotificationCategoryEnum;
|
|
@ApiPropertyOptional({ example: 'edr://tickets/tkt_01' }) @IsOptional() @IsString() deepLink?: string;
|
|
@ApiPropertyOptional() @IsOptional() metadata?: Record<string, any>;
|
|
}
|
|
|
|
export class TestNotificationDto {
|
|
@ApiProperty({ example: 'booking.created' })
|
|
@IsString()
|
|
templateKey: string;
|
|
|
|
@ApiProperty({ example: 'user@example.com' })
|
|
@IsString()
|
|
recipient: string;
|
|
|
|
@ApiProperty({ example: { bookingRef: 'EDR123456', passengerName: 'John Doe' } })
|
|
context: Record<string, unknown>;
|
|
|
|
@ApiPropertyOptional({ example: ['EMAIL', 'SMS', 'IN_APP'] })
|
|
@IsOptional()
|
|
@IsArray()
|
|
channels?: string[];
|
|
}
|