update: add telegram logger
This commit is contained in:
+3
-3
@@ -7,13 +7,13 @@ import { ConfigModule } from "@nestjs/config";
|
||||
import { ThrottlerModule } from "@nestjs/throttler";
|
||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||
import { MailerModule } from "@nestjs-modules/mailer";
|
||||
// import { TelegrafModule } from "nestjs-telegraf";
|
||||
import { TelegrafModule } from "nestjs-telegraf";
|
||||
|
||||
import { bullMqConfig } from "./configs/bullmq.config";
|
||||
import { cacheConfig } from "./configs/cache.config";
|
||||
import { mailerConfig } from "./configs/mailer.config";
|
||||
import { rateLimitConfig } from "./configs/rateLimit.config";
|
||||
// import { telegrafConfig } from "./configs/telegraf.config";
|
||||
import { telegrafConfig } from "./configs/telegraf.config";
|
||||
import { databaseConfigs } from "./configs/typeorm.config";
|
||||
import { HTTPLogger } from "./core/middlewares/logger.middleware";
|
||||
import { AddressModule } from "./modules/address/address.module";
|
||||
@@ -42,7 +42,7 @@ import { UsersModule } from "./modules/users/users.module";
|
||||
import { WalletsModule } from "./modules/wallets/wallets.module";
|
||||
@Module({
|
||||
imports: [
|
||||
// TelegrafModule.forRootAsync(telegrafConfig()),
|
||||
TelegrafModule.forRootAsync(telegrafConfig()),
|
||||
MailerModule.forRootAsync(mailerConfig()),
|
||||
BullModule.forRootAsync(bullMqConfig()),
|
||||
ThrottlerModule.forRootAsync(rateLimitConfig()),
|
||||
|
||||
@@ -30,7 +30,7 @@ export class InvoiceProcessor extends WorkerProcessor {
|
||||
}
|
||||
|
||||
async process(job: Job, token?: string) {
|
||||
this.logger.log(job);
|
||||
this.logger.log(job.name);
|
||||
switch (job.name) {
|
||||
case INVOICE.REMINDER_JOB_NAME:
|
||||
return this.sendBillInvoiceReminder(job, token);
|
||||
|
||||
@@ -44,18 +44,15 @@ export class NotificationProcessor extends WorkerProcessor {
|
||||
}
|
||||
|
||||
async process(job: Job<NotificationJobData | OtpJobData>, token?: string) {
|
||||
this.logger.log(`Processing notification job: ${job.id} ${token ? `with token: ${token}` : ""}`);
|
||||
this.logger.log(`Processing notification job: ${job.name} ${token ? `with token: ${token}` : ""}`);
|
||||
const queryRunner = this.dataSource.createQueryRunner();
|
||||
let heartbeat: NodeJS.Timeout | undefined;
|
||||
|
||||
//
|
||||
|
||||
try {
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
heartbeat = setInterval(() => job.updateProgress(50), 10000);
|
||||
|
||||
//
|
||||
if (job.name === NOTIFICATION.SEND_LOGIN_OTP_JOB_NAME) {
|
||||
const { phone, code } = job.data as OtpJobData;
|
||||
await this.smsService.sendSmsVerifyCode(phone, code);
|
||||
|
||||
Reference in New Issue
Block a user