feat: centrelize eventEmitter

This commit is contained in:
yassinedorbozgithub
2025-03-23 16:37:40 +01:00
parent ac770154f5
commit 80f7fdf8f5
36 changed files with 105 additions and 202 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@@ -7,7 +7,6 @@
*/
import { Injectable } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
@@ -17,11 +16,8 @@ import { BotStats, BotStatsType } from '../schemas/bot-stats.schema';
@Injectable()
export class BotStatsRepository extends BaseRepository<BotStats> {
constructor(
readonly eventEmitter: EventEmitter2,
@InjectModel(BotStats.name) readonly model: Model<BotStats>,
) {
super(eventEmitter, model, BotStats);
constructor(@InjectModel(BotStats.name) readonly model: Model<BotStats>) {
super(model, BotStats);
}
/**

View File

@@ -7,7 +7,7 @@
*/
import { Injectable } from '@nestjs/common';
import { EventEmitter2, OnEvent } from '@nestjs/event-emitter';
import { OnEvent } from '@nestjs/event-emitter';
import { Subscriber } from '@/chat/schemas/subscriber.schema';
import { config } from '@/config';
@@ -21,7 +21,6 @@ import { BotStats, BotStatsType } from '../schemas/bot-stats.schema';
export class BotStatsService extends BaseService<BotStats> {
constructor(
readonly repository: BotStatsRepository,
private readonly eventEmitter: EventEmitter2,
private readonly logger: LoggerService,
) {
super(repository);