[messaing] improve messaging import (#4650)
* [messaging] improve full-sync fetching strategy * fix * rebase * fix * fix * fix rebase * fix * fix * fix * fix * fix * remove deletion * fix setPop with memory storage * fix pgBoss and remove unnecessary job * fix throw * fix * add timeout to ongoing sync
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { FeatureFlagKeys } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import {
|
||||
RelationMetadataType,
|
||||
@ -6,6 +7,7 @@ import {
|
||||
import { messageChannelStandardFieldIds } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { standardObjectIds } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
||||
@ -14,6 +16,13 @@ import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-
|
||||
import { ConnectedAccountObjectMetadata } from 'src/modules/connected-account/standard-objects/connected-account.object-metadata';
|
||||
import { MessageChannelMessageAssociationObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel-message-association.object-metadata';
|
||||
|
||||
export enum MessageChannelSyncStatus {
|
||||
PENDING = 'PENDING',
|
||||
ONGOING = 'ONGOING',
|
||||
SUCCEEDED = 'SUCCEEDED',
|
||||
FAILED = 'FAILED',
|
||||
}
|
||||
|
||||
@ObjectMetadata({
|
||||
standardId: standardObjectIds.messageChannel,
|
||||
namePlural: 'messageChannels',
|
||||
@ -102,4 +111,81 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
||||
})
|
||||
@IsNullable()
|
||||
messageChannelMessageAssociations: MessageChannelMessageAssociationObjectMetadata[];
|
||||
|
||||
@FieldMetadata({
|
||||
standardId: messageChannelStandardFieldIds.syncExternalId,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Last sync external ID',
|
||||
description: 'Last sync external ID',
|
||||
icon: 'IconHistory',
|
||||
})
|
||||
@Gate({
|
||||
featureFlag: FeatureFlagKeys.IsFullSyncV2Enabled,
|
||||
})
|
||||
syncExternalId: string;
|
||||
|
||||
@FieldMetadata({
|
||||
standardId: messageChannelStandardFieldIds.syncedAt,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
label: 'Last sync date',
|
||||
description: 'Last sync date',
|
||||
icon: 'IconHistory',
|
||||
})
|
||||
@Gate({
|
||||
featureFlag: FeatureFlagKeys.IsFullSyncV2Enabled,
|
||||
})
|
||||
@IsNullable()
|
||||
syncedAt: string;
|
||||
|
||||
@FieldMetadata({
|
||||
standardId: messageChannelStandardFieldIds.syncStatus,
|
||||
type: FieldMetadataType.SELECT,
|
||||
label: 'Last sync status',
|
||||
description: 'Last sync status',
|
||||
icon: 'IconHistory',
|
||||
options: [
|
||||
{
|
||||
value: MessageChannelSyncStatus.PENDING,
|
||||
label: 'Pending',
|
||||
position: 0,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
value: MessageChannelSyncStatus.ONGOING,
|
||||
label: 'Ongoing',
|
||||
position: 1,
|
||||
color: 'yellow',
|
||||
},
|
||||
{
|
||||
value: MessageChannelSyncStatus.SUCCEEDED,
|
||||
label: 'Succeeded',
|
||||
position: 2,
|
||||
color: 'green',
|
||||
},
|
||||
{
|
||||
value: MessageChannelSyncStatus.FAILED,
|
||||
label: 'Failed',
|
||||
position: 3,
|
||||
color: 'red',
|
||||
},
|
||||
],
|
||||
})
|
||||
@Gate({
|
||||
featureFlag: FeatureFlagKeys.IsFullSyncV2Enabled,
|
||||
})
|
||||
@IsNullable()
|
||||
syncStatus: MessageChannelSyncStatus;
|
||||
|
||||
@FieldMetadata({
|
||||
standardId: messageChannelStandardFieldIds.ongoingSyncStartedAt,
|
||||
type: FieldMetadataType.DATE_TIME,
|
||||
label: 'Ongoing sync started at',
|
||||
description: 'Ongoing sync started at',
|
||||
icon: 'IconHistory',
|
||||
})
|
||||
@Gate({
|
||||
featureFlag: FeatureFlagKeys.IsFullSyncV2Enabled,
|
||||
})
|
||||
@IsNullable()
|
||||
ongoingSyncStartedAt: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user