Split job modules (#5318)
## Context JobsModule is hard to maintain because we provide all the jobs there, including their dependencies. This PR aims to split jobs in dedicated modules.
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { MatchParticipantJob } from 'src/modules/calendar-messaging-participant/jobs/match-participant.job';
|
||||
import { UnmatchParticipantJob } from 'src/modules/calendar-messaging-participant/jobs/unmatch-participant.job';
|
||||
import { CalendarEventParticipantModule } from 'src/modules/calendar/services/calendar-event-participant/calendar-event-participant.module';
|
||||
import { MessageParticipantModule } from 'src/modules/messaging/services/message-participant/message-participant.module';
|
||||
|
||||
@Module({
|
||||
imports: [MessageParticipantModule, CalendarEventParticipantModule],
|
||||
providers: [
|
||||
{
|
||||
provide: MatchParticipantJob.name,
|
||||
useClass: MatchParticipantJob,
|
||||
},
|
||||
{
|
||||
provide: UnmatchParticipantJob.name,
|
||||
useClass: UnmatchParticipantJob,
|
||||
},
|
||||
],
|
||||
})
|
||||
export class CalendarMessagingParticipantJobModule {}
|
||||
@ -1,11 +1,7 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import { MessageQueueJob } from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface';
|
||||
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { CalendarEventParticipantService } from 'src/modules/calendar/services/calendar-event-participant/calendar-event-participant.service';
|
||||
import { MessageParticipantService } from 'src/modules/messaging/services/message-participant/message-participant.service';
|
||||
|
||||
@ -23,8 +19,6 @@ export class MatchParticipantJob
|
||||
constructor(
|
||||
private readonly messageParticipantService: MessageParticipantService,
|
||||
private readonly calendarEventParticipantService: CalendarEventParticipantService,
|
||||
@InjectRepository(FeatureFlagEntity, 'core')
|
||||
private readonly featureFlagRepository: Repository<FeatureFlagEntity>,
|
||||
) {}
|
||||
|
||||
async handle(data: MatchParticipantJobData): Promise<void> {
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import { MessageQueueJob } from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface';
|
||||
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { CalendarEventParticipantService } from 'src/modules/calendar/services/calendar-event-participant/calendar-event-participant.service';
|
||||
import { MessageParticipantService } from 'src/modules/messaging/services/message-participant/message-participant.service';
|
||||
|
||||
@ -23,8 +19,6 @@ export class UnmatchParticipantJob
|
||||
constructor(
|
||||
private readonly messageParticipantService: MessageParticipantService,
|
||||
private readonly calendarEventParticipantService: CalendarEventParticipantService,
|
||||
@InjectRepository(FeatureFlagEntity, 'core')
|
||||
private readonly featureFlagRepository: Repository<FeatureFlagEntity>,
|
||||
) {}
|
||||
|
||||
async handle(data: UnmatchParticipantJobData): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user