notification
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { IsString, IsNotEmpty, IsBoolean, IsObject, IsOptional, ValidateNested } from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
class ChannelsDto {
|
||||
@ApiPropertyOptional({ description: 'Enable SMS channel' })
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
sms?: boolean;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Enable push notification channel' })
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
push?: boolean;
|
||||
}
|
||||
|
||||
export class CreateNotificationPreferenceDto {
|
||||
@ApiProperty({ description: 'Notification type (e.g., ORDER_CONFIRMED, PAYMENT_FAILED)' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
notificationType: string;
|
||||
|
||||
@ApiProperty({ description: 'Notification channels configuration', type: ChannelsDto })
|
||||
@ValidateNested()
|
||||
@Type(() => ChannelsDto)
|
||||
@IsObject()
|
||||
@IsNotEmpty()
|
||||
channels: ChannelsDto;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Whether the preference is enabled', default: true })
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user