prefrences
This commit is contained in:
@@ -1,4 +1,15 @@
|
|||||||
import { PartialType } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { CreatePreferenceDto } from './create-preference.dto';
|
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
|
// Preference endpoints
|
||||||
@UseGuards(AdminAuthGuard)
|
// @UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
// @ApiBearerAuth()
|
||||||
@Post('admin/notification-preferences')
|
// @Post('admin/notification-preferences')
|
||||||
@ApiOperation({ summary: 'Create notification preference' })
|
// @ApiOperation({ summary: 'Create notification preference' })
|
||||||
createPreference(@RestId() restaurantId: string, @Body() dto: CreatePreferenceDto) {
|
// createPreference(@RestId() restaurantId: string, @Body() dto: CreatePreferenceDto) {
|
||||||
return this.preferenceService.createOrUpdate(restaurantId, dto);
|
// return this.preferenceService.createOrUpdate(restaurantId, dto);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@@ -158,13 +158,13 @@ export class NotificationsController {
|
|||||||
return this.preferenceService.updatePreference(preferenceId, restaurantId, dto);
|
return this.preferenceService.updatePreference(preferenceId, restaurantId, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
// @UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
// @ApiBearerAuth()
|
||||||
@Delete('admin/notification-preferences/:id')
|
// @Delete('admin/notification-preferences/:id')
|
||||||
@ApiOperation({ summary: 'Delete a notification preference' })
|
// @ApiOperation({ summary: 'Delete a notification preference' })
|
||||||
@ApiParam({ name: 'id', description: 'Notification preference ID' })
|
// @ApiParam({ name: 'id', description: 'Notification preference ID' })
|
||||||
async deletePreference(@RestId() restaurantId: string, @Param('id') preferenceId: string) {
|
// async deletePreference(@RestId() restaurantId: string, @Param('id') preferenceId: string) {
|
||||||
await this.preferenceService.delete(restaurantId, preferenceId);
|
// await this.preferenceService.delete(restaurantId, preferenceId);
|
||||||
return { message: 'Preference deleted successfully' };
|
// return { message: 'Preference deleted successfully' };
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user