forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## 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.
- Loading branch information
Showing
17 changed files
with
300 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...r/src/engine/api/graphql/workspace-query-runner/jobs/workspace-query-runner-job.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { HttpModule } from '@nestjs/axios'; | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { CallWebhookJobsJob } from 'src/engine/api/graphql/workspace-query-runner/jobs/call-webhook-jobs.job'; | ||
import { CallWebhookJob } from 'src/engine/api/graphql/workspace-query-runner/jobs/call-webhook.job'; | ||
import { RecordPositionBackfillJob } from 'src/engine/api/graphql/workspace-query-runner/jobs/record-position-backfill.job'; | ||
import { RecordPositionBackfillModule } from 'src/engine/api/graphql/workspace-query-runner/services/record-position-backfill-module'; | ||
import { DataSourceModule } from 'src/engine/metadata-modules/data-source/data-source.module'; | ||
import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module'; | ||
|
||
@Module({ | ||
imports: [ | ||
WorkspaceDataSourceModule, | ||
DataSourceModule, | ||
RecordPositionBackfillModule, | ||
HttpModule, | ||
], | ||
providers: [ | ||
{ | ||
provide: CallWebhookJobsJob.name, | ||
useClass: CallWebhookJobsJob, | ||
}, | ||
{ | ||
provide: CallWebhookJob.name, | ||
useClass: CallWebhookJob, | ||
}, | ||
{ | ||
provide: RecordPositionBackfillJob.name, | ||
useClass: RecordPositionBackfillJob, | ||
}, | ||
], | ||
}) | ||
export class WorkspaceQueryRunnerJobModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
185 changes: 22 additions & 163 deletions
185
packages/twenty-server/src/engine/integrations/message-queue/jobs.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
.../modules/calendar-messaging-participant/jobs/calendar-messaging-participant-job.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/twenty-server/src/modules/calendar/crons/jobs/calendar-cron-job.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
|
||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; | ||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | ||
import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity'; | ||
import { GoogleCalendarSyncCronJob } from 'src/modules/calendar/crons/jobs/google-calendar-sync.cron.job'; | ||
import { WorkspaceGoogleCalendarSyncModule } from 'src/modules/calendar/services/workspace-google-calendar-sync/workspace-google-calendar-sync.module'; | ||
|
||
@Module({ | ||
imports: [ | ||
TypeOrmModule.forFeature([Workspace, FeatureFlagEntity], 'core'), | ||
TypeOrmModule.forFeature([DataSourceEntity], 'metadata'), | ||
WorkspaceGoogleCalendarSyncModule, | ||
], | ||
providers: [ | ||
{ | ||
provide: GoogleCalendarSyncCronJob.name, | ||
useClass: GoogleCalendarSyncCronJob, | ||
}, | ||
], | ||
}) | ||
export class CalendarCronJobModule {} |
Oops, something went wrong.