Files
dmenu-api/src/modules/notifications/dto/send-notification.dto.ts
T
2025-12-08 22:04:01 +03:30

39 lines
1022 B
TypeScript

import { IsString, IsNotEmpty, IsOptional, IsObject } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class SendNotificationDto {
@ApiProperty({ description: 'Restaurant ID (ULID)' })
@IsString()
@IsNotEmpty()
restaurantId: string;
@ApiPropertyOptional({ description: 'User ID (ULID)' })
@IsString()
@IsOptional()
userId?: string;
@ApiProperty({ description: 'Notification type (e.g., ORDER_CONFIRMED, PAYMENT_FAILED)' })
@IsString()
@IsNotEmpty()
notificationType: string;
@ApiProperty({ description: 'Notification payload' })
@IsObject()
@IsNotEmpty()
payload: {
title?: string;
message: string;
body?: string;
phoneNumber?: string;
pushToken?: string;
data?: Record<string, any>;
templateId?: string;
parameters?: Array<{ name: string; value: string }>;
};
@ApiPropertyOptional({ description: 'Idempotency key to prevent duplicates' })
@IsString()
@IsOptional()
idempotencyKey?: string;
}