add two new permissions for notif and order

This commit is contained in:
2026-02-26 17:22:15 +03:30
parent c608a8e159
commit 9a853af49d
3 changed files with 7 additions and 31 deletions
+5
View File
@@ -31,6 +31,9 @@ export enum Permission {
MANAGE_SCHEDULES = 'manage_schedules',
MANAGE_REPORTS = 'manage_reports',
MANAGE_CONTACTS = 'manage_contacts',
NEW_ORDER_NOTIFICATION='new_order_notification',
PAGER_NOTIFICATION='pager_notification'
}
/**
@@ -55,4 +58,6 @@ export const PermissionTitles: Record<Permission, string> = {
[Permission.MANAGE_SCHEDULES]: 'مدیریت برنامه‌ها',
[Permission.MANAGE_REPORTS]: 'مدیریت گزارشات',
[Permission.MANAGE_CONTACTS]: 'مدیریت تماس‌های کاربران',
[Permission.NEW_ORDER_NOTIFICATION]: "نوتیف سفارش جدید",
[Permission.PAGER_NOTIFICATION]: "نوتیف پیجر جدید"
};
@@ -58,7 +58,7 @@ export class OrderListeners {
// get admnin os restuaraant that have order permissuins
const admins = await this.adminService.findAdminsWithPermission(event.restaurantId, Permission.MANAGE_ORDERS);
const admins = await this.adminService.findAdminsWithPermission(event.restaurantId, Permission.NEW_ORDER_NOTIFICATION);
const recipients = admins.map(admin => ({
adminId: admin.id,
}));
@@ -118,35 +118,6 @@ export class OrderListeners {
);
}
// const restaurant = await this.RestaurantRepository.findOne(event.restaurantId);
// if (!restaurant) {
// this.logger.log(
// `Restaurant not found for order: ${event.orderId} for restaurant: ${event.restaurantId} and order number: ${event.orderNumber}`,
// );
// return;
// }
// const score = restaurant.score;
// if (!score) {
// this.logger.log(
// `Score not found for restaurant: ${event.restaurantId} and order number: ${event.orderNumber}`,
// );
// return;
// }
// increase score for user
// const order = await this.OrderRepository.findOne(event.orderId);
// if (!order) {
// this.logger.log(
// `Order not found for order: ${event.orderId} for restaurant: ${event.restaurantId} and order number: ${event.orderNumber}`,
// );
// return;
// }
// this.userService.createWalletTransaction(event.userId, event.restaurantId, {
// amount: order.subTotal,
// type: WalletTransactionType.CREDIT,
// reason: WalletTransactionReason.ORDER_COMPLETED_DEPOSIT,
// });
await this.notificationService.sendNotification({
restaurantId: event.restaurantId,
message: {
@@ -24,7 +24,7 @@ export class PagerListeners {
try {
this.logger.log(`Pager created event received: ${event.restaurantId}`);
// get admnin os restuaraant that have pager permissuins
const admins = await this.adminService.findAdminsWithPermission(event.restaurantId, Permission.MANAGE_PAGER);
const admins = await this.adminService.findAdminsWithPermission(event.restaurantId, Permission.PAGER_NOTIFICATION);
const recipients = admins.map(admin => ({
adminId: admin.id,
}));