99 lines
3.5 KiB
TypeScript
Executable File
99 lines
3.5 KiB
TypeScript
Executable File
import { BullModule } from "@nestjs/bullmq";
|
|
import { Module } from "@nestjs/common";
|
|
import { ConfigModule } from "@nestjs/config";
|
|
import { TypeOrmModule } from "@nestjs/typeorm";
|
|
|
|
import { NOTIFICATION } from "./constants";
|
|
import { Notification } from "./entities/notification.entity";
|
|
import { BlogCommentHandler } from "./handlers/blog-comment.handler";
|
|
import { NotificationController } from "./notifications.controller";
|
|
import { LoggerModule } from "../logger/logger.module";
|
|
import {
|
|
NewCriticismHandler,
|
|
NewCustomerHandler,
|
|
NewSubscriptionHandler,
|
|
ServiceReviewHandler,
|
|
} from "./handlers/admin-notifications.handler";
|
|
import { AnnouncementHandler } from "./handlers/announcement.handler";
|
|
import {
|
|
ApproveInvoiceHandler,
|
|
BillInvoiceHandler,
|
|
BillInvoiceReminderHandler,
|
|
CreateInvoiceHandler,
|
|
InvoiceOverdueHandler,
|
|
RecurringInvoiceHandler,
|
|
} from "./handlers/invoice.handler";
|
|
import { PaymentCancellationHandler, PaymentReminderHandler } from "./handlers/payment.handler";
|
|
import { BlockServiceHandler } from "./handlers/service.handler";
|
|
import { AnswerTicketHandler, AssignTicketHandler, CreateTicketHandler, NewTicketHandler } from "./handlers/ticket.handler";
|
|
import { UserPasswordHandler } from "./handlers/user-password.handler";
|
|
import { NotificationsService } from "./providers/notifications.service";
|
|
import { NotificationProcessor } from "./queue/notification.processor";
|
|
import { NotificationQueue } from "./queue/notification.queue";
|
|
import { NotificationRepository } from "./repositories/notifications.repository";
|
|
import { NotificationSetting } from "../settings/entities/notification-setting.entity";
|
|
import { SettingModule } from "../settings/settings.module";
|
|
import { UtilsModule } from "../utils/utils.module";
|
|
import { NotificationHandlerFactory } from "./handlers/notification-handler.factory";
|
|
import { OtpHandler } from "./handlers/otp.handler";
|
|
import { UserLoginHandler } from "./handlers/user-login.handler";
|
|
import { WalletChargeHandler, WalletDeductionHandler } from "./handlers/wallet.handler";
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule,
|
|
LoggerModule,
|
|
TypeOrmModule.forFeature([Notification, NotificationSetting]),
|
|
BullModule.registerQueue({
|
|
name: NOTIFICATION.QUEUE_NAME,
|
|
defaultJobOptions: {
|
|
attempts: NOTIFICATION.SEND_NOTIFICATION_JOB_ATTEMPTS,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: NOTIFICATION.SEND_NOTIFICATION_JOB_BACKOFF,
|
|
},
|
|
removeOnComplete: true,
|
|
removeOnFail: false,
|
|
delay: NOTIFICATION.SEND_NOTIFICATION_JOB_DELAY,
|
|
},
|
|
}),
|
|
UtilsModule,
|
|
SettingModule,
|
|
],
|
|
providers: [
|
|
NotificationRepository,
|
|
NotificationsService,
|
|
NotificationQueue,
|
|
NotificationProcessor,
|
|
// notification handlers
|
|
NotificationHandlerFactory,
|
|
OtpHandler,
|
|
UserLoginHandler,
|
|
WalletChargeHandler,
|
|
WalletDeductionHandler,
|
|
CreateInvoiceHandler,
|
|
BillInvoiceReminderHandler,
|
|
BillInvoiceHandler,
|
|
ApproveInvoiceHandler,
|
|
InvoiceOverdueHandler,
|
|
RecurringInvoiceHandler,
|
|
BlogCommentHandler,
|
|
ServiceReviewHandler,
|
|
NewCustomerHandler,
|
|
NewSubscriptionHandler,
|
|
NewCriticismHandler,
|
|
NewTicketHandler,
|
|
AnnouncementHandler,
|
|
AnswerTicketHandler,
|
|
CreateTicketHandler,
|
|
AssignTicketHandler,
|
|
BlockServiceHandler,
|
|
PaymentReminderHandler,
|
|
PaymentCancellationHandler,
|
|
UserPasswordHandler,
|
|
],
|
|
controllers: [NotificationController],
|
|
exports: [NotificationRepository, NotificationsService, NotificationQueue],
|
|
})
|
|
export class NotificationModule {}
|