From 07c87794119546d99d3ae0e829cdad144757f749 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Wed, 24 Apr 2024 17:45:17 +0200 Subject: [PATCH] Fix broken sync-metadata (#5154) An error has been recently introduced in the sync of fieldMetadata. This PR fixes it Additionnally, we are enabling email for trialing and past_due workspaces. There is an ongoing work to introduce a more robust activationStatus on workspace. --- .../services/workspace-metadata-updater.service.ts | 4 ++-- .../calendar/crons/jobs/google-calendar-sync.cron.job.ts | 2 +- .../crons/jobs/gmail-fetch-messages-from-cache.cron.job.ts | 2 +- .../messaging/crons/jobs/gmail-partial-sync.cron.job.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/services/workspace-metadata-updater.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/services/workspace-metadata-updater.service.ts index 6eb43d925..bcde8e572 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/services/workspace-metadata-updater.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/services/workspace-metadata-updater.service.ts @@ -140,7 +140,7 @@ export class WorkspaceMetadataUpdaterService { */ const updatedFieldMetadataCollection = await this.updateEntities< FieldMetadataEntity<'default'> - >(manager, FieldMetadataEntity, storage.objectMetadataUpdateCollection, [ + >(manager, FieldMetadataEntity, storage.fieldMetadataUpdateCollection, [ 'objectMetadataId', 'workspaceId', ]); @@ -241,7 +241,7 @@ export class WorkspaceMetadataUpdaterService { manager: EntityManager, entityClass: EntityTarget, updateCollection: Array< - DeepPartial> & { id: string } + DeepPartial> & { id: string } >, keysToOmit: (keyof Entity)[] = [], ): Promise<{ current: Entity; altered: Entity }[]> { diff --git a/packages/twenty-server/src/modules/calendar/crons/jobs/google-calendar-sync.cron.job.ts b/packages/twenty-server/src/modules/calendar/crons/jobs/google-calendar-sync.cron.job.ts index 10930e85a..7b6af10f2 100644 --- a/packages/twenty-server/src/modules/calendar/crons/jobs/google-calendar-sync.cron.job.ts +++ b/packages/twenty-server/src/modules/calendar/crons/jobs/google-calendar-sync.cron.job.ts @@ -29,7 +29,7 @@ export class GoogleCalendarSyncCronJob implements MessageQueueJob { const workspaceIds = ( await this.workspaceRepository.find({ where: { - subscriptionStatus: 'active', + subscriptionStatus: In(['active', 'trialing', 'past_due']), }, select: ['id'], }) diff --git a/packages/twenty-server/src/modules/messaging/crons/jobs/gmail-fetch-messages-from-cache.cron.job.ts b/packages/twenty-server/src/modules/messaging/crons/jobs/gmail-fetch-messages-from-cache.cron.job.ts index a9c75fc5e..b9fb6cf7d 100644 --- a/packages/twenty-server/src/modules/messaging/crons/jobs/gmail-fetch-messages-from-cache.cron.job.ts +++ b/packages/twenty-server/src/modules/messaging/crons/jobs/gmail-fetch-messages-from-cache.cron.job.ts @@ -30,7 +30,7 @@ export class GmailFetchMessagesFromCacheCronJob const workspaceIds = ( await this.workspaceRepository.find({ where: { - subscriptionStatus: 'active', + subscriptionStatus: In(['active', 'trialing', 'past_due']), }, select: ['id'], }) diff --git a/packages/twenty-server/src/modules/messaging/crons/jobs/gmail-partial-sync.cron.job.ts b/packages/twenty-server/src/modules/messaging/crons/jobs/gmail-partial-sync.cron.job.ts index 2d6434d40..54cde83f7 100644 --- a/packages/twenty-server/src/modules/messaging/crons/jobs/gmail-partial-sync.cron.job.ts +++ b/packages/twenty-server/src/modules/messaging/crons/jobs/gmail-partial-sync.cron.job.ts @@ -36,7 +36,7 @@ export class GmailPartialSyncCronJob implements MessageQueueJob { const workspaceIds = ( await this.workspaceRepository.find({ where: { - subscriptionStatus: 'active', + subscriptionStatus: In(['active', 'trialing', 'past_due']), }, select: ['id'], })