mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
add server to monorepo.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { IWarehousesActivatedPayload } from '@/interfaces';
|
||||
import events from '@/subscribers/events';
|
||||
import { BillActivateWarehouses } from '../../Activate/BillWarehousesActivate';
|
||||
|
||||
@Service()
|
||||
export class BillsActivateWarehousesSubscriber {
|
||||
@Inject()
|
||||
private billsActivateWarehouses: BillActivateWarehouses;
|
||||
|
||||
/**
|
||||
* Attaches events with handlers.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.warehouse.onActivated,
|
||||
this.updateBillsWithWarehouseOnActivated
|
||||
);
|
||||
return bus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all inventory transactions with the primary warehouse once
|
||||
* multi-warehouses feature is activated.
|
||||
* @param {IWarehousesActivatedPayload}
|
||||
*/
|
||||
private updateBillsWithWarehouseOnActivated = async ({
|
||||
tenantId,
|
||||
primaryWarehouse,
|
||||
}: IWarehousesActivatedPayload) => {
|
||||
await this.billsActivateWarehouses.updateBillsWithWarehouse(
|
||||
tenantId,
|
||||
primaryWarehouse
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { IWarehousesActivatedPayload } from '@/interfaces';
|
||||
import events from '@/subscribers/events';
|
||||
import { CreditNotesActivateWarehouses } from '../../Activate/CreditNoteWarehousesActivate';
|
||||
|
||||
@Service()
|
||||
export class CreditsActivateWarehousesSubscriber {
|
||||
@Inject()
|
||||
private creditsActivateWarehouses: CreditNotesActivateWarehouses;
|
||||
|
||||
/**
|
||||
* Attaches events with handlers.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.warehouse.onActivated,
|
||||
this.updateInvoicesWithWarehouseOnActivated
|
||||
);
|
||||
return bus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all inventory transactions with the primary warehouse once
|
||||
* multi-warehouses feature is activated.
|
||||
* @param {IWarehousesActivatedPayload}
|
||||
*/
|
||||
private updateInvoicesWithWarehouseOnActivated = async ({
|
||||
tenantId,
|
||||
primaryWarehouse,
|
||||
}: IWarehousesActivatedPayload) => {
|
||||
await this.creditsActivateWarehouses.updateCreditsWithWarehouse(
|
||||
tenantId,
|
||||
primaryWarehouse
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { IWarehousesActivatedPayload } from '@/interfaces';
|
||||
import events from '@/subscribers/events';
|
||||
import { EstimatesActivateWarehouses } from '../../Activate/EstimateWarehousesActivate';
|
||||
|
||||
@Service()
|
||||
export class EstimatesActivateWarehousesSubscriber {
|
||||
@Inject()
|
||||
private estimatesActivateWarehouses: EstimatesActivateWarehouses;
|
||||
|
||||
/**
|
||||
* Attaches events with handlers.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.warehouse.onActivated,
|
||||
this.updateEstimatessWithWarehouseOnActivated
|
||||
);
|
||||
return bus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all inventory transactions with the primary warehouse once
|
||||
* multi-warehouses feature is activated.
|
||||
* @param {IWarehousesActivatedPayload}
|
||||
*/
|
||||
private updateEstimatessWithWarehouseOnActivated = async ({
|
||||
tenantId,
|
||||
primaryWarehouse,
|
||||
}: IWarehousesActivatedPayload) => {
|
||||
await this.estimatesActivateWarehouses.updateEstimatesWithWarehouse(
|
||||
tenantId,
|
||||
primaryWarehouse
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { IWarehousesActivatedPayload } from '@/interfaces';
|
||||
import events from '@/subscribers/events';
|
||||
import { InventoryActivateWarehouses } from '../../Activate/InventoryTransactionsWarehousesActivate';
|
||||
|
||||
@Service()
|
||||
export class InventoryActivateWarehousesSubscriber {
|
||||
@Inject()
|
||||
private inventoryActivateWarehouses: InventoryActivateWarehouses;
|
||||
|
||||
/**
|
||||
* Attaches events with handlers.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.warehouse.onActivated,
|
||||
this.updateInventoryTransactionsWithWarehouseOnActivated
|
||||
);
|
||||
return bus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all inventory transactions with the primary warehouse once
|
||||
* multi-warehouses feature is activated.
|
||||
* @param {IWarehousesActivatedPayload}
|
||||
*/
|
||||
private updateInventoryTransactionsWithWarehouseOnActivated = async ({
|
||||
tenantId,
|
||||
primaryWarehouse,
|
||||
}: IWarehousesActivatedPayload) => {
|
||||
await this.inventoryActivateWarehouses.updateInventoryTransactionsWithWarehouse(
|
||||
tenantId,
|
||||
primaryWarehouse
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { IWarehousesActivatedPayload } from '@/interfaces';
|
||||
import events from '@/subscribers/events';
|
||||
import { InvoicesActivateWarehouses } from '../../Activate/InvoiceWarehousesActivate';
|
||||
|
||||
@Service()
|
||||
export class InvoicesActivateWarehousesSubscriber {
|
||||
@Inject()
|
||||
private invoicesActivateWarehouses: InvoicesActivateWarehouses;
|
||||
|
||||
/**
|
||||
* Attaches events with handlers.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.warehouse.onActivated,
|
||||
this.updateInvoicesWithWarehouseOnActivated
|
||||
);
|
||||
return bus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all inventory transactions with the primary warehouse once
|
||||
* multi-warehouses feature is activated.
|
||||
* @param {IWarehousesActivatedPayload}
|
||||
*/
|
||||
private updateInvoicesWithWarehouseOnActivated = async ({
|
||||
tenantId,
|
||||
primaryWarehouse,
|
||||
}: IWarehousesActivatedPayload) => {
|
||||
await this.invoicesActivateWarehouses.updateInvoicesWithWarehouse(
|
||||
tenantId,
|
||||
primaryWarehouse
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { IWarehousesActivatedPayload } from '@/interfaces';
|
||||
import events from '@/subscribers/events';
|
||||
import { ReceiptActivateWarehouses } from '../../Activate/ReceiptWarehousesActivate';
|
||||
|
||||
@Service()
|
||||
export class ReceiptsActivateWarehousesSubscriber {
|
||||
@Inject()
|
||||
private receiptsActivateWarehouses: ReceiptActivateWarehouses;
|
||||
|
||||
/**
|
||||
* Attaches events with handlers.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.warehouse.onActivated,
|
||||
this.updateInventoryTransactionsWithWarehouseOnActivated
|
||||
);
|
||||
return bus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all receipts transactions with the primary warehouse once
|
||||
* multi-warehouses feature is activated.
|
||||
* @param {IWarehousesActivatedPayload}
|
||||
*/
|
||||
private updateInventoryTransactionsWithWarehouseOnActivated = async ({
|
||||
tenantId,
|
||||
primaryWarehouse,
|
||||
}: IWarehousesActivatedPayload) => {
|
||||
await this.receiptsActivateWarehouses.updateReceiptsWithWarehouse(
|
||||
tenantId,
|
||||
primaryWarehouse
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { IWarehousesActivatedPayload } from '@/interfaces';
|
||||
import events from '@/subscribers/events';
|
||||
import { VendorCreditActivateWarehouses } from '../../Activate/VendorCreditWarehousesActivate';
|
||||
|
||||
@Service()
|
||||
export class VendorCreditsActivateWarehousesSubscriber {
|
||||
@Inject()
|
||||
private creditsActivateWarehouses: VendorCreditActivateWarehouses;
|
||||
|
||||
/**
|
||||
* Attaches events with handlers.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.warehouse.onActivated,
|
||||
this.updateCreditsWithWarehouseOnActivated
|
||||
);
|
||||
return bus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all inventory transactions with the primary warehouse once
|
||||
* multi-warehouses feature is activated.
|
||||
* @param {IWarehousesActivatedPayload}
|
||||
*/
|
||||
private updateCreditsWithWarehouseOnActivated = async ({
|
||||
tenantId,
|
||||
primaryWarehouse,
|
||||
}: IWarehousesActivatedPayload) => {
|
||||
await this.creditsActivateWarehouses.updateCreditsWithWarehouse(
|
||||
tenantId,
|
||||
primaryWarehouse
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/* eslint-disable import/extensions */
|
||||
export * from './BillWarehousesActivateSubscriber';
|
||||
export * from './CreditNoteWarehousesActivateSubscriber';
|
||||
export * from './EstimateWarehousesActivateSubscriber';
|
||||
export * from './InventoryTransactionsWarehousesActivateSubscriber';
|
||||
export * from './VendorCreditWarehousesActivateSubscriber';
|
||||
export * from './ReceiptWarehousesActivateSubscriber';
|
||||
export * from './InvoiceWarehousesActivateSubscriber';
|
||||
Reference in New Issue
Block a user