From 2d12984db48766291fc69243e5d03ac4d69cb45a Mon Sep 17 00:00:00 2001 From: bosiraphael <71827178+bosiraphael@users.noreply.github.com> Date: Mon, 3 Jun 2024 13:22:49 +0200 Subject: [PATCH] 5613 add throttlepauseuntil and throttlefailurecount fields to messagechannel and calendarchannel (#5713) Closes #5613 --- .../constants/standard-field-ids.ts | 4 ++++ .../calendar-channel.workspace-entity.ts | 21 +++++++++++++++++++ .../message-channel.workspace-entity.ts | 20 ++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts index c051213ae0..0acd8fe31f 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts @@ -70,6 +70,8 @@ export const CALENDAR_CHANNEL_STANDARD_FIELD_IDS = { isSyncEnabled: '20202020-fe19-4818-8854-21f7b1b43395', syncCursor: '20202020-bac2-4852-a5cb-7a7898992b70', calendarChannelEventAssociations: '20202020-afb0-4a9f-979f-2d5087d71d09', + throttlePauseUntil: '20202020-16e8-40ca-be79-a3af4787af2c', + throttleFailureCount: '20202020-525c-4b76-b9bd-0dd57fd11d61', }; export const CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS = { @@ -208,6 +210,8 @@ export const MESSAGE_CHANNEL_STANDARD_FIELD_IDS = { syncStatus: '20202020-56a1-4f7e-9880-a8493bb899cc', syncSubStatus: '20202020-7979-4b08-89fe-99cb5e698767', ongoingSyncStartedAt: '20202020-8c61-4a42-ae63-73c1c3c52e06', + throttlePauseUntil: '20202020-a8cb-475b-868c-b83538614df4', + throttleFailureCount: '20202020-0291-42be-9ad0-d578a51684ab', }; export const MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS = { diff --git a/packages/twenty-server/src/modules/calendar/standard-objects/calendar-channel.workspace-entity.ts b/packages/twenty-server/src/modules/calendar/standard-objects/calendar-channel.workspace-entity.ts index 0fff9a8864..0bf11a6ae7 100644 --- a/packages/twenty-server/src/modules/calendar/standard-objects/calendar-channel.workspace-entity.ts +++ b/packages/twenty-server/src/modules/calendar/standard-objects/calendar-channel.workspace-entity.ts @@ -15,6 +15,7 @@ import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator'; import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator'; import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator'; +import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator'; export enum CalendarChannelVisibility { METADATA = 'METADATA', @@ -96,6 +97,26 @@ export class CalendarChannelWorkspaceEntity extends BaseWorkspaceEntity { }) syncCursor: string; + @WorkspaceField({ + standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.throttlePauseUntil, + type: FieldMetadataType.DATE_TIME, + label: 'Throttle Pause Until', + description: 'Throttle Pause Until', + icon: 'IconPlayerPause', + }) + @WorkspaceIsNullable() + throttlePauseUntil: Date; + + @WorkspaceField({ + standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.throttleFailureCount, + type: FieldMetadataType.NUMBER, + label: 'Throttle Failure Count', + description: 'Throttle Failure Count', + icon: 'IconX', + defaultValue: 0, + }) + throttleFailureCount: number; + @WorkspaceRelation({ standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.connectedAccount, type: RelationMetadataType.MANY_TO_ONE, 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 b457677a6b..ae24cc6020 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 @@ -284,6 +284,26 @@ export class MessageChannelWorkspaceEntity extends BaseWorkspaceEntity { @WorkspaceIsNullable() ongoingSyncStartedAt: string; + @WorkspaceField({ + standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.throttlePauseUntil, + type: FieldMetadataType.DATE_TIME, + label: 'Throttle Pause Until', + description: 'Throttle Pause Until', + icon: 'IconPlayerPause', + }) + @WorkspaceIsNullable() + throttlePauseUntil: Date; + + @WorkspaceField({ + standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.throttleFailureCount, + type: FieldMetadataType.NUMBER, + label: 'Throttle Failure Count', + description: 'Throttle Failure Count', + icon: 'IconX', + defaultValue: 0, + }) + throttleFailureCount: number; + @WorkspaceRelation({ standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.connectedAccount, type: RelationMetadataType.MANY_TO_ONE,