update notif

This commit is contained in:
2025-12-12 20:13:18 +03:30
parent 3c3e5797e5
commit ecb68de7b3
10 changed files with 255 additions and 330 deletions
@@ -6,8 +6,7 @@ import { NotificationQueueService } from './notification-queue.service';
import { NotificationQueueJob } from '../interfaces/notification-queue.interface';
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
import { User } from '../../users/entities/user.entity';
import { NotificationType } from '../interfaces/notification.interface';
import { NotifTitleEnum } from '../interfaces/notification.interface';
import { NotifTitleEnum } from '../interfaces/notification.interface';
export interface SendNotificationParams {
restaurantId: string;
@@ -28,7 +27,7 @@ export class NotificationService {
) {}
async sendNotification(params: SendNotificationParams): Promise<Notification> {
const { restaurantId, userId, title, content, idempotencyKey } = params;
const { restaurantId, userId, title, content } = params;
// Verify restaurant exists
const restaurant = await this.em.findOne(Restaurant, { id: restaurantId });
@@ -59,7 +58,7 @@ export class NotificationService {
await this.em.persistAndFlush(notification);
if (preference.notificationType === NotificationType.NONE) {
if (preference.channels.length === 0) {
this.logger.warn(`Notification type is NONE for restaurant ${restaurantId}, title ${title}`);
return notification;
}
@@ -71,7 +70,7 @@ export class NotificationService {
content,
// idempotencyKey: finalIdempotencyKey,
notificationId: notification.id,
notificationType: preference.notificationType,
channels: preference.channels,
};
// if (preference.notificationType === NotificationType.SMS) {
// await this.queueService.addSmsNotification(job);