mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
add server to monorepo.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import events from '@/subscribers/events';
|
||||
import { IBillEditedPayload } from '@/interfaces';
|
||||
import { BillPaymentsGLEntriesRewrite } from './BillPaymentsGLEntriesRewrite';
|
||||
|
||||
@Service()
|
||||
export class BillPaymentsGLEntriesRewriteSubscriber {
|
||||
@Inject()
|
||||
private billPaymentGLEntriesRewrite: BillPaymentsGLEntriesRewrite;
|
||||
|
||||
/**
|
||||
* Attachs events with handles.
|
||||
*/
|
||||
attach(bus) {
|
||||
bus.subscribe(
|
||||
events.bill.onEdited,
|
||||
this.handlerRewritePaymentsGLOnBillEdited
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles writing journal entries once bill created.
|
||||
* @param {IBillCreatedPayload} payload -
|
||||
*/
|
||||
private handlerRewritePaymentsGLOnBillEdited = async ({
|
||||
tenantId,
|
||||
billId,
|
||||
trx,
|
||||
}: IBillEditedPayload) => {
|
||||
await this.billPaymentGLEntriesRewrite.rewriteBillPaymentsGLEntries(
|
||||
tenantId,
|
||||
billId,
|
||||
trx
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user