add server to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 11:57:50 +02:00
parent 28e309981b
commit 80b97b5fdc
1303 changed files with 137049 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import { IBranchesActivatedPayload } from '@/interfaces';
import { Service, Inject } from 'typedi';
import events from '@/subscribers/events';
import { CashflowTransactionsActivateBranches } from '../../Integrations/Cashflow/CashflowActivateBranches';
@Service()
export class CreditNoteActivateBranchesSubscriber {
@Inject()
private cashflowActivateBranches: CashflowTransactionsActivateBranches;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(
events.branch.onActivated,
this.updateCashflowWithBranchOnActivated
);
return bus;
}
/**
* Updates accounts transactions with the primary branch once
* the multi-branches is activated.
* @param {IBranchesActivatedPayload}
*/
private updateCashflowWithBranchOnActivated = async ({
tenantId,
primaryBranch,
trx,
}: IBranchesActivatedPayload) => {
await this.cashflowActivateBranches.updateCashflowTransactionsWithBranch(
tenantId,
primaryBranch.id,
trx
);
};
}

View File

@@ -0,0 +1,38 @@
import { IBranchesActivatedPayload } from '@/interfaces';
import { Service, Inject } from 'typedi';
import { CreditNoteActivateBranches } from '../../Integrations/Sales/CreditNoteBranchesActivate';
import events from '@/subscribers/events';
@Service()
export class CreditNoteActivateBranchesSubscriber {
@Inject()
private creditNotesActivateBranches: CreditNoteActivateBranches;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(
events.branch.onActivated,
this.updateCreditNoteWithBranchOnActivated
);
return bus;
}
/**
* Updates accounts transactions with the primary branch once
* the multi-branches is activated.
* @param {IBranchesActivatedPayload}
*/
private updateCreditNoteWithBranchOnActivated = async ({
tenantId,
primaryBranch,
trx,
}: IBranchesActivatedPayload) => {
await this.creditNotesActivateBranches.updateCreditsWithBranch(
tenantId,
primaryBranch.id,
trx
);
};
}

View File

@@ -0,0 +1,38 @@
import { IBranchesActivatedPayload } from '@/interfaces';
import { Service, Inject } from 'typedi';
import events from '@/subscribers/events';
import { ExpensesActivateBranches } from '../../Integrations/Expense/ExpensesActivateBranches';
@Service()
export class ExpenseActivateBranchesSubscriber {
@Inject()
private expensesActivateBranches: ExpensesActivateBranches;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(
events.branch.onActivated,
this.updateExpensesWithBranchOnActivated
);
return bus;
}
/**
* Updates accounts transactions with the primary branch once
* the multi-branches is activated.
* @param {IBranchesActivatedPayload}
*/
private updateExpensesWithBranchOnActivated = async ({
tenantId,
primaryBranch,
trx,
}: IBranchesActivatedPayload) => {
await this.expensesActivateBranches.updateExpensesWithBranch(
tenantId,
primaryBranch.id,
trx
);
};
}

View File

@@ -0,0 +1,38 @@
import { IBranchesActivatedPayload } from '@/interfaces';
import { Service, Inject } from 'typedi';
import events from '@/subscribers/events';
import { BillPaymentsActivateBranches } from '../../Integrations/Purchases/PaymentMadeBranchesActivate';
@Service()
export class PaymentMadeActivateBranchesSubscriber {
@Inject()
private paymentsActivateBranches: BillPaymentsActivateBranches;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(
events.branch.onActivated,
this.updatePaymentsWithBranchOnActivated
);
return bus;
}
/**
* Updates accounts transactions with the primary branch once
* the multi-branches is activated.
* @param {IBranchesActivatedPayload}
*/
private updatePaymentsWithBranchOnActivated = async ({
tenantId,
primaryBranch,
trx,
}: IBranchesActivatedPayload) => {
await this.paymentsActivateBranches.updateBillPaymentsWithBranch(
tenantId,
primaryBranch.id,
trx
);
};
}

View File

@@ -0,0 +1,38 @@
import { IBranchesActivatedPayload } from '@/interfaces';
import { Service, Inject } from 'typedi';
import events from '@/subscribers/events';
import { PaymentReceiveActivateBranches } from '../../Integrations/Sales/PaymentReceiveBranchesActivate';
@Service()
export class PaymentReceiveActivateBranchesSubscriber {
@Inject()
private paymentsActivateBranches: PaymentReceiveActivateBranches;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(
events.branch.onActivated,
this.updateCreditNoteWithBranchOnActivated
);
return bus;
}
/**
* Updates accounts transactions with the primary branch once
* the multi-branches is activated.
* @param {IBranchesActivatedPayload}
*/
private updateCreditNoteWithBranchOnActivated = async ({
tenantId,
primaryBranch,
trx,
}: IBranchesActivatedPayload) => {
await this.paymentsActivateBranches.updatePaymentsWithBranch(
tenantId,
primaryBranch.id,
trx
);
};
}

View File

@@ -0,0 +1,38 @@
import { IBranchesActivatedPayload } from '@/interfaces';
import { Service, Inject } from 'typedi';
import events from '@/subscribers/events';
import { SaleEstimateActivateBranches } from '../../Integrations/Sales/SaleEstimatesBranchesActivate';
@Service()
export class SaleEstimatesActivateBranchesSubscriber {
@Inject()
private estimatesActivateBranches: SaleEstimateActivateBranches;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(
events.branch.onActivated,
this.updateEstimatesWithBranchOnActivated
);
return bus;
}
/**
* Updates accounts transactions with the primary branch once
* the multi-branches is activated.
* @param {IBranchesActivatedPayload}
*/
private updateEstimatesWithBranchOnActivated = async ({
tenantId,
primaryBranch,
trx,
}: IBranchesActivatedPayload) => {
await this.estimatesActivateBranches.updateEstimatesWithBranch(
tenantId,
primaryBranch.id,
trx
);
};
}

View File

@@ -0,0 +1,38 @@
import { IBranchesActivatedPayload } from '@/interfaces';
import { Service, Inject } from 'typedi';
import events from '@/subscribers/events';
import { SaleInvoiceActivateBranches } from '../../Integrations/Sales/SaleInvoiceBranchesActivate';
@Service()
export class SaleInvoicesActivateBranchesSubscriber {
@Inject()
private invoicesActivateBranches: SaleInvoiceActivateBranches;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(
events.branch.onActivated,
this.updateInvoicesWithBranchOnActivated
);
return bus;
}
/**
* Updates accounts transactions with the primary branch once
* the multi-branches is activated.
* @param {IBranchesActivatedPayload}
*/
private updateInvoicesWithBranchOnActivated = async ({
tenantId,
primaryBranch,
trx,
}: IBranchesActivatedPayload) => {
await this.invoicesActivateBranches.updateInvoicesWithBranch(
tenantId,
primaryBranch.id,
trx
);
};
}

View File

@@ -0,0 +1,38 @@
import { IBranchesActivatedPayload } from '@/interfaces';
import { Service, Inject } from 'typedi';
import events from '@/subscribers/events';
import { SaleReceiptActivateBranches } from '../../Integrations/Sales/SaleReceiptBranchesActivate';
@Service()
export class SaleReceiptsActivateBranchesSubscriber {
@Inject()
private receiptsActivateBranches: SaleReceiptActivateBranches;
/**
* Attaches events with handlers.
*/
public attach(bus) {
bus.subscribe(
events.branch.onActivated,
this.updateReceiptsWithBranchOnActivated
);
return bus;
}
/**
* Updates accounts transactions with the primary branch once
* the multi-branches is activated.
* @param {IBranchesActivatedPayload}
*/
private updateReceiptsWithBranchOnActivated = async ({
tenantId,
primaryBranch,
trx,
}: IBranchesActivatedPayload) => {
await this.receiptsActivateBranches.updateReceiptsWithBranch(
tenantId,
primaryBranch.id,
trx
);
};
}

View File

@@ -0,0 +1,8 @@
export * from './CashflowBranchesActviateSubscriber';
export * from './CreditNoteBranchesActivateSubscriber';
export * from './PaymentMadeBranchesActivateSubscriber';
export * from './PaymentReceiveBranchesActivateSubscriber';
export * from './SaleReceiptsBranchesActivateSubscriber';
export * from './SaleEstiamtesBranchesActivateSubscriber';
export * from './SaleInvoiceBranchesActivateSubscriber';
export * from './ExpenseBranchesActivateSubscriber';