5483 modify messagechannel syncstatus (#5484)
- Closes #5483 - Fix seeds - Add default value to syncSubStatus
This commit is contained in:
@ -41,7 +41,7 @@ export const seedConnectedAccount = async (
|
|||||||
refreshToken: 'exampleRefreshToken',
|
refreshToken: 'exampleRefreshToken',
|
||||||
accessToken: 'exampleAccessToken',
|
accessToken: 'exampleAccessToken',
|
||||||
provider: 'google',
|
provider: 'google',
|
||||||
handle: 'incoming',
|
handle: 'tim@apple.dev',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: DEV_SEED_CONNECTED_ACCOUNT_IDS.JONY,
|
id: DEV_SEED_CONNECTED_ACCOUNT_IDS.JONY,
|
||||||
@ -53,7 +53,7 @@ export const seedConnectedAccount = async (
|
|||||||
refreshToken: 'exampleRefreshToken',
|
refreshToken: 'exampleRefreshToken',
|
||||||
accessToken: 'exampleAccessToken',
|
accessToken: 'exampleAccessToken',
|
||||||
provider: 'google',
|
provider: 'google',
|
||||||
handle: 'incoming',
|
handle: 'jony.ive@apple.dev',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: DEV_SEED_CONNECTED_ACCOUNT_IDS.PHIL,
|
id: DEV_SEED_CONNECTED_ACCOUNT_IDS.PHIL,
|
||||||
@ -65,7 +65,7 @@ export const seedConnectedAccount = async (
|
|||||||
refreshToken: 'exampleRefreshToken',
|
refreshToken: 'exampleRefreshToken',
|
||||||
accessToken: 'exampleAccessToken',
|
accessToken: 'exampleAccessToken',
|
||||||
provider: 'google',
|
provider: 'google',
|
||||||
handle: 'incoming',
|
handle: 'phil.schiler@apple.dev',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
.execute();
|
.execute();
|
||||||
|
|||||||
@ -41,7 +41,7 @@ export const seedMessageChannelMessageAssociation = async (
|
|||||||
messageThreadId: DEV_SEED_MESSAGE_THREAD_IDS.MESSAGE_THREAD_1,
|
messageThreadId: DEV_SEED_MESSAGE_THREAD_IDS.MESSAGE_THREAD_1,
|
||||||
messageExternalId: null,
|
messageExternalId: null,
|
||||||
messageId: DEV_SEED_MESSAGE_IDS.MESSAGE_1,
|
messageId: DEV_SEED_MESSAGE_IDS.MESSAGE_1,
|
||||||
messageChannelId: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM_INCOMING,
|
messageChannelId: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: DEV_SEED_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_IDS.MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_2,
|
id: DEV_SEED_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_IDS.MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_2,
|
||||||
@ -52,7 +52,7 @@ export const seedMessageChannelMessageAssociation = async (
|
|||||||
messageThreadId: DEV_SEED_MESSAGE_THREAD_IDS.MESSAGE_THREAD_2,
|
messageThreadId: DEV_SEED_MESSAGE_THREAD_IDS.MESSAGE_THREAD_2,
|
||||||
messageExternalId: null,
|
messageExternalId: null,
|
||||||
messageId: DEV_SEED_MESSAGE_IDS.MESSAGE_2,
|
messageId: DEV_SEED_MESSAGE_IDS.MESSAGE_2,
|
||||||
messageChannelId: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM_INCOMING,
|
messageChannelId: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: DEV_SEED_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_IDS.MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_3,
|
id: DEV_SEED_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_IDS.MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_3,
|
||||||
@ -63,7 +63,7 @@ export const seedMessageChannelMessageAssociation = async (
|
|||||||
messageThreadId: DEV_SEED_MESSAGE_THREAD_IDS.MESSAGE_THREAD_1,
|
messageThreadId: DEV_SEED_MESSAGE_THREAD_IDS.MESSAGE_THREAD_1,
|
||||||
messageExternalId: null,
|
messageExternalId: null,
|
||||||
messageId: DEV_SEED_MESSAGE_IDS.MESSAGE_3,
|
messageId: DEV_SEED_MESSAGE_IDS.MESSAGE_3,
|
||||||
messageChannelId: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM_INCOMING,
|
messageChannelId: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
.execute();
|
.execute();
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
import { EntityManager } from 'typeorm';
|
import { EntityManager } from 'typeorm';
|
||||||
|
|
||||||
import { DEV_SEED_CONNECTED_ACCOUNT_IDS } from 'src/database/typeorm-seeds/workspace/connected-account';
|
import { DEV_SEED_CONNECTED_ACCOUNT_IDS } from 'src/database/typeorm-seeds/workspace/connected-account';
|
||||||
|
import { MessageChannelSyncSubStatus } from 'src/modules/messaging/standard-objects/message-channel.workspace-entity';
|
||||||
|
|
||||||
const tableName = 'messageChannel';
|
const tableName = 'messageChannel';
|
||||||
|
|
||||||
export const DEV_SEED_MESSAGE_CHANNEL_IDS = {
|
export const DEV_SEED_MESSAGE_CHANNEL_IDS = {
|
||||||
TIM_INCOMING: '20202020-9b80-4c2c-a597-383db48de1d6',
|
TIM: '20202020-9b80-4c2c-a597-383db48de1d6',
|
||||||
TIM_OUTGOING: '20202020-09ed-4eb9-8b23-62aa4fd81d83',
|
JONY: '20202020-5ffe-4b32-814a-983d5e4911cd',
|
||||||
JONY_INCOMING: '20202020-5ffe-4b32-814a-983d5e4911cd',
|
PHIL: '20202020-e2f1-49b5-85d2-5d3a3386990c',
|
||||||
JONY_OUTGOING: '20202020-9dad-4329-8180-62647a2d7510',
|
|
||||||
PHIL_INCOMING: '20202020-e2f1-49b5-85d2-5d3a3386990c',
|
|
||||||
PHIL_OUTGOING: '20202020-fdff-438f-9132-7d5f216dfc4d',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const seedMessageChannel = async (
|
export const seedMessageChannel = async (
|
||||||
@ -30,74 +28,48 @@ export const seedMessageChannel = async (
|
|||||||
'connectedAccountId',
|
'connectedAccountId',
|
||||||
'handle',
|
'handle',
|
||||||
'visibility',
|
'visibility',
|
||||||
|
'syncSubStatus',
|
||||||
])
|
])
|
||||||
.orIgnore()
|
.orIgnore()
|
||||||
.values([
|
.values([
|
||||||
{
|
{
|
||||||
id: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM_INCOMING,
|
id: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM,
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
isContactAutoCreationEnabled: true,
|
isContactAutoCreationEnabled: true,
|
||||||
type: 'email',
|
type: 'email',
|
||||||
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.TIM,
|
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.TIM,
|
||||||
handle: 'outgoing',
|
handle: 'tim@apple.dev',
|
||||||
visibility: 'share_everything',
|
visibility: 'share_everything',
|
||||||
|
syncSubStatus:
|
||||||
|
MessageChannelSyncSubStatus.FULL_MESSAGES_LIST_FETCH_PENDING,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: DEV_SEED_MESSAGE_CHANNEL_IDS.TIM_OUTGOING,
|
id: DEV_SEED_MESSAGE_CHANNEL_IDS.JONY,
|
||||||
createdAt: new Date(),
|
|
||||||
updatedAt: new Date(),
|
|
||||||
deletedAt: null,
|
|
||||||
isContactAutoCreationEnabled: true,
|
|
||||||
type: 'email',
|
|
||||||
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.TIM,
|
|
||||||
handle: 'incoming',
|
|
||||||
visibility: 'share_everything',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: DEV_SEED_MESSAGE_CHANNEL_IDS.JONY_INCOMING,
|
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
isContactAutoCreationEnabled: true,
|
isContactAutoCreationEnabled: true,
|
||||||
type: 'email',
|
type: 'email',
|
||||||
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.JONY,
|
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.JONY,
|
||||||
handle: 'outgoing',
|
handle: 'jony.ive@apple.dev',
|
||||||
visibility: 'share_everything',
|
visibility: 'share_everything',
|
||||||
|
syncSubStatus:
|
||||||
|
MessageChannelSyncSubStatus.FULL_MESSAGES_LIST_FETCH_PENDING,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: DEV_SEED_MESSAGE_CHANNEL_IDS.JONY_OUTGOING,
|
id: DEV_SEED_MESSAGE_CHANNEL_IDS.PHIL,
|
||||||
createdAt: new Date(),
|
|
||||||
updatedAt: new Date(),
|
|
||||||
deletedAt: null,
|
|
||||||
isContactAutoCreationEnabled: true,
|
|
||||||
type: 'email',
|
|
||||||
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.JONY,
|
|
||||||
handle: 'incoming',
|
|
||||||
visibility: 'share_everything',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: DEV_SEED_MESSAGE_CHANNEL_IDS.PHIL_INCOMING,
|
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
isContactAutoCreationEnabled: true,
|
isContactAutoCreationEnabled: true,
|
||||||
type: 'email',
|
type: 'email',
|
||||||
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.PHIL,
|
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.PHIL,
|
||||||
handle: 'outgoing',
|
handle: 'phil.schiler@apple.dev',
|
||||||
visibility: 'share_everything',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: DEV_SEED_MESSAGE_CHANNEL_IDS.PHIL_OUTGOING,
|
|
||||||
createdAt: new Date(),
|
|
||||||
updatedAt: new Date(),
|
|
||||||
deletedAt: null,
|
|
||||||
isContactAutoCreationEnabled: true,
|
|
||||||
type: 'email',
|
|
||||||
connectedAccountId: DEV_SEED_CONNECTED_ACCOUNT_IDS.PHIL,
|
|
||||||
handle: 'incoming',
|
|
||||||
visibility: 'share_everything',
|
visibility: 'share_everything',
|
||||||
|
syncSubStatus:
|
||||||
|
MessageChannelSyncSubStatus.FULL_MESSAGES_LIST_FETCH_PENDING,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
.execute();
|
.execute();
|
||||||
|
|||||||
@ -18,10 +18,17 @@ import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-
|
|||||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
export enum MessageChannelSyncStatus {
|
export enum MessageChannelSyncStatus {
|
||||||
|
// TO BE DEPRECATED
|
||||||
PENDING = 'PENDING',
|
PENDING = 'PENDING',
|
||||||
ONGOING = 'ONGOING',
|
|
||||||
SUCCEEDED = 'SUCCEEDED',
|
SUCCEEDED = 'SUCCEEDED',
|
||||||
FAILED = 'FAILED',
|
FAILED = 'FAILED',
|
||||||
|
|
||||||
|
// NEW STATUSES
|
||||||
|
NOT_SYNCED = 'NOT_SYNCED',
|
||||||
|
ONGOING = 'ONGOING',
|
||||||
|
COMPLETED = 'COMPLETED',
|
||||||
|
FAILED_INSUFFICIENT_PERMISSIONS = 'FAILED_INSUFFICIENT_PERMISSIONS',
|
||||||
|
FAILED_UNKNOWN = 'FAILED_UNKNOWN',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MessageChannelSyncSubStatus {
|
export enum MessageChannelSyncSubStatus {
|
||||||
@ -163,18 +170,13 @@ export class MessageChannelWorkspaceEntity extends BaseWorkspaceEntity {
|
|||||||
description: 'Sync status',
|
description: 'Sync status',
|
||||||
icon: 'IconStatusChange',
|
icon: 'IconStatusChange',
|
||||||
options: [
|
options: [
|
||||||
|
// TO BE DEPRECATED: PENDING, SUCCEEDED, FAILED
|
||||||
{
|
{
|
||||||
value: MessageChannelSyncStatus.PENDING,
|
value: MessageChannelSyncStatus.PENDING,
|
||||||
label: 'Pending',
|
label: 'Pending',
|
||||||
position: 0,
|
position: 0,
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
value: MessageChannelSyncStatus.ONGOING,
|
|
||||||
label: 'Ongoing',
|
|
||||||
position: 1,
|
|
||||||
color: 'yellow',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: MessageChannelSyncStatus.SUCCEEDED,
|
value: MessageChannelSyncStatus.SUCCEEDED,
|
||||||
label: 'Succeeded',
|
label: 'Succeeded',
|
||||||
@ -187,6 +189,37 @@ export class MessageChannelWorkspaceEntity extends BaseWorkspaceEntity {
|
|||||||
position: 3,
|
position: 3,
|
||||||
color: 'red',
|
color: 'red',
|
||||||
},
|
},
|
||||||
|
// NEW STATUSES
|
||||||
|
{
|
||||||
|
value: MessageChannelSyncStatus.ONGOING,
|
||||||
|
label: 'Ongoing',
|
||||||
|
position: 1,
|
||||||
|
color: 'yellow',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: MessageChannelSyncStatus.NOT_SYNCED,
|
||||||
|
label: 'Not Synced',
|
||||||
|
position: 4,
|
||||||
|
color: 'blue',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: MessageChannelSyncStatus.COMPLETED,
|
||||||
|
label: 'Completed',
|
||||||
|
position: 5,
|
||||||
|
color: 'green',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: MessageChannelSyncStatus.FAILED_INSUFFICIENT_PERMISSIONS,
|
||||||
|
label: 'Failed Insufficient Permissions',
|
||||||
|
position: 6,
|
||||||
|
color: 'red',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: MessageChannelSyncStatus.FAILED_UNKNOWN,
|
||||||
|
label: 'Failed Unknown',
|
||||||
|
position: 7,
|
||||||
|
color: 'red',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@WorkspaceIsNullable()
|
@WorkspaceIsNullable()
|
||||||
@ -230,6 +263,7 @@ export class MessageChannelWorkspaceEntity extends BaseWorkspaceEntity {
|
|||||||
color: 'orange',
|
color: 'orange',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
defaultValue: `'${MessageChannelSyncSubStatus.FULL_MESSAGES_LIST_FETCH_PENDING}'`,
|
||||||
})
|
})
|
||||||
syncSubStatus: MessageChannelSyncSubStatus;
|
syncSubStatus: MessageChannelSyncSubStatus;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user