Fix cron module structure (#4933)

This PR introduces a new folder structure for business modules.
Cron commands and jobs are now stored within the same module/folder at
the root of the business module
e.g: /modules/messaging/crons/commands instead of
/modules/messaging/commands/crons
Patterns are now inside their own cron-command files since they don't
need to be exported
Ideally cronJobs and cronCommands should have their logic within the
same class but it's a bit harder than expected due to how commanderjs
and our worker need both some class heritage check, hence the first
approach is to move them in the same folder

Also Messaging fullsync/partialsync V2 has been dropped since this is
the only used version => Breaking change for ongoing jobs and crons.
Jobs can be dropped but we will need to re-run our crons (only
cron:messaging:gmail-fetch-messages-from-cache)
This commit is contained in:
Weiko
2024-04-12 14:43:03 +02:00
committed by GitHub
parent a6b38d76ce
commit f4fda221b7
18 changed files with 136 additions and 122 deletions

View File

@ -1,21 +1,23 @@
import { Module } from '@nestjs/common';
import { DatabaseCommandModule } from 'src/database/commands/database-command.module';
import { MessagingCommandModule } from 'src/modules/messaging/commands/messaging-command.module';
import { WorkspaceHealthCommandModule } from 'src/engine/workspace-manager/workspace-health/commands/workspace-health-command.module';
import { WorkspaceCleanerModule } from 'src/engine/workspace-manager/workspace-cleaner/workspace-cleaner.module';
import { WorkspaceCalendarSyncCommandsModule } from 'src/modules/calendar/commands/workspace-calendar-sync-commands.module';
import { CalendarCronCommandsModule } from 'src/modules/calendar/crons/commands/calendar-cron-commands.module';
import { AppModule } from 'src/app.module';
import { WorkspaceMigrationRunnerCommandsModule } from 'src/engine/workspace-manager/workspace-migration-runner/commands/workspace-sync-metadata-commands.module';
import { WorkspaceSyncMetadataCommandsModule } from 'src/engine/workspace-manager/workspace-sync-metadata/commands/workspace-sync-metadata-commands.module';
import { MessagingCronCommandsModule } from 'src/modules/messaging/crons/commands/messaging-cron-commands.module';
import { CalendarCommandsModule } from 'src/modules/calendar/commands/calendar-commands.module';
@Module({
imports: [
AppModule,
WorkspaceSyncMetadataCommandsModule,
DatabaseCommandModule,
MessagingCommandModule,
WorkspaceCalendarSyncCommandsModule,
MessagingCronCommandsModule,
CalendarCronCommandsModule,
CalendarCommandsModule,
WorkspaceCleanerModule,
WorkspaceHealthCommandModule,
WorkspaceMigrationRunnerCommandsModule,