chore: add all notification sewrvice to the queue

This commit is contained in:
mahyargdz
2025-05-04 16:06:14 +03:30
parent d50b18b8aa
commit c3ad2a1733
16 changed files with 539 additions and 277 deletions
@@ -9,7 +9,7 @@ import { DataSource, Not, QueryRunner } from "typeorm";
import { PaginationDto } from "../../../common/DTO/pagination.dto";
import { CommonMessage, PaymentMessage, UserMessage, WalletMessage } from "../../../common/enums/message.enum";
import { NotificationsService } from "../../notifications/providers/notifications.service";
import { NotificationQueue } from "../../notifications/queue/notification.queue";
import { ReferralRewardStatus } from "../../referrals/enums/referral-reward-status.enum";
import { ReferralStatus } from "../../referrals/enums/referral-status.enum";
import { ReferralsService } from "../../referrals/providers/referrals.service";
@@ -43,7 +43,7 @@ export class PaymentsService {
private readonly logger = new Logger(PaymentsService.name);
constructor(
@InjectQueue(PAYMENT.QUEUE_NAME) private readonly paymentQueue: Queue,
private readonly notificationsService: NotificationsService,
private readonly notificationQueue: NotificationQueue,
private readonly configService: ConfigService,
private readonly gatewayFactory: PaymentGatewayFactory,
private readonly paymentGatewaysRepository: PaymentGatewaysRepository,
@@ -185,18 +185,14 @@ export class PaymentsService {
const additionalParams: Record<string, string> = {};
//
await this.notificationsService.createWalletChargeNotification(
payment.user.id,
{
amount: new Decimal(payment.amount).toNumber(),
balance: new Decimal(wallet.balance).toNumber(),
date: payment.createdAt,
reason: WalletMessage.DEPOSIT_WALLET_IPG,
userPhone: payment.user.phone,
userEmail: payment.user.email,
},
queryRunner,
);
await this.notificationQueue.addWalletChargeNotification(payment.user.id, {
amount: new Decimal(payment.amount).toNumber(),
balance: new Decimal(wallet.balance).toNumber(),
date: payment.createdAt,
reason: WalletMessage.DEPOSIT_WALLET_IPG,
userPhone: payment.user.phone,
userEmail: payment.user.email,
});
return {
status: PaymentStatus.COMPLETED,