notification
This commit is contained in:
@@ -7,12 +7,12 @@ 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 { NotificationTitleEnum } from '../interfaces/notification.interface';
|
||||
import { NotifTitleEnum } from '../interfaces/notification.interface';
|
||||
|
||||
export interface SendNotificationParams {
|
||||
restaurantId: string;
|
||||
userId?: string;
|
||||
title: NotificationTitleEnum;
|
||||
title: NotifTitleEnum;
|
||||
content: string;
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export class NotificationService {
|
||||
}
|
||||
|
||||
// Generate idempotency key if not provided
|
||||
const finalIdempotencyKey = idempotencyKey || `${restaurantId}-${title}-${Date.now()}`;
|
||||
// const finalIdempotencyKey = idempotencyKey || `${restaurantId}-${title}-${Date.now()}`;
|
||||
|
||||
// Create notification record
|
||||
const user = userId ? await this.em.findOne(User, { id: userId }) : undefined;
|
||||
@@ -69,7 +69,7 @@ export class NotificationService {
|
||||
userId,
|
||||
title,
|
||||
content,
|
||||
idempotencyKey: finalIdempotencyKey,
|
||||
// idempotencyKey: finalIdempotencyKey,
|
||||
notificationId: notification.id,
|
||||
notificationType: preference.notificationType,
|
||||
};
|
||||
@@ -126,11 +126,7 @@ export class NotificationService {
|
||||
await this.em.removeAndFlush(notification as any);
|
||||
}
|
||||
|
||||
async findByRestaurantAndType(
|
||||
restaurantId: string,
|
||||
title: NotificationTitleEnum,
|
||||
limit = 50,
|
||||
): Promise<Notification[]> {
|
||||
async findByRestaurantAndType(restaurantId: string, title: NotifTitleEnum, limit = 50): Promise<Notification[]> {
|
||||
return this.em.find(
|
||||
Notification,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user