prefrences
This commit is contained in:
@@ -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' };
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user