diff --git a/src/modules/notifications/dto/update-preference.dto.ts b/src/modules/notifications/dto/update-preference.dto.ts index dbf2672..7e1193d 100644 --- a/src/modules/notifications/dto/update-preference.dto.ts +++ b/src/modules/notifications/dto/update-preference.dto.ts @@ -1,4 +1,15 @@ -import { PartialType } from '@nestjs/swagger'; -import { CreatePreferenceDto } from './create-preference.dto'; +import { ApiProperty } from '@nestjs/swagger'; +import { NotificationType } from '../interfaces/notification.interface'; +import { IsNotEmpty } from 'class-validator'; +import { IsEnum } from 'class-validator'; -export class UpdatePreferenceDto extends PartialType(CreatePreferenceDto) {} +export class UpdatePreferenceDto { + @ApiProperty({ + description: 'Notification type (SMS, PUSH, BOTH, or NONE)', + enum: NotificationType, + example: NotificationType.SMS, + }) + @IsEnum(NotificationType) + @IsNotEmpty() + notificationType!: NotificationType; +} diff --git a/src/modules/notifications/notifications.controller.ts b/src/modules/notifications/notifications.controller.ts index 1d44d0f..ea5766f 100644 --- a/src/modules/notifications/notifications.controller.ts +++ b/src/modules/notifications/notifications.controller.ts @@ -107,13 +107,13 @@ export class NotificationsController { // } // Preference endpoints - @UseGuards(AdminAuthGuard) - @ApiBearerAuth() - @Post('admin/notification-preferences') - @ApiOperation({ summary: 'Create notification preference' }) - createPreference(@RestId() restaurantId: string, @Body() dto: CreatePreferenceDto) { - return this.preferenceService.createOrUpdate(restaurantId, dto); - } + // @UseGuards(AdminAuthGuard) + // @ApiBearerAuth() + // @Post('admin/notification-preferences') + // @ApiOperation({ summary: 'Create notification preference' }) + // createPreference(@RestId() restaurantId: string, @Body() dto: CreatePreferenceDto) { + // return this.preferenceService.createOrUpdate(restaurantId, dto); + // } @UseGuards(AdminAuthGuard) @ApiBearerAuth() @@ -158,13 +158,13 @@ export class NotificationsController { return this.preferenceService.updatePreference(preferenceId, restaurantId, dto); } - @UseGuards(AdminAuthGuard) - @ApiBearerAuth() - @Delete('admin/notification-preferences/:id') - @ApiOperation({ summary: 'Delete a notification preference' }) - @ApiParam({ name: 'id', description: 'Notification preference ID' }) - async deletePreference(@RestId() restaurantId: string, @Param('id') preferenceId: string) { - await this.preferenceService.delete(restaurantId, preferenceId); - return { message: 'Preference deleted successfully' }; - } + // @UseGuards(AdminAuthGuard) + // @ApiBearerAuth() + // @Delete('admin/notification-preferences/:id') + // @ApiOperation({ summary: 'Delete a notification preference' }) + // @ApiParam({ name: 'id', description: 'Notification preference ID' }) + // async deletePreference(@RestId() restaurantId: string, @Param('id') preferenceId: string) { + // await this.preferenceService.delete(restaurantId, preferenceId); + // return { message: 'Preference deleted successfully' }; + // } }