mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-14 11:50:31 +00:00
20 lines
772 B
TypeScript
20 lines
772 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { OnEvent } from '@nestjs/event-emitter';
|
|
import { events } from '@/common/events/events';
|
|
import { SaleEstimateIncrement } from '../commands/SaleEstimateIncrement.service';
|
|
import { ISaleEstimateCreatedPayload } from '../types/SaleEstimates.types';
|
|
|
|
@Injectable()
|
|
export class SaleEstimateAutoIncrementSubscriber {
|
|
constructor(private readonly estimateIncrement: SaleEstimateIncrement) { }
|
|
|
|
/**
|
|
* Handles increment next number of estimate once be created.
|
|
* @param {ISaleEstimateCreatedPayload} payload -
|
|
*/
|
|
@OnEvent(events.saleEstimate.onCreated)
|
|
private async handleEstimateNextNumberIncrement({ }: ISaleEstimateCreatedPayload) {
|
|
await this.estimateIncrement.incrementNextEstimateNumber();
|
|
}
|
|
}
|