prefrences

This commit is contained in:
2025-12-11 08:55:13 +03:30
parent bd72d00b76
commit 3957c9cdf1
2 changed files with 30 additions and 19 deletions
@@ -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;
}
@@ -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' };
// }
}