mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
refactor: branches and warehouses to nestjs
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';
|
||||
@@ -0,0 +1,36 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { DeleteItemWarehousesQuantity } from '../commands/DeleteItemWarehousesQuantity';
|
||||
// import { IItemEventDeletingPayload } from '@/interfaces';
|
||||
|
||||
// @Service()
|
||||
// export class DeleteItemWarehousesQuantitySubscriber {
|
||||
// @Inject()
|
||||
// private deleteItemWarehousesQuantity: DeleteItemWarehousesQuantity;
|
||||
|
||||
// /**
|
||||
// * Attaches events.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.item.onDeleting,
|
||||
// this.deleteItemWarehouseQuantitiesOnItemDelete
|
||||
// );
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Deletes the given item warehouses quantities once the item deleting.
|
||||
// * @param {IItemEventDeletingPayload} payload -
|
||||
// */
|
||||
// private deleteItemWarehouseQuantitiesOnItemDelete = async ({
|
||||
// tenantId,
|
||||
// oldItem,
|
||||
// trx,
|
||||
// }: IItemEventDeletingPayload) => {
|
||||
// await this.deleteItemWarehousesQuantity.deleteItemWarehousesQuantity(
|
||||
// tenantId,
|
||||
// oldItem.id,
|
||||
// trx
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,35 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import { IInventoryAdjustmentCreatingPayload } from '@/interfaces';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { WarehousesDTOValidators } from '../../../Integrations/WarehousesDTOValidators';
|
||||
|
||||
// @Service()
|
||||
// export class InventoryAdjustmentWarehouseValidatorSubscriber {
|
||||
// @Inject()
|
||||
// private warehouseDTOValidator: WarehousesDTOValidators;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.inventoryAdjustment.onQuickCreating,
|
||||
// this.validateAdjustmentWarehouseExistanceOnCreating
|
||||
// );
|
||||
// return bus;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once creating.
|
||||
// * @param {IBillCreatingPayload}
|
||||
// */
|
||||
// private validateAdjustmentWarehouseExistanceOnCreating = async ({
|
||||
// quickAdjustmentDTO,
|
||||
// tenantId,
|
||||
// }: IInventoryAdjustmentCreatingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// quickAdjustmentDTO
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,53 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import { IBillCreatingPayload, IBillEditingPayload } from '@/interfaces';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { WarehousesDTOValidators } from '../../../Integrations/WarehousesDTOValidators';
|
||||
|
||||
// @Service()
|
||||
// export class BillWarehousesValidateSubscriber {
|
||||
// @Inject()
|
||||
// private warehouseDTOValidator: WarehousesDTOValidators;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.bill.onCreating,
|
||||
// this.validateBillWarehouseExistanceOnCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.bill.onEditing,
|
||||
// this.validateSaleEstimateWarehouseExistanceOnEditing
|
||||
// );
|
||||
// return bus;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once creating.
|
||||
// * @param {IBillCreatingPayload}
|
||||
// */
|
||||
// private validateBillWarehouseExistanceOnCreating = async ({
|
||||
// billDTO,
|
||||
// tenantId,
|
||||
// }: IBillCreatingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// billDTO
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once editing.
|
||||
// * @param {IBillEditingPayload}
|
||||
// */
|
||||
// private validateSaleEstimateWarehouseExistanceOnEditing = async ({
|
||||
// tenantId,
|
||||
// billDTO,
|
||||
// }: IBillEditingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// billDTO
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import {
|
||||
// IVendorCreditCreatingPayload,
|
||||
// IVendorCreditEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { WarehousesDTOValidators } from '../../../Integrations/WarehousesDTOValidators';
|
||||
|
||||
// @Service()
|
||||
// export class VendorCreditWarehousesValidateSubscriber {
|
||||
// @Inject()
|
||||
// warehouseDTOValidator: WarehousesDTOValidators;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.vendorCredit.onCreating,
|
||||
// this.validateVendorCreditWarehouseExistanceOnCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.vendorCredit.onEditing,
|
||||
// this.validateSaleEstimateWarehouseExistanceOnEditing
|
||||
// );
|
||||
// return bus;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once creating.
|
||||
// * @param {IVendorCreditCreatingPayload}
|
||||
// */
|
||||
// private validateVendorCreditWarehouseExistanceOnCreating = async ({
|
||||
// vendorCreditCreateDTO,
|
||||
// tenantId,
|
||||
// }: IVendorCreditCreatingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// vendorCreditCreateDTO
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once editing.
|
||||
// * @param {IVendorCreditEditingPayload}
|
||||
// */
|
||||
// private validateSaleEstimateWarehouseExistanceOnEditing = async ({
|
||||
// tenantId,
|
||||
// vendorCreditDTO,
|
||||
// }: IVendorCreditEditingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// vendorCreditDTO
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import {
|
||||
// ICreditNoteCreatingPayload,
|
||||
// ICreditNoteEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { WarehousesDTOValidators } from '../../../Integrations/WarehousesDTOValidators';
|
||||
|
||||
// @Service()
|
||||
// export class CreditNoteWarehousesValidateSubscriber {
|
||||
// @Inject()
|
||||
// warehouseDTOValidator: WarehousesDTOValidators;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onCreating,
|
||||
// this.validateCreditNoteWarehouseExistanceOnCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onEditing,
|
||||
// this.validateCreditNoteWarehouseExistanceOnEditing
|
||||
// );
|
||||
// return bus;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once creating.
|
||||
// * @param {ICreditNoteCreatingPayload}
|
||||
// */
|
||||
// private validateCreditNoteWarehouseExistanceOnCreating = async ({
|
||||
// creditNoteDTO,
|
||||
// tenantId,
|
||||
// }: ICreditNoteCreatingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// creditNoteDTO
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once editing.
|
||||
// * @param {ICreditNoteEditingPayload}
|
||||
// */
|
||||
// private validateCreditNoteWarehouseExistanceOnEditing = async ({
|
||||
// tenantId,
|
||||
// creditNoteEditDTO,
|
||||
// }: ICreditNoteEditingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// creditNoteEditDTO
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import {
|
||||
// ISaleEstimateCreatingPayload,
|
||||
// ISaleEstimateEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { WarehousesDTOValidators } from '../../../Integrations/WarehousesDTOValidators';
|
||||
|
||||
// @Service()
|
||||
// export class SaleEstimateWarehousesValidateSubscriber {
|
||||
// @Inject()
|
||||
// warehouseDTOValidator: WarehousesDTOValidators;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.saleEstimate.onCreating,
|
||||
// this.validateSaleEstimateWarehouseExistanceOnCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.saleEstimate.onEditing,
|
||||
// this.validateSaleEstimateWarehouseExistanceOnEditing
|
||||
// );
|
||||
// return bus;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once creating.
|
||||
// * @param {ISaleEstimateCreatingPayload}
|
||||
// */
|
||||
// private validateSaleEstimateWarehouseExistanceOnCreating = async ({
|
||||
// estimateDTO,
|
||||
// tenantId,
|
||||
// }: ISaleEstimateCreatingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// estimateDTO
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once editing.
|
||||
// * @param {ISaleEstimateEditingPayload}
|
||||
// */
|
||||
// private validateSaleEstimateWarehouseExistanceOnEditing = async ({
|
||||
// tenantId,
|
||||
// estimateDTO,
|
||||
// }: ISaleEstimateEditingPayload) => {
|
||||
// await this.warehouseDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// estimateDTO
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import {
|
||||
// ISaleInvoiceCreatingPaylaod,
|
||||
// ISaleInvoiceEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { WarehousesDTOValidators } from '../../../Integrations/WarehousesDTOValidators';
|
||||
|
||||
// @Service()
|
||||
// export class SaleInvoicesWarehousesValidateSubscriber {
|
||||
// @Inject()
|
||||
// warehousesDTOValidator: WarehousesDTOValidators;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.saleInvoice.onCreating,
|
||||
// this.validateSaleInvoiceWarehouseExistanceOnCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.saleInvoice.onEditing,
|
||||
// this.validateSaleInvoiceWarehouseExistanceOnEditing
|
||||
// );
|
||||
// return bus;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once creating.
|
||||
// * @param {ISaleInvoiceCreatingPaylaod}
|
||||
// */
|
||||
// private validateSaleInvoiceWarehouseExistanceOnCreating = async ({
|
||||
// saleInvoiceDTO,
|
||||
// tenantId,
|
||||
// }: ISaleInvoiceCreatingPaylaod) => {
|
||||
// await this.warehousesDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// saleInvoiceDTO
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once editing.
|
||||
// * @param {ISaleInvoiceEditingPayload}
|
||||
// */
|
||||
// private validateSaleInvoiceWarehouseExistanceOnEditing = async ({
|
||||
// tenantId,
|
||||
// saleInvoiceDTO,
|
||||
// }: ISaleInvoiceEditingPayload) => {
|
||||
// await this.warehousesDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// saleInvoiceDTO
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,56 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import {
|
||||
// ISaleReceiptCreatingPayload,
|
||||
// ISaleReceiptEditingPayload,
|
||||
// } from '@/interfaces';
|
||||
// import events from '@/subscribers/events';
|
||||
// import { WarehousesDTOValidators } from '../../../Integrations/WarehousesDTOValidators';
|
||||
|
||||
// @Service()
|
||||
// export class SaleReceiptWarehousesValidateSubscriber {
|
||||
// @Inject()
|
||||
// private warehousesDTOValidator: WarehousesDTOValidators;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.saleReceipt.onCreating,
|
||||
// this.validateSaleReceiptWarehouseExistanceOnCreating
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.saleReceipt.onEditing,
|
||||
// this.validateSaleReceiptWarehouseExistanceOnEditing
|
||||
// );
|
||||
// return bus;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once creating.
|
||||
// * @param {ISaleReceiptCreatingPayload}
|
||||
// */
|
||||
// private validateSaleReceiptWarehouseExistanceOnCreating = async ({
|
||||
// saleReceiptDTO,
|
||||
// tenantId,
|
||||
// }: ISaleReceiptCreatingPayload) => {
|
||||
// await this.warehousesDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// saleReceiptDTO
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Validate warehouse existance of sale invoice once editing.
|
||||
// * @param {ISaleReceiptEditingPayload}
|
||||
// */
|
||||
// private validateSaleReceiptWarehouseExistanceOnEditing = async ({
|
||||
// tenantId,
|
||||
// saleReceiptDTO,
|
||||
// }: ISaleReceiptEditingPayload) => {
|
||||
// await this.warehousesDTOValidator.validateDTOWarehouseWhenActive(
|
||||
// tenantId,
|
||||
// saleReceiptDTO
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,9 @@
|
||||
// export * from './Purchases/BillWarehousesSubscriber';
|
||||
// export * from './Purchases/VendorCreditWarehousesSubscriber';
|
||||
|
||||
// export * from './Sales/SaleEstimateWarehousesSubscriber';
|
||||
// export * from './Sales/CreditNoteWarehousesSubscriber';
|
||||
// export * from './Sales/SaleInvoicesWarehousesSubscriber';
|
||||
// export * from './Sales/SaleReceiptWarehousesSubscriber';
|
||||
|
||||
// export * from './InventoryAdjustment/InventoryAdjustmentWarehouseValidatorSubscriber';
|
||||
Reference in New Issue
Block a user