feat(nestjs): migrate to NestJS

This commit is contained in:
Ahmed Bouhuolia
2025-04-07 11:51:24 +02:00
parent f068218a16
commit 55fcc908ef
3779 changed files with 631 additions and 195332 deletions

View File

@@ -0,0 +1,41 @@
import {
IPaymentReceivedCreatingPayload,
IPaymentReceivedEditingPayload,
} from '@/modules/PaymentReceived/types/PaymentReceived.types';
import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
import { OnEvent } from '@nestjs/event-emitter';
import { Injectable } from '@nestjs/common';
import { events } from '@/common/events/events';
@Injectable()
export class PaymentReceiveBranchValidateSubscriber {
constructor(
private readonly validateBranchExistance: ValidateBranchExistance,
) {}
/**
* Validate branch existance on estimate creating.
* @param {IPaymentReceivedCreatingPayload} payload
*/
@OnEvent(events.paymentReceive.onCreating)
async validateBranchExistanceOnPaymentCreating({
paymentReceiveDTO,
}: IPaymentReceivedCreatingPayload) {
await this.validateBranchExistance.validateTransactionBranchWhenActive(
paymentReceiveDTO.branchId,
);
}
/**
* Validate branch existance once estimate editing.
* @param {IPaymentReceivedEditingPayload} payload
*/
@OnEvent(events.paymentReceive.onEditing)
async validateBranchExistanceOnPaymentEditing({
paymentReceiveDTO,
}: IPaymentReceivedEditingPayload) {
await this.validateBranchExistance.validateTransactionBranchWhenActive(
paymentReceiveDTO.branchId,
);
}
}