feat: fix
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
import { Injectable, Logger } from "@nestjs/common";
|
||||
import { QueryRunner } from "typeorm";
|
||||
|
||||
import { BaseNotificationHandler } from "./base-notification.handler";
|
||||
import { IInvoiceNotificationData } from "../interfaces/ISendNotificationData";
|
||||
import { NotificationsService } from "../providers/notifications.service";
|
||||
|
||||
@Injectable()
|
||||
export class CreateInvoiceHandler extends BaseNotificationHandler<IInvoiceNotificationData> {
|
||||
protected readonly logger = new Logger(CreateInvoiceHandler.name);
|
||||
|
||||
constructor(private readonly notificationsService: NotificationsService) {
|
||||
super();
|
||||
}
|
||||
|
||||
protected async handle(recipientId: string, data: IInvoiceNotificationData, queryRunner: QueryRunner): Promise<void> {
|
||||
await this.notificationsService.createInvoiceCreationNotification(recipientId, data, queryRunner);
|
||||
}
|
||||
|
||||
protected getHandlerName(): string {
|
||||
return "CreateInvoice";
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class BillInvoiceReminderHandler extends BaseNotificationHandler<IInvoiceNotificationData> {
|
||||
protected readonly logger = new Logger(BillInvoiceReminderHandler.name);
|
||||
|
||||
constructor(private readonly notificationsService: NotificationsService) {
|
||||
super();
|
||||
}
|
||||
|
||||
protected async handle(recipientId: string, data: IInvoiceNotificationData, queryRunner: QueryRunner): Promise<void> {
|
||||
await this.notificationsService.createBillInvoiceReminderNotification(recipientId, data, queryRunner);
|
||||
}
|
||||
|
||||
protected getHandlerName(): string {
|
||||
return "BillInvoiceReminder";
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class BillInvoiceHandler extends BaseNotificationHandler<IInvoiceNotificationData> {
|
||||
protected readonly logger = new Logger(BillInvoiceHandler.name);
|
||||
|
||||
constructor(private readonly notificationsService: NotificationsService) {
|
||||
super();
|
||||
}
|
||||
|
||||
protected async handle(recipientId: string, data: IInvoiceNotificationData, queryRunner: QueryRunner): Promise<void> {
|
||||
await this.notificationsService.createBillInvoiceNotification(recipientId, data, queryRunner);
|
||||
}
|
||||
|
||||
protected getHandlerName(): string {
|
||||
return "BillInvoice";
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ApproveInvoiceHandler extends BaseNotificationHandler<IInvoiceNotificationData> {
|
||||
protected readonly logger = new Logger(ApproveInvoiceHandler.name);
|
||||
|
||||
constructor(private readonly notificationsService: NotificationsService) {
|
||||
super();
|
||||
}
|
||||
|
||||
protected async handle(recipientId: string, data: IInvoiceNotificationData, queryRunner: QueryRunner): Promise<void> {
|
||||
await this.notificationsService.createApprovedInvoiceNotification(recipientId, data, queryRunner);
|
||||
}
|
||||
|
||||
protected getHandlerName(): string {
|
||||
return "ApproveInvoice";
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class InvoiceOverdueHandler extends BaseNotificationHandler<IInvoiceNotificationData> {
|
||||
protected readonly logger = new Logger(InvoiceOverdueHandler.name);
|
||||
|
||||
constructor(private readonly notificationsService: NotificationsService) {
|
||||
super();
|
||||
}
|
||||
|
||||
protected async handle(recipientId: string, data: IInvoiceNotificationData, queryRunner: QueryRunner): Promise<void> {
|
||||
await this.notificationsService.createInvoiceOverdueNotification(recipientId, data, queryRunner);
|
||||
}
|
||||
|
||||
protected getHandlerName(): string {
|
||||
return "InvoiceOverdue";
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class RecurringInvoiceHandler extends BaseNotificationHandler<IInvoiceNotificationData> {
|
||||
protected readonly logger = new Logger(RecurringInvoiceHandler.name);
|
||||
|
||||
constructor(private readonly notificationsService: NotificationsService) {
|
||||
super();
|
||||
}
|
||||
|
||||
protected async handle(recipientId: string, data: IInvoiceNotificationData, queryRunner: QueryRunner): Promise<void> {
|
||||
await this.notificationsService.createRecurringInvoiceNotification(recipientId, data, queryRunner);
|
||||
}
|
||||
|
||||
protected getHandlerName(): string {
|
||||
return "RecurringInvoice";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user