mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
refactor: branches and warehouses to nestjs
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { IBillCreatingPayload, IBillEditingPayload } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class BillBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.bill.onCreating,
|
||||
// this.validateBranchExistanceOnBillCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.bill.onEditing,
|
||||
// this.validateBranchExistanceOnBillEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on estimate creating.
|
||||
// * @param {ISaleEstimateCreatedPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnBillCreating = async ({
|
||||
// tenantId,
|
||||
// billDTO,
|
||||
// }: IBillCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// billDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once estimate editing.
|
||||
// * @param {ISaleEstimateEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnBillEditing = async ({
|
||||
// billDTO,
|
||||
// tenantId,
|
||||
// }: IBillEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// billDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,35 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { ICommandCashflowCreatingPayload } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class CashflowBranchDTOValidatorSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.cashflow.onTransactionCreating,
|
||||
// this.validateBranchExistanceOnCashflowTransactionCreating
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once cashflow transaction creating.
|
||||
// * @param {ICommandCashflowCreatingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCashflowTransactionCreating = async ({
|
||||
// tenantId,
|
||||
// newTransactionDTO,
|
||||
// }: ICommandCashflowCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// newTransactionDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,104 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// ICustomerEventCreatingPayload,
|
||||
// ICustomerOpeningBalanceEditingPayload,
|
||||
// IVendorEventCreatingPayload,
|
||||
// IVendorOpeningBalanceEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class ContactBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.customers.onCreating,
|
||||
// this.validateBranchExistanceOnCustomerCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.customers.onOpeningBalanceChanging,
|
||||
// this.validateBranchExistanceOnCustomerOpeningBalanceEditing
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.vendors.onCreating,
|
||||
// this.validateBranchExistanceonVendorCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.vendors.onOpeningBalanceChanging,
|
||||
// this.validateBranchExistanceOnVendorOpeningBalanceEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on customer creating.
|
||||
// * @param {ICustomerEventCreatingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCustomerCreating = async ({
|
||||
// tenantId,
|
||||
// customerDTO,
|
||||
// }: ICustomerEventCreatingPayload) => {
|
||||
// // Can't continue if the customer opening balance is zero.
|
||||
// if (!customerDTO.openingBalance) return;
|
||||
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// customerDTO.openingBalanceBranchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once customer opening balance editing.
|
||||
// * @param {ICustomerOpeningBalanceEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCustomerOpeningBalanceEditing = async ({
|
||||
// openingBalanceEditDTO,
|
||||
// tenantId,
|
||||
// }: ICustomerOpeningBalanceEditingPayload) => {
|
||||
// if (!openingBalanceEditDTO.openingBalance) return;
|
||||
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// openingBalanceEditDTO.openingBalanceBranchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validates the branch existance on vendor creating.
|
||||
// * @param {IVendorEventCreatingPayload} payload -
|
||||
// */
|
||||
// private validateBranchExistanceonVendorCreating = async ({
|
||||
// vendorDTO,
|
||||
// tenantId,
|
||||
// }: IVendorEventCreatingPayload) => {
|
||||
// // Can't continue if the customer opening balance is zero.
|
||||
// if (!vendorDTO.openingBalance) return;
|
||||
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// vendorDTO.openingBalanceBranchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once the vendor opening balance editing.
|
||||
// * @param {IVendorOpeningBalanceEditingPayload}
|
||||
// */
|
||||
// private validateBranchExistanceOnVendorOpeningBalanceEditing = async ({
|
||||
// tenantId,
|
||||
// openingBalanceEditDTO,
|
||||
// }: IVendorOpeningBalanceEditingPayload) => {
|
||||
// if (!openingBalanceEditDTO.openingBalance) return;
|
||||
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// openingBalanceEditDTO.openingBalanceBranchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// ICreditNoteCreatingPayload,
|
||||
// ICreditNoteEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class CreditNoteBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onCreating,
|
||||
// this.validateBranchExistanceOnCreditCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onEditing,
|
||||
// this.validateBranchExistanceOnCreditEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on estimate creating.
|
||||
// * @param {ICreditNoteCreatingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCreditCreating = async ({
|
||||
// tenantId,
|
||||
// creditNoteDTO,
|
||||
// }: ICreditNoteCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// creditNoteDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once estimate editing.
|
||||
// * @param {ISaleEstimateEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCreditEditing = async ({
|
||||
// creditNoteEditDTO,
|
||||
// tenantId,
|
||||
// }: ICreditNoteEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// creditNoteEditDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,35 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { IRefundCreditNoteCreatingPayload } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class CreditNoteRefundBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onRefundCreating,
|
||||
// this.validateBranchExistanceOnCreditRefundCreating
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on refund credit note creating.
|
||||
// * @param {ICreditNoteCreatingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCreditRefundCreating = async ({
|
||||
// tenantId,
|
||||
// newCreditNoteDTO,
|
||||
// }: IRefundCreditNoteCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// newCreditNoteDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// IExpenseCreatingPayload,
|
||||
// IExpenseEventEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class ExpenseBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.expenses.onCreating,
|
||||
// this.validateBranchExistanceOnExpenseCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.expenses.onEditing,
|
||||
// this.validateBranchExistanceOnExpenseEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once expense transaction creating.
|
||||
// * @param {ISaleEstimateCreatedPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnExpenseCreating = async ({
|
||||
// tenantId,
|
||||
// expenseDTO,
|
||||
// }: IExpenseCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// expenseDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once expense transaction editing.
|
||||
// * @param {ISaleEstimateEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnExpenseEditing = async ({
|
||||
// expenseDTO,
|
||||
// tenantId,
|
||||
// }: IExpenseEventEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// expenseDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,35 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { IInventoryAdjustmentCreatingPayload } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class InventoryAdjustmentBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.inventoryAdjustment.onQuickCreating,
|
||||
// this.validateBranchExistanceOnInventoryCreating
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on invoice creating.
|
||||
// * @param {ISaleInvoiceCreatingPaylaod} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnInventoryCreating = async ({
|
||||
// tenantId,
|
||||
// quickAdjustmentDTO,
|
||||
// }: IInventoryAdjustmentCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// quickAdjustmentDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// ISaleInvoiceCreatingPaylaod,
|
||||
// ISaleInvoiceEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class InvoiceBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.saleInvoice.onCreating,
|
||||
// this.validateBranchExistanceOnInvoiceCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.saleInvoice.onEditing,
|
||||
// this.validateBranchExistanceOnInvoiceEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on invoice creating.
|
||||
// * @param {ISaleInvoiceCreatingPaylaod} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnInvoiceCreating = async ({
|
||||
// tenantId,
|
||||
// saleInvoiceDTO,
|
||||
// }: ISaleInvoiceCreatingPaylaod) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// saleInvoiceDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once invoice editing.
|
||||
// * @param {ISaleInvoiceEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnInvoiceEditing = async ({
|
||||
// saleInvoiceDTO,
|
||||
// tenantId,
|
||||
// }: ISaleInvoiceEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// saleInvoiceDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,76 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// Features,
|
||||
// IManualJournalCreatingPayload,
|
||||
// IManualJournalEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ManualJournalBranchesValidator } from '../../Integrations/ManualJournals/ManualJournalsBranchesValidator';
|
||||
// import { FeaturesManager } from '@/services/Features/FeaturesManager';
|
||||
|
||||
// @Service()
|
||||
// export class ManualJournalBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateManualJournalBranch: ManualJournalBranchesValidator;
|
||||
|
||||
// @Inject()
|
||||
// private featuresManager: FeaturesManager;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.manualJournals.onCreating,
|
||||
// this.validateBranchExistanceOnBillCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.manualJournals.onEditing,
|
||||
// this.validateBranchExistanceOnBillEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on estimate creating.
|
||||
// * @param {IManualJournalCreatingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnBillCreating = async ({
|
||||
// manualJournalDTO,
|
||||
// tenantId,
|
||||
// }: IManualJournalCreatingPayload) => {
|
||||
// // Detarmines whether the multi-branches is accessible by tenant.
|
||||
// const isAccessible = await this.featuresManager.accessible(
|
||||
// tenantId,
|
||||
// Features.BRANCHES
|
||||
// );
|
||||
// // Can't continue if the multi-branches feature is inactive.
|
||||
// if (!isAccessible) return;
|
||||
|
||||
// // Validates the entries whether have branch id.
|
||||
// await this.validateManualJournalBranch.validateEntriesHasBranchId(
|
||||
// manualJournalDTO
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once estimate editing.
|
||||
// * @param {ISaleEstimateEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnBillEditing = async ({
|
||||
// tenantId,
|
||||
// manualJournalDTO,
|
||||
// }: IManualJournalEditingPayload) => {
|
||||
// // Detarmines whether the multi-branches is accessible by tenant.
|
||||
// const isAccessible = await this.featuresManager.accessible(
|
||||
// tenantId,
|
||||
// Features.BRANCHES
|
||||
// );
|
||||
// // Can't continue if the multi-branches feature is inactive.
|
||||
// if (!isAccessible) return;
|
||||
|
||||
// await this.validateManualJournalBranch.validateEntriesHasBranchId(
|
||||
// manualJournalDTO
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// IBillPaymentCreatingPayload,
|
||||
// IBillPaymentEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class PaymentMadeBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.billPayment.onCreating,
|
||||
// this.validateBranchExistanceOnPaymentCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.billPayment.onEditing,
|
||||
// this.validateBranchExistanceOnPaymentEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on estimate creating.
|
||||
// * @param {ISaleEstimateCreatedPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnPaymentCreating = async ({
|
||||
// tenantId,
|
||||
// billPaymentDTO,
|
||||
// }: IBillPaymentCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// billPaymentDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once estimate editing.
|
||||
// * @param {ISaleEstimateEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnPaymentEditing = async ({
|
||||
// billPaymentDTO,
|
||||
// tenantId,
|
||||
// }: IBillPaymentEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// billPaymentDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// IPaymentReceivedCreatingPayload,
|
||||
// IPaymentReceivedEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class PaymentReceiveBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.paymentReceive.onCreating,
|
||||
// this.validateBranchExistanceOnPaymentCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.paymentReceive.onEditing,
|
||||
// this.validateBranchExistanceOnPaymentEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on estimate creating.
|
||||
// * @param {IPaymentReceivedCreatingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnPaymentCreating = async ({
|
||||
// tenantId,
|
||||
// paymentReceiveDTO,
|
||||
// }: IPaymentReceivedCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// paymentReceiveDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once estimate editing.
|
||||
// * @param {IPaymentReceivedEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnPaymentEditing = async ({
|
||||
// paymentReceiveDTO,
|
||||
// tenantId,
|
||||
// }: IPaymentReceivedEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// paymentReceiveDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// ISaleEstimateCreatingPayload,
|
||||
// ISaleEstimateEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class SaleEstimateBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.saleEstimate.onCreating,
|
||||
// this.validateBranchExistanceOnEstimateCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.saleEstimate.onEditing,
|
||||
// this.validateBranchExistanceOnEstimateEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on estimate creating.
|
||||
// * @param {ISaleEstimateCreatedPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnEstimateCreating = async ({
|
||||
// tenantId,
|
||||
// estimateDTO,
|
||||
// }: ISaleEstimateCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// estimateDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once estimate editing.
|
||||
// * @param {ISaleEstimateEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnEstimateEditing = async ({
|
||||
// estimateDTO,
|
||||
// tenantId,
|
||||
// }: ISaleEstimateEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// estimateDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// ISaleReceiptCreatingPayload,
|
||||
// ISaleReceiptEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class SaleReceiptBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.saleReceipt.onCreating,
|
||||
// this.validateBranchExistanceOnInvoiceCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.saleReceipt.onEditing,
|
||||
// this.validateBranchExistanceOnInvoiceEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on estimate creating.
|
||||
// * @param {ISaleReceiptCreatingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnInvoiceCreating = async ({
|
||||
// tenantId,
|
||||
// saleReceiptDTO,
|
||||
// }: ISaleReceiptCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// saleReceiptDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once estimate editing.
|
||||
// * @param {ISaleReceiptEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnInvoiceEditing = async ({
|
||||
// saleReceiptDTO,
|
||||
// tenantId,
|
||||
// }: ISaleReceiptEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// saleReceiptDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// IVendorCreditCreatingPayload,
|
||||
// IVendorCreditEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class VendorCreditBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.vendorCredit.onCreating,
|
||||
// this.validateBranchExistanceOnCreditCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.vendorCredit.onEditing,
|
||||
// this.validateBranchExistanceOnCreditEditing
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on estimate creating.
|
||||
// * @param {ISaleEstimateCreatedPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCreditCreating = async ({
|
||||
// tenantId,
|
||||
// vendorCreditCreateDTO,
|
||||
// }: IVendorCreditCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// vendorCreditCreateDTO.branchId
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance once estimate editing.
|
||||
// * @param {ISaleEstimateEditingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCreditEditing = async ({
|
||||
// vendorCreditDTO,
|
||||
// tenantId,
|
||||
// }: IVendorCreditEditingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// vendorCreditDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,35 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { IRefundVendorCreditCreatingPayload } from '@/interfaces';
|
||||
// import { ValidateBranchExistance } from '../../Integrations/ValidateBranchExistance';
|
||||
|
||||
// @Service()
|
||||
// export class VendorCreditRefundBranchValidateSubscriber {
|
||||
// @Inject()
|
||||
// private validateBranchExistance: ValidateBranchExistance;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach = (bus) => {
|
||||
// bus.subscribe(
|
||||
// events.vendorCredit.onRefundCreating,
|
||||
// this.validateBranchExistanceOnCreditRefundCreating
|
||||
// );
|
||||
// return bus;
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate branch existance on refund credit note creating.
|
||||
// * @param {IRefundVendorCreditCreatingPayload} payload
|
||||
// */
|
||||
// private validateBranchExistanceOnCreditRefundCreating = async ({
|
||||
// tenantId,
|
||||
// refundVendorCreditDTO,
|
||||
// }: IRefundVendorCreditCreatingPayload) => {
|
||||
// await this.validateBranchExistance.validateTransactionBranchWhenActive(
|
||||
// tenantId,
|
||||
// refundVendorCreditDTO.branchId
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,15 @@
|
||||
export * from './BillBranchSubscriber';
|
||||
export * from './CashflowBranchDTOValidatorSubscriber';
|
||||
export * from './CreditNoteBranchesSubscriber';
|
||||
export * from './CreditNoteRefundBranchSubscriber';
|
||||
export * from './ExpenseBranchSubscriber';
|
||||
export * from './ManualJournalBranchSubscriber';
|
||||
export * from './PaymentMadeBranchSubscriber';
|
||||
export * from './PaymentReceiveBranchSubscriber';
|
||||
export * from './SaleEstimateMultiBranchesSubscriber';
|
||||
export * from './SaleReceiptBranchesSubscriber';
|
||||
export * from './VendorCreditBranchSubscriber';
|
||||
export * from './VendorCreditRefundBranchSubscriber';
|
||||
export * from './InvoiceBranchValidatorSubscriber';
|
||||
export * from './ContactOpeningBalanceBranchSubscriber';
|
||||
export * from './InventoryAdjustmentBranchValidatorSubscriber';
|
||||
Reference in New Issue
Block a user