feat(server): socket module

This commit is contained in:
Ahmed Bouhuolia
2025-10-18 13:27:43 +02:00
parent cd1a70ca94
commit dbc71c2555
10 changed files with 87 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import { BullModule } from '@nestjs/bullmq';
import { Module } from '@nestjs/common';
import { SocketModule } from '../Socket/Socket.module';
import { PlaidUpdateTransactionsOnItemCreatedSubscriber } from './subscribers/PlaidUpdateTransactionsOnItemCreatedSubscriber';
import { PlaidUpdateTransactions } from './command/PlaidUpdateTransactions';
import { PlaidSyncDb } from './command/PlaidSyncDB';
@@ -26,6 +27,7 @@ const models = [RegisterTenancyModel(PlaidItem)];
@Module({
imports: [
SocketModule,
PlaidModule,
AccountsModule,
BankingCategorizeModule,
@@ -49,4 +51,4 @@ const models = [RegisterTenancyModel(PlaidItem)];
exports: [...models],
controllers: [BankingPlaidController, BankingPlaidWebhooksController],
})
export class BankingPlaidModule {}
export class BankingPlaidModule { }

View File

@@ -10,6 +10,7 @@ import {
} from '../types/BankingPlaid.types';
import { PlaidUpdateTransactions } from '../command/PlaidUpdateTransactions';
import { SetupPlaidItemTenantService } from '../command/SetupPlaidItemTenant.service';
import { SocketGateway } from '../../Socket/Socket.gateway';
@Processor({
name: UpdateBankingPlaidTransitionsQueueJob,
@@ -19,6 +20,7 @@ export class PlaidFetchTransactionsProcessor extends WorkerHost {
constructor(
private readonly plaidFetchTransactionsService: PlaidUpdateTransactions,
private readonly setupPlaidItemService: SetupPlaidItemTenantService,
private readonly socketGateway: SocketGateway,
) {
super();
}
@@ -38,7 +40,7 @@ export class PlaidFetchTransactionsProcessor extends WorkerHost {
);
});
// Notify the frontend to reflect the new transactions changes.
// io.emit('NEW_TRANSACTIONS_DATA', { plaidItemId });
this.socketGateway.emitNewTransactionsData();
} catch (error) {
console.log(error);
}