mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
// import { Service, Inject } from 'typedi';
|
||||
// import { sumBy } from 'lodash';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// IApplyCreditToInvoicesCreatedPayload,
|
||||
// IApplyCreditToInvoicesDeletedPayload,
|
||||
// } from '@/interfaces';
|
||||
// import CreditNoteApplySyncCredit from '../commands/CreditNoteApplySyncCredit.service';
|
||||
|
||||
// @Service()
|
||||
// export default class CreditNoteApplySyncCreditSubscriber {
|
||||
// @Inject()
|
||||
// syncInvoicedAmountWithCredit: CreditNoteApplySyncCredit;
|
||||
|
||||
// /**
|
||||
// *
|
||||
// * @param bus
|
||||
// */
|
||||
// attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onApplyToInvoicesCreated,
|
||||
// this.incrementCreditedAmountOnceApplyToInvoicesCreated
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onApplyToInvoicesDeleted,
|
||||
// this.decrementCreditedAmountOnceApplyToInvoicesDeleted
|
||||
// );
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Increment credited amount of credit note transaction once the transaction created.
|
||||
// * @param {IApplyCreditToInvoicesCreatedPayload} payload -
|
||||
// */
|
||||
// private incrementCreditedAmountOnceApplyToInvoicesCreated = async ({
|
||||
// trx,
|
||||
// creditNote,
|
||||
// tenantId,
|
||||
// creditNoteAppliedInvoices,
|
||||
// }: IApplyCreditToInvoicesCreatedPayload) => {
|
||||
// const totalCredited = sumBy(creditNoteAppliedInvoices, 'amount');
|
||||
|
||||
// await this.syncInvoicedAmountWithCredit.incrementCreditNoteInvoicedAmount(
|
||||
// tenantId,
|
||||
// creditNote.id,
|
||||
// totalCredited,
|
||||
// trx
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// * Decrement credited amount of credit note transaction once the transaction deleted.
|
||||
// * @param {IApplyCreditToInvoicesDeletedPayload} payload -
|
||||
// */
|
||||
// private decrementCreditedAmountOnceApplyToInvoicesDeleted = async ({
|
||||
// tenantId,
|
||||
// creditNote,
|
||||
// creditNoteAppliedToInvoice,
|
||||
// trx,
|
||||
// }: IApplyCreditToInvoicesDeletedPayload) => {
|
||||
// await this.syncInvoicedAmountWithCredit.decrementCreditNoteInvoicedAmount(
|
||||
// tenantId,
|
||||
// creditNote.id,
|
||||
// creditNoteAppliedToInvoice.amount,
|
||||
// trx
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
@@ -0,0 +1,61 @@
|
||||
// import { Service, Inject } from 'typedi';
|
||||
// import events from '@/subscribers/events';
|
||||
// import {
|
||||
// IApplyCreditToInvoicesCreatedPayload,
|
||||
// IApplyCreditToInvoicesDeletedPayload,
|
||||
// } from '@/interfaces';
|
||||
// import CreditNoteApplySyncInvoicesCreditedAmount from '../commands/CreditNoteApplySyncInvoices.service';
|
||||
|
||||
// @Service()
|
||||
// export default class CreditNoteApplySyncInvoicesCreditedAmountSubscriber {
|
||||
// @Inject()
|
||||
// private syncInvoicesWithCreditNote: CreditNoteApplySyncInvoicesCreditedAmount;
|
||||
|
||||
// /**
|
||||
// * Attaches events with handlers.
|
||||
// */
|
||||
// public attach(bus) {
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onApplyToInvoicesCreated,
|
||||
// this.incrementAppliedInvoicesOnceCreditCreated
|
||||
// );
|
||||
// bus.subscribe(
|
||||
// events.creditNote.onApplyToInvoicesDeleted,
|
||||
// this.decrementAppliedInvoicesOnceCreditDeleted
|
||||
// );
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Increment invoices credited amount once the credit note apply to invoices transaction
|
||||
// * @param {IApplyCreditToInvoicesCreatedPayload} payload -
|
||||
// */
|
||||
// private incrementAppliedInvoicesOnceCreditCreated = async ({
|
||||
// trx,
|
||||
// tenantId,
|
||||
// creditNoteAppliedInvoices,
|
||||
// }: IApplyCreditToInvoicesCreatedPayload) => {
|
||||
// await this.syncInvoicesWithCreditNote.incrementInvoicesCreditedAmount(
|
||||
// tenantId,
|
||||
// creditNoteAppliedInvoices,
|
||||
// trx
|
||||
// );
|
||||
// };
|
||||
|
||||
// /**
|
||||
// *
|
||||
// * @param {IApplyCreditToInvoicesDeletedPayload} payload -
|
||||
// */
|
||||
// private decrementAppliedInvoicesOnceCreditDeleted = async ({
|
||||
// trx,
|
||||
// creditNoteAppliedToInvoice,
|
||||
// tenantId,
|
||||
// }: IApplyCreditToInvoicesDeletedPayload) => {
|
||||
// // Decrement invoice credited amount.
|
||||
// await this.syncInvoicesWithCreditNote.decrementInvoiceCreditedAmount(
|
||||
// tenantId,
|
||||
// creditNoteAppliedToInvoice.invoiceId,
|
||||
// creditNoteAppliedToInvoice.amount,
|
||||
// trx
|
||||
// );
|
||||
// };
|
||||
// }
|
||||
Reference in New Issue
Block a user