mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
fix: auto increment serial transactions
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { events } from '@/common/events/events';
|
||||
import { SaleInvoiceIncrement } from '../commands/SaleInvoiceIncrement.service';
|
||||
import { ISaleInvoiceCreatedPayload } from '../SaleInvoice.types';
|
||||
|
||||
@Injectable()
|
||||
export class SaleInvoiceAutoIncrementSubscriber {
|
||||
constructor(private readonly invoiceIncrement: SaleInvoiceIncrement) { }
|
||||
|
||||
/**
|
||||
* Handles increment next number of invoice once be created.
|
||||
* @param {ISaleInvoiceCreatedPayload} payload -
|
||||
*/
|
||||
@OnEvent(events.saleInvoice.onCreated)
|
||||
private async handleInvoiceNextNumberIncrement({ }: ISaleInvoiceCreatedPayload) {
|
||||
await this.invoiceIncrement.incrementNextInvoiceNumber();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user