notification queue

This commit is contained in:
2025-12-13 23:26:07 +03:30
parent 835f2a3853
commit befa311e98
20 changed files with 176 additions and 405 deletions
+9 -10
View File
@@ -20,8 +20,7 @@ import { OrderRepository } from '../repositories/order.repository';
import { FindOrdersDto } from '../dto/find-orders.dto';
import { PaginatedResult } from 'src/common/interfaces/pagination.interface';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { OrderCreatedEvent, OrderPaymentSuccessEvent } from '../../notifications/events/notification.events';
@Injectable()
export class OrdersService {
private readonly logger = new Logger(OrdersService.name);
@@ -49,14 +48,14 @@ export class OrdersService {
await this.cartService.clearCart(userId, restaurantId);
this.eventEmitter2.emit(
OrderCreatedEvent.name,
new OrderCreatedEvent(restaurantId, order.user.id, order.id, order.total),
);
this.eventEmitter2.emit(
OrderPaymentSuccessEvent.name,
new OrderPaymentSuccessEvent(restaurantId, order.user.id, order.id, order.total),
);
// this.eventEmitter2.emit(
// OrderCreatedEvent.name,
// new OrderCreatedEvent(restaurantId, order.user.id, order.id, order.total),
// );
// this.eventEmitter2.emit(
// OrderPaymentSuccessEvent.name,
// new OrderPaymentSuccessEvent(restaurantId, order.user.id, order.id, order.total),
// );
console.log('Order created event emitted 111');
return { order, paymentUrl };
}