diff --git a/packages/twenty-front/src/modules/accounts/types/CalendarChannel.ts b/packages/twenty-front/src/modules/accounts/types/CalendarChannel.ts index c0cff271db..5805bc731a 100644 --- a/packages/twenty-front/src/modules/accounts/types/CalendarChannel.ts +++ b/packages/twenty-front/src/modules/accounts/types/CalendarChannel.ts @@ -10,8 +10,6 @@ export enum CalendarChannelSyncStatus { export enum CalendarChannelSyncStage { PENDING_CONFIGURATION = 'PENDING_CONFIGURATION', - FULL_CALENDAR_EVENT_LIST_FETCH_PENDING = 'FULL_CALENDAR_EVENT_LIST_FETCH_PENDING', // WILL BE DEPRECATED - PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING = 'PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING', // DEPRECATED CALENDAR_EVENT_LIST_FETCH_PENDING = 'CALENDAR_EVENT_LIST_FETCH_PENDING', CALENDAR_EVENT_LIST_FETCH_SCHEDULED = 'CALENDAR_EVENT_LIST_FETCH_SCHEDULED', CALENDAR_EVENT_LIST_FETCH_ONGOING = 'CALENDAR_EVENT_LIST_FETCH_ONGOING', diff --git a/packages/twenty-front/src/modules/accounts/types/MessageChannel.ts b/packages/twenty-front/src/modules/accounts/types/MessageChannel.ts index 92fd9a44bd..c963e10f4c 100644 --- a/packages/twenty-front/src/modules/accounts/types/MessageChannel.ts +++ b/packages/twenty-front/src/modules/accounts/types/MessageChannel.ts @@ -24,8 +24,6 @@ export enum MessageChannelSyncStatus { export enum MessageChannelSyncStage { PENDING_CONFIGURATION = 'PENDING_CONFIGURATION', - FULL_MESSAGE_LIST_FETCH_PENDING = 'FULL_MESSAGE_LIST_FETCH_PENDING', // WILL BE DEPRECATED - PARTIAL_MESSAGE_LIST_FETCH_PENDING = 'PARTIAL_MESSAGE_LIST_FETCH_PENDING', // DEPRECATED MESSAGE_LIST_FETCH_PENDING = 'MESSAGE_LIST_FETCH_PENDING', MESSAGE_LIST_FETCH_SCHEDULED = 'MESSAGE_LIST_FETCH_SCHEDULED', MESSAGE_LIST_FETCH_ONGOING = 'MESSAGE_LIST_FETCH_ONGOING', diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsCalendars.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsCalendars.stories.tsx index 897c84fcbf..d2e9ccafce 100644 --- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsCalendars.stories.tsx +++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsCalendars.stories.tsx @@ -95,7 +95,7 @@ export const TwoConnectedAccounts: Story = { connectedAccountId: '20202020-954c-4d76-9a87-e5f072d4b7ef', contactAutoCreationPolicy: 'SENT', - syncStage: 'FULL_CALENDAR_EVENT_LIST_FETCH_PENDING', + syncStage: 'CALENDAR_EVENT_LIST_FETCH_PENDING', type: 'email', isContactAutoCreationEnabled: true, syncCursor: '1562764', diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsEmails.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsEmails.stories.tsx index 57273f5930..63c528a9d1 100644 --- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsEmails.stories.tsx +++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccountsEmails.stories.tsx @@ -96,7 +96,7 @@ export const TwoConnectedAccounts: Story = { connectedAccountId: '20202020-954c-4d76-9a87-e5f072d4b7ef', contactAutoCreationPolicy: 'SENT', - syncStage: 'FULL_MESSAGE_LIST_FETCH_PENDING', + syncStage: 'MESSAGE_LIST_FETCH_PENDING', type: 'email', isContactAutoCreationEnabled: true, syncCursor: '1562764', @@ -122,7 +122,7 @@ export const TwoConnectedAccounts: Story = { connectedAccountId: '20202020-954c-4d76-9a87-e5f072d4b7ef', contactAutoCreationPolicy: 'SENT', - syncStage: 'FULL_MESSAGE_LIST_FETCH_PENDING', + syncStage: 'MESSAGE_LIST_FETCH_PENDING', type: 'email', isContactAutoCreationEnabled: true, syncCursor: '1562764', diff --git a/packages/twenty-front/src/testing/mock-data/generated/mock-metadata-query-result.ts b/packages/twenty-front/src/testing/mock-data/generated/mock-metadata-query-result.ts index 58971b671c..196b199812 100644 --- a/packages/twenty-front/src/testing/mock-data/generated/mock-metadata-query-result.ts +++ b/packages/twenty-front/src/testing/mock-data/generated/mock-metadata-query-result.ts @@ -17300,13 +17300,13 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery = "isUnique": false, "createdAt": "2025-06-09T18:53:47.000Z", "updatedAt": "2025-06-09T18:53:47.000Z", - "defaultValue": "'FULL_CALENDAR_EVENT_LIST_FETCH_PENDING'", + "defaultValue": "'CALENDAR_EVENT_LIST_FETCH_PENDING'", "options": [ { "id": "a63c16e1-fe1e-40ff-9380-118f16b30a16", "color": "blue", "label": "Full calendar event list fetch pending", - "value": "FULL_CALENDAR_EVENT_LIST_FETCH_PENDING", + "value": "CALENDAR_EVENT_LIST_FETCH_PENDING", "position": 0 }, { @@ -18145,22 +18145,15 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery = "isUnique": false, "createdAt": "2025-06-09T18:53:47.000Z", "updatedAt": "2025-06-09T18:53:47.000Z", - "defaultValue": "'FULL_MESSAGE_LIST_FETCH_PENDING'", + "defaultValue": "'MESSAGE_LIST_FETCH_PENDING'", "options": [ { "id": "60f0c071-4375-4e1c-ac0f-3b6c64cb35b3", "color": "blue", - "label": "Full messages list fetch pending", - "value": "FULL_MESSAGE_LIST_FETCH_PENDING", + "label": "Messages list fetch pending", + "value": "MESSAGE_LIST_FETCH_PENDING", "position": 0 }, - { - "id": "0728c8f0-8c9f-4a01-9ccc-d3ff68e64d12", - "color": "blue", - "label": "Partial messages list fetch pending", - "value": "PARTIAL_MESSAGE_LIST_FETCH_PENDING", - "position": 1 - }, { "id": "ec623d96-5b17-4a67-8206-d475a76b2f31", "color": "orange", diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/reset-calendar-channel.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/reset-calendar-channel.service.ts index 03950de33b..f350cd8584 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/reset-calendar-channel.service.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/reset-calendar-channel.service.ts @@ -35,8 +35,7 @@ export class ResetCalendarChannelService { connectedAccountId, }, { - syncStage: - CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING, + syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING, syncStatus: null, syncCursor: '', syncStageStartedAt: null, diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/reset-message-channel.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/reset-message-channel.service.ts index b08bc9f0e9..5ba9bcf91f 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/reset-message-channel.service.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/reset-message-channel.service.ts @@ -34,7 +34,7 @@ export class ResetMessageChannelService { connectedAccountId, }, { - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, syncStatus: MessageChannelSyncStatus.ONGOING, syncCursor: '', syncStageStartedAt: null, diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/data/constants/message-channel-data-seeds.constant.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/data/constants/message-channel-data-seeds.constant.ts index 4f0ca4195a..1d1e1dd0b2 100644 --- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/data/constants/message-channel-data-seeds.constant.ts +++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/data/constants/message-channel-data-seeds.constant.ts @@ -59,7 +59,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [ handle: 'tim@apple.dev', isSyncEnabled: true, visibility: MessageChannelVisibility.SHARE_EVERYTHING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }, { id: MESSAGE_CHANNEL_DATA_SEED_IDS.JONY, @@ -72,7 +72,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [ handle: 'jony.ive@apple.dev', isSyncEnabled: true, visibility: MessageChannelVisibility.SHARE_EVERYTHING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }, { id: MESSAGE_CHANNEL_DATA_SEED_IDS.PHIL, @@ -85,7 +85,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [ handle: 'phil.schiler@apple.dev', isSyncEnabled: true, visibility: MessageChannelVisibility.SHARE_EVERYTHING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }, { id: MESSAGE_CHANNEL_DATA_SEED_IDS.SUPPORT, @@ -98,7 +98,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [ handle: 'support@apple.dev', isSyncEnabled: true, visibility: MessageChannelVisibility.SHARE_EVERYTHING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }, { id: MESSAGE_CHANNEL_DATA_SEED_IDS.SALES, @@ -111,6 +111,6 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [ handle: 'sales@apple.dev', isSyncEnabled: true, visibility: MessageChannelVisibility.SHARE_EVERYTHING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }, ]; diff --git a/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-reimport-calendar-events.job.ts b/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-reimport-calendar-events.job.ts index 256eeb6373..e6bcd8a16c 100644 --- a/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-reimport-calendar-events.job.ts +++ b/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-reimport-calendar-events.job.ts @@ -49,7 +49,7 @@ export class BlocklistReimportCalendarEventsJob { accountOwnerId: workspaceMemberId, }, syncStage: Not( - CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING, + CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING, ), }, }); diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/commands/calendar-relaunch-failed-calendar-channels.command.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/commands/calendar-relaunch-failed-calendar-channels.command.ts index 58a1b777fb..09eef091b5 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/commands/calendar-relaunch-failed-calendar-channels.command.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/commands/calendar-relaunch-failed-calendar-channels.command.ts @@ -58,7 +58,7 @@ export class CalendarRelaunchFailedCalendarChannelsCommand extends ActiveOrSuspe failedCalendarChannels.map(({ id }) => id), { syncStage: - CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING, + CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING, syncStatus: CalendarChannelSyncStatus.ACTIVE, }, ); diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job.ts index e445d77912..d52310f45c 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job.ts @@ -51,7 +51,7 @@ export class CalendarEventListFetchCronJob { const schemaName = getWorkspaceSchemaName(activeWorkspace.id); const calendarChannels = await this.coreDataSource.query( - `SELECT * FROM ${schemaName}."calendarChannel" WHERE "isSyncEnabled" = true AND "syncStage" IN ('${CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING}', '${CalendarChannelSyncStage.PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING}')`, + `SELECT * FROM ${schemaName}."calendarChannel" WHERE "isSyncEnabled" = true AND "syncStage" IN ('${CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING}')`, ); for (const calendarChannel of calendarChannels) { diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.ts index 20595bf7da..8e061d8265 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.ts @@ -58,8 +58,7 @@ export class CalendarEventListFetchJob { switch (calendarChannel.syncStage) { case CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_SCHEDULED: - case CalendarChannelSyncStage.PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING: // DEPRECATED - case CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING: // WILL BE DEPRECATED + case CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING: await this.calendarFetchEventsService.fetchCalendarEvents( calendarChannel, calendarChannel.connectedAccount, diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts index 9eda6f77bb..39f941dd0f 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-event-import-exception-handler.service.ts @@ -18,8 +18,7 @@ import { import { CalendarChannelSyncStatusService } from 'src/modules/calendar/common/services/calendar-channel-sync-status.service'; import { type CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity'; export enum CalendarEventImportSyncStep { - FULL_CALENDAR_EVENT_LIST_FETCH = 'FULL_CALENDAR_EVENT_LIST_FETCH', - PARTIAL_CALENDAR_EVENT_LIST_FETCH = 'PARTIAL_CALENDAR_EVENT_LIST_FETCH', + CALENDAR_EVENT_LIST_FETCH = 'CALENDAR_EVENT_LIST_FETCH', CALENDAR_EVENTS_IMPORT = 'CALENDAR_EVENTS_IMPORT', } @@ -129,13 +128,7 @@ export class CalendarEventImportErrorHandlerService { ); switch (syncStep) { - case CalendarEventImportSyncStep.FULL_CALENDAR_EVENT_LIST_FETCH: - await this.calendarChannelSyncStatusService.scheduleCalendarEventListFetch( - [calendarChannel.id], - ); - break; - - case CalendarEventImportSyncStep.PARTIAL_CALENDAR_EVENT_LIST_FETCH: + case CalendarEventImportSyncStep.CALENDAR_EVENT_LIST_FETCH: await this.calendarChannelSyncStatusService.scheduleCalendarEventListFetch( [calendarChannel.id], ); @@ -199,9 +192,7 @@ export class CalendarEventImportErrorHandlerService { calendarChannel: Pick, workspaceId: string, ): Promise { - if ( - syncStep === CalendarEventImportSyncStep.FULL_CALENDAR_EVENT_LIST_FETCH - ) { + if (syncStep === CalendarEventImportSyncStep.CALENDAR_EVENT_LIST_FETCH) { return; } diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-fetch-events.service.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-fetch-events.service.ts index 75b2ef4921..2bb64f24f9 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-fetch-events.service.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-fetch-events.service.ts @@ -16,10 +16,7 @@ import { import { CalendarEventsImportService } from 'src/modules/calendar/calendar-event-import-manager/services/calendar-events-import.service'; import { CalendarGetCalendarEventsService } from 'src/modules/calendar/calendar-event-import-manager/services/calendar-get-events.service'; import { CalendarChannelSyncStatusService } from 'src/modules/calendar/common/services/calendar-channel-sync-status.service'; -import { - CalendarChannelSyncStage, - type CalendarChannelWorkspaceEntity, -} from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity'; +import { type CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity'; import { type ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; @Injectable() @@ -41,12 +38,6 @@ export class CalendarFetchEventsService { connectedAccount: ConnectedAccountWorkspaceEntity, workspaceId: string, ): Promise { - const syncStep = - calendarChannel.syncStage === - CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING - ? CalendarEventImportSyncStep.FULL_CALENDAR_EVENT_LIST_FETCH - : CalendarEventImportSyncStep.PARTIAL_CALENDAR_EVENT_LIST_FETCH; - await this.calendarChannelSyncStatusService.markAsCalendarEventListFetchOngoing( [calendarChannel.id], ); @@ -142,7 +133,7 @@ export class CalendarFetchEventsService { this.logger.error(error); await this.calendarEventImportErrorHandlerService.handleDriverException( error, - syncStep, + CalendarEventImportSyncStep.CALENDAR_EVENT_LIST_FETCH, calendarChannel, workspaceId, ); diff --git a/packages/twenty-server/src/modules/calendar/common/services/calendar-channel-sync-status.service.ts b/packages/twenty-server/src/modules/calendar/common/services/calendar-channel-sync-status.service.ts index 02d1fd77a5..503dbbc549 100644 --- a/packages/twenty-server/src/modules/calendar/common/services/calendar-channel-sync-status.service.ts +++ b/packages/twenty-server/src/modules/calendar/common/services/calendar-channel-sync-status.service.ts @@ -38,8 +38,7 @@ export class CalendarChannelSyncStatusService { ); await calendarChannelRepository.update(calendarChannelIds, { - syncStage: - CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING, + syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING, }); } @@ -149,8 +148,7 @@ export class CalendarChannelSyncStatusService { ); await calendarChannelRepository.update(calendarChannelIds, { - syncStage: - CalendarChannelSyncStage.PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING, + syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING, syncStatus: CalendarChannelSyncStatus.ACTIVE, throttleFailureCount: 0, syncStageStartedAt: null, diff --git a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity.ts b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity.ts index f19fa44914..00f3d429b2 100644 --- a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity.ts +++ b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity.ts @@ -36,8 +36,6 @@ export enum CalendarChannelSyncStatus { export enum CalendarChannelSyncStage { PENDING_CONFIGURATION = 'PENDING_CONFIGURATION', - FULL_CALENDAR_EVENT_LIST_FETCH_PENDING = 'FULL_CALENDAR_EVENT_LIST_FETCH_PENDING', // WILL BE DEPRECATED - PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING = 'PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING', // DEPRECATED CALENDAR_EVENT_LIST_FETCH_PENDING = 'CALENDAR_EVENT_LIST_FETCH_PENDING', CALENDAR_EVENT_LIST_FETCH_SCHEDULED = 'CALENDAR_EVENT_LIST_FETCH_SCHEDULED', CALENDAR_EVENT_LIST_FETCH_ONGOING = 'CALENDAR_EVENT_LIST_FETCH_ONGOING', @@ -182,19 +180,6 @@ export class CalendarChannelWorkspaceEntity extends BaseWorkspaceEntity { position: 6, color: 'red', }, - { - value: CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING, - label: 'Full calendar event list fetch pending', - position: 7, - color: 'blue', - }, - { - value: - CalendarChannelSyncStage.PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING, - label: 'Partial calendar event list fetch pending', - position: 8, - color: 'blue', - }, { value: CalendarChannelSyncStage.PENDING_CONFIGURATION, label: 'Pending configuration', diff --git a/packages/twenty-server/src/modules/connected-account/services/imap-smtp-caldav-apis.service.spec.ts b/packages/twenty-server/src/modules/connected-account/services/imap-smtp-caldav-apis.service.spec.ts index 2c08301b5f..757d629a74 100644 --- a/packages/twenty-server/src/modules/connected-account/services/imap-smtp-caldav-apis.service.spec.ts +++ b/packages/twenty-server/src/modules/connected-account/services/imap-smtp-caldav-apis.service.spec.ts @@ -124,7 +124,7 @@ describe('ImapSmtpCalDavAPIService', () => { handle: 'test@example.com', isSyncEnabled: true, syncStatus: MessageChannelSyncStatus.ONGOING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, syncCursor: '', syncStageStartedAt: null, }; @@ -154,7 +154,7 @@ describe('ImapSmtpCalDavAPIService', () => { handle: 'test@example.com', isSyncEnabled: true, syncStatus: MessageChannelSyncStatus.ONGOING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, syncCursor: '', syncStageStartedAt: null, }, @@ -254,7 +254,7 @@ describe('ImapSmtpCalDavAPIService', () => { handle: 'test@example.com', isSyncEnabled: true, syncStatus: MessageChannelSyncStatus.ONGOING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }; mockMessageChannelRepository.save.mockResolvedValue( @@ -363,7 +363,7 @@ describe('ImapSmtpCalDavAPIService', () => { handle: 'test@example.com', isSyncEnabled: true, syncStatus: MessageChannelSyncStatus.ONGOING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }; mockMessageChannelRepository.save.mockResolvedValue( @@ -422,7 +422,7 @@ describe('ImapSmtpCalDavAPIService', () => { handle: 'test@example.com', isSyncEnabled: true, syncStatus: MessageChannelSyncStatus.ONGOING, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }; const expectedCalendarChannel = { diff --git a/packages/twenty-server/src/modules/connected-account/services/imap-smtp-caldav-apis.service.ts b/packages/twenty-server/src/modules/connected-account/services/imap-smtp-caldav-apis.service.ts index 31f952bc62..491e4801e9 100644 --- a/packages/twenty-server/src/modules/connected-account/services/imap-smtp-caldav-apis.service.ts +++ b/packages/twenty-server/src/modules/connected-account/services/imap-smtp-caldav-apis.service.ts @@ -172,7 +172,7 @@ export class ImapSmtpCalDavAPIService { ? MessageChannelSyncStatus.ONGOING : MessageChannelSyncStatus.NOT_SYNCED, syncStage: shouldEnableSync - ? MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING + ? MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING : undefined, syncCursor: '', syncStageStartedAt: null, @@ -202,8 +202,7 @@ export class ImapSmtpCalDavAPIService { handle: input.handle, isSyncEnabled: shouldEnableSync, syncStatus: CalendarChannelSyncStatus.ONGOING, - syncStage: - CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING, + syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING, syncCursor: '', syncStageStartedAt: null, }, diff --git a/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job.ts b/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job.ts index b51e1be42e..4ae2f314f3 100644 --- a/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job.ts +++ b/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job.ts @@ -48,9 +48,7 @@ export class BlocklistReimportMessagesJob { connectedAccount: { accountOwnerId: workspaceMemberId, }, - syncStage: Not( - MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, - ), + syncStage: Not(MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING), }, }); diff --git a/packages/twenty-server/src/modules/messaging/common/services/message-channel-sync-status.service.ts b/packages/twenty-server/src/modules/messaging/common/services/message-channel-sync-status.service.ts index 8e0bbe7d37..51bc3ae092 100644 --- a/packages/twenty-server/src/modules/messaging/common/services/message-channel-sync-status.service.ts +++ b/packages/twenty-server/src/modules/messaging/common/services/message-channel-sync-status.service.ts @@ -38,7 +38,7 @@ export class MessageChannelSyncStatusService { ); await messageChannelRepository.update(messageChannelIds, { - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, }); } @@ -131,7 +131,7 @@ export class MessageChannelSyncStatusService { await messageChannelRepository.update(messageChannelIds, { syncStatus: MessageChannelSyncStatus.ACTIVE, - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, throttleFailureCount: 0, syncStageStartedAt: null, syncedAt: new Date().toISOString(), diff --git a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel.workspace-entity.ts b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel.workspace-entity.ts index 17a9ba0517..648148600c 100644 --- a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel.workspace-entity.ts +++ b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel.workspace-entity.ts @@ -32,8 +32,6 @@ export enum MessageChannelSyncStatus { export enum MessageChannelSyncStage { PENDING_CONFIGURATION = 'PENDING_CONFIGURATION', - FULL_MESSAGE_LIST_FETCH_PENDING = 'FULL_MESSAGE_LIST_FETCH_PENDING', // WILL BE DEPRECATED - PARTIAL_MESSAGE_LIST_FETCH_PENDING = 'PARTIAL_MESSAGE_LIST_FETCH_PENDING', // DEPRECATED MESSAGE_LIST_FETCH_PENDING = 'MESSAGE_LIST_FETCH_PENDING', MESSAGE_LIST_FETCH_SCHEDULED = 'MESSAGE_LIST_FETCH_SCHEDULED', MESSAGE_LIST_FETCH_ONGOING = 'MESSAGE_LIST_FETCH_ONGOING', @@ -419,22 +417,10 @@ export class MessageChannelWorkspaceEntity extends BaseWorkspaceEntity { position: 6, color: 'red', }, - { - value: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, // WILL BE DEPRECATED - label: 'Full messages list fetch pending', - position: 7, - color: 'blue', - }, - { - value: MessageChannelSyncStage.PARTIAL_MESSAGE_LIST_FETCH_PENDING, // DEPRECATED - label: 'Partial messages list fetch pending', - position: 8, - color: 'blue', - }, { value: MessageChannelSyncStage.PENDING_CONFIGURATION, label: 'Pending configuration', - position: 9, + position: 7, color: 'gray', }, ], diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/commands/messaging-relaunch-failed-message-channels.command.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/commands/messaging-relaunch-failed-message-channels.command.ts index 4316b9e66c..420bcc2932 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/commands/messaging-relaunch-failed-message-channels.command.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/commands/messaging-relaunch-failed-message-channels.command.ts @@ -57,7 +57,7 @@ export class MessagingRelaunchFailedMessageChannelsCommand extends ActiveOrSuspe await messageChannelRepository.update( failedMessageChannels.map(({ id }) => id), { - syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, + syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING, syncStatus: MessageChannelSyncStatus.ACTIVE, }, ); diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job.ts index a22bcce6b0..4063e0d270 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job.ts @@ -48,9 +48,8 @@ export class MessagingMessageListFetchCronJob { try { const schemaName = getWorkspaceSchemaName(activeWorkspace.id); - // TODO: deprecate looking for FULL_MESSAGE_LIST_FETCH_PENDING as we introduce MESSAGE_LIST_FETCH_PENDING const messageChannels = await this.coreDataSource.query( - `SELECT * FROM ${schemaName}."messageChannel" WHERE "isSyncEnabled" = true AND "syncStage" IN ('${MessageChannelSyncStage.PARTIAL_MESSAGE_LIST_FETCH_PENDING}', '${MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING}')`, + `SELECT * FROM ${schemaName}."messageChannel" WHERE "isSyncEnabled" = true AND "syncStage" IN ('${MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING}')`, ); for (const messageChannel of messageChannels) { diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.ts index a6a30236bc..bc1d4fe8d4 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.ts @@ -77,10 +77,8 @@ export class MessagingMessageListFetchJob { switch (messageChannel.syncStage) { case MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING: - case MessageChannelSyncStage.PARTIAL_MESSAGE_LIST_FETCH_PENDING: // DEPRECATED - case MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING: // WILL BE DEPRECATED await this.messagingMonitoringService.track({ - eventName: 'full_message_list_fetch.started', + eventName: 'message_list_fetch.started', workspaceId, connectedAccountId: messageChannel.connectedAccount.id, messageChannelId: messageChannel.id, @@ -92,7 +90,7 @@ export class MessagingMessageListFetchJob { ); await this.messagingMonitoringService.track({ - eventName: 'full_message_list_fetch.completed', + eventName: 'message_list_fetch.completed', workspaceId, connectedAccountId: messageChannel.connectedAccount.id, messageChannelId: messageChannel.id, diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.spec.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.spec.ts index 91ca202458..f973b916cf 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.spec.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.spec.ts @@ -194,7 +194,7 @@ describe('MessagingMessagesImportService', () => { it('should fails if SyncStage is not MESSAGES_IMPORT_PENDING', async () => { mockMessageChannel.syncStage = - MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING; + MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING; expect( service.processMessageBatchImport(