922 remove todos from 11809 after release (#12183)
- remove todos - remove workflow-event-listener.workspace-entity.ts
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
import {
|
||||
ObjectMetadataItemsQuery,
|
||||
} from '~/generated-metadata/graphql';
|
||||
import { ObjectMetadataItemsQuery } from '~/generated-metadata/graphql';
|
||||
|
||||
// This file is not designed to be manually edited.
|
||||
// It's an extract from the dev seeded environment metadata call
|
||||
// TODO: automate the generation of this file
|
||||
// ⚠️ WARNING ⚠️: Be sure to activate the workflow feature flag (IsWorkflowEnabled) before updating that mock.
|
||||
|
||||
/* eslint-disable */
|
||||
// prettier-ignore
|
||||
export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
{
|
||||
objects: {
|
||||
@ -10869,8 +10870,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
__typename: "Object",
|
||||
id: "8a943c8f-aceb-48a6-ac07-a0dca6712059",
|
||||
dataSourceId: "f3e5fac0-7791-47d4-a2c2-087e584c67df",
|
||||
nameSingular: "workflowEventListener",
|
||||
namePlural: "workflowEventListeners",
|
||||
nameSingular: "workflowAutomatedTrigger",
|
||||
namePlural: "workflowAutomatedTriggers",
|
||||
icon: "IconSettingsAutomation",
|
||||
isCustom: false,
|
||||
isRemote: false,
|
||||
@ -10883,15 +10884,15 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
imageIdentifierFieldMetadataId: null,
|
||||
shortcut: null,
|
||||
isLabelSyncedWithName: false,
|
||||
labelSingular: "WorkflowEventListener",
|
||||
labelPlural: "WorkflowEventListeners",
|
||||
description: "A workflow event listener",
|
||||
labelSingular: "WorkflowAutomatedTrigger",
|
||||
labelPlural: "WorkflowAutomatedTriggers",
|
||||
description: "A workflow automated trigger",
|
||||
fieldsList: [
|
||||
{
|
||||
__typename: "Field",
|
||||
id: "7a836cd1-9002-44c6-8ce4-17558bb97a34",
|
||||
type: "TEXT",
|
||||
name: "eventName",
|
||||
id: "20202020-3319-4234-a34c-3f92c1ab56e7",
|
||||
type: "SELECT",
|
||||
name: "type",
|
||||
icon: null,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
@ -10900,13 +10901,49 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
isUnique: false,
|
||||
createdAt: "2025-02-11T09:14:32.715Z",
|
||||
updatedAt: "2025-02-11T09:14:32.715Z",
|
||||
defaultValue: "''",
|
||||
defaultValue: null,
|
||||
options: [
|
||||
{
|
||||
id: "133a966a-7cc2-480c-8861-e09581893a6d",
|
||||
color: 'green',
|
||||
label: 'Database Event',
|
||||
value: 'DATABASE_EVENT',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
id: "d3ecf3ce-5064-4d8d-bccb-18a701570b02",
|
||||
color: 'blue',
|
||||
label: 'Cron',
|
||||
value: 'CRON',
|
||||
position: 1,
|
||||
}
|
||||
],
|
||||
settings: null,
|
||||
isLabelSyncedWithName: false,
|
||||
relationDefinition: null,
|
||||
label: "Automated Trigger Type",
|
||||
description: "The workflow automated trigger type"
|
||||
},
|
||||
{
|
||||
__typename: "Field",
|
||||
id: "20202020-3319-4234-a34c-bac8f903de12",
|
||||
type: "RAW_JSON",
|
||||
name: "settings",
|
||||
icon: null,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
isUnique: false,
|
||||
createdAt: "2025-02-11T09:14:32.715Z",
|
||||
updatedAt: "2025-02-11T09:14:32.715Z",
|
||||
defaultValue: null,
|
||||
options: null,
|
||||
settings: null,
|
||||
isLabelSyncedWithName: false,
|
||||
relationDefinition: null,
|
||||
label: "Name",
|
||||
description: "The workflow event listener name"
|
||||
label: "Settings",
|
||||
description: "The workflow automated trigger settings"
|
||||
},
|
||||
{
|
||||
__typename: "Field",
|
||||
@ -11017,7 +11054,7 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
isLabelSyncedWithName: false,
|
||||
relationDefinition: null,
|
||||
label: "Workflow id (foreign key)",
|
||||
description: "WorkflowEventListener workflow id foreign key"
|
||||
description: "WorkflowAutomatedTrigger workflow id foreign key"
|
||||
},
|
||||
{
|
||||
__typename: "Field",
|
||||
@ -11037,7 +11074,7 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
settings: null,
|
||||
isLabelSyncedWithName: false,
|
||||
label: "Workflow",
|
||||
description: "WorkflowEventListener workflow",
|
||||
description: "WorkflowAutomatedTrigger workflow",
|
||||
relationDefinition: {
|
||||
__typename: "RelationDefinition",
|
||||
relationId: "eda58ebf-dc0b-4481-b9a6-dafc80afdceb",
|
||||
@ -11045,8 +11082,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
sourceObjectMetadata: {
|
||||
__typename: "Object",
|
||||
id: "8a943c8f-aceb-48a6-ac07-a0dca6712059",
|
||||
nameSingular: "workflowEventListener",
|
||||
namePlural: "workflowEventListeners"
|
||||
nameSingular: "workflowAutomatedTrigger",
|
||||
namePlural: "workflowAutomatedTriggers"
|
||||
},
|
||||
sourceFieldMetadata: {
|
||||
__typename: "Field",
|
||||
@ -11062,7 +11099,7 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
targetFieldMetadata: {
|
||||
__typename: "Field",
|
||||
id: "a2162b17-505f-4a9d-bf93-cbc06242a14c",
|
||||
name: "eventListeners"
|
||||
name: "automatedTriggers"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -19335,7 +19372,7 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
__typename: "Field",
|
||||
id: "a2162b17-505f-4a9d-bf93-cbc06242a14c",
|
||||
type: "RELATION",
|
||||
name: "eventListeners",
|
||||
name: "automatedTriggers",
|
||||
icon: null,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
@ -19348,8 +19385,8 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
options: null,
|
||||
settings: null,
|
||||
isLabelSyncedWithName: false,
|
||||
label: "Event Listeners",
|
||||
description: "Workflow event listeners linked to the workflow.",
|
||||
label: "Automated Triggers",
|
||||
description: "Workflow automated triggers linked to the workflow.",
|
||||
relationDefinition: {
|
||||
__typename: "RelationDefinition",
|
||||
relationId: "eda58ebf-dc0b-4481-b9a6-dafc80afdceb",
|
||||
@ -19363,13 +19400,13 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
sourceFieldMetadata: {
|
||||
__typename: "Field",
|
||||
id: "a2162b17-505f-4a9d-bf93-cbc06242a14c",
|
||||
name: "eventListeners"
|
||||
name: "automatedTriggers"
|
||||
},
|
||||
targetObjectMetadata: {
|
||||
__typename: "Object",
|
||||
id: "8a943c8f-aceb-48a6-ac07-a0dca6712059",
|
||||
nameSingular: "workflowEventListener",
|
||||
namePlural: "workflowEventListeners"
|
||||
nameSingular: "workflowAutomatedTrigger",
|
||||
namePlural: "workflowAutomatedTriggers"
|
||||
},
|
||||
targetFieldMetadata: {
|
||||
__typename: "Field",
|
||||
|
||||
@ -13,7 +13,6 @@ import {
|
||||
AutomatedTriggerType,
|
||||
WorkflowAutomatedTriggerWorkspaceEntity,
|
||||
} from 'src/modules/workflow/common/standard-objects/workflow-automated-trigger.workspace-entity';
|
||||
import { WorkflowEventListenerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-event-listener.workspace-entity';
|
||||
|
||||
@Command({
|
||||
name: 'upgrade:0-53:migrate-workflow-event-listeners-to-automated-triggers',
|
||||
@ -38,7 +37,7 @@ export class MigrateWorkflowEventListenersToAutomatedTriggersCommand extends Act
|
||||
);
|
||||
|
||||
const workflowEventListenerRepository =
|
||||
await this.twentyORMGlobalManager.getRepositoryForWorkspace<WorkflowEventListenerWorkspaceEntity>(
|
||||
await this.twentyORMGlobalManager.getRepositoryForWorkspace(
|
||||
workspaceId,
|
||||
'workflowEventListener',
|
||||
);
|
||||
|
||||
@ -453,11 +453,6 @@ export const WEBHOOK_STANDARD_FIELD_IDS = {
|
||||
secret: '20202020-97ce-410f-bff9-e9ccb038fb67',
|
||||
};
|
||||
|
||||
export const WORKFLOW_EVENT_LISTENER_STANDARD_FIELD_IDS = {
|
||||
eventName: '20202020-7318-4cf8-a6ac-2de75e3fd97d',
|
||||
workflow: '20202020-4082-4641-8569-dc08d5365002',
|
||||
};
|
||||
|
||||
export const WORKFLOW_AUTOMATED_TRIGGER_STANDARD_FIELD_IDS = {
|
||||
type: '20202020-3319-4234-a34c-3f92c1ab56e7',
|
||||
settings: '20202020-3319-4234-a34c-bac8f903de12',
|
||||
@ -585,7 +580,6 @@ export const STANDARD_OBJECT_FIELD_IDS = {
|
||||
view: VIEW_STANDARD_FIELD_IDS,
|
||||
webhook: WEBHOOK_STANDARD_FIELD_IDS,
|
||||
workflow: WORKFLOW_STANDARD_FIELD_IDS,
|
||||
workflowEventListener: WORKFLOW_EVENT_LISTENER_STANDARD_FIELD_IDS,
|
||||
workflowRun: WORKFLOW_RUN_STANDARD_FIELD_IDS,
|
||||
workflowVersion: WORKFLOW_VERSION_STANDARD_FIELD_IDS,
|
||||
workspaceMember: WORKSPACE_MEMBER_STANDARD_FIELD_IDS,
|
||||
|
||||
@ -30,7 +30,6 @@ import { ViewSortWorkspaceEntity } from 'src/modules/view/standard-objects/view-
|
||||
import { ViewWorkspaceEntity } from 'src/modules/view/standard-objects/view.workspace-entity';
|
||||
import { WebhookWorkspaceEntity } from 'src/modules/webhook/standard-objects/webhook.workspace-entity';
|
||||
import { WorkflowAutomatedTriggerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-automated-trigger.workspace-entity';
|
||||
import { WorkflowEventListenerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-event-listener.workspace-entity';
|
||||
import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity';
|
||||
import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity';
|
||||
import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';
|
||||
@ -58,7 +57,6 @@ export const standardObjectMetadataDefinitions = [
|
||||
ViewWorkspaceEntity,
|
||||
WebhookWorkspaceEntity,
|
||||
WorkflowWorkspaceEntity,
|
||||
WorkflowEventListenerWorkspaceEntity,
|
||||
WorkflowVersionWorkspaceEntity,
|
||||
WorkflowRunWorkspaceEntity,
|
||||
WorkflowAutomatedTriggerWorkspaceEntity,
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
import { RelationOnDeleteAction } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-on-delete-action.interface';
|
||||
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { WORKFLOW_EVENT_LISTENER_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity';
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.workflowEventListener,
|
||||
namePlural: 'workflowEventListeners',
|
||||
labelSingular: msg`WorkflowEventListener`,
|
||||
labelPlural: msg`WorkflowEventListeners`,
|
||||
description: msg`A workflow event listener`,
|
||||
icon: STANDARD_OBJECT_ICONS.workflowEventListener,
|
||||
labelIdentifierStandardId:
|
||||
WORKFLOW_EVENT_LISTENER_STANDARD_FIELD_IDS.eventName,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
export class WorkflowEventListenerWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceField({
|
||||
standardId: WORKFLOW_EVENT_LISTENER_STANDARD_FIELD_IDS.eventName,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Name`,
|
||||
description: msg`The workflow event listener name`,
|
||||
})
|
||||
eventName: string;
|
||||
|
||||
// Relations
|
||||
@WorkspaceRelation({
|
||||
standardId: WORKFLOW_EVENT_LISTENER_STANDARD_FIELD_IDS.workflow,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Workflow`,
|
||||
description: msg`WorkflowEventListener workflow`,
|
||||
icon: 'IconSettingsAutomation',
|
||||
inverseSideTarget: () => WorkflowWorkspaceEntity,
|
||||
inverseSideFieldKey: 'eventListeners',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
workflow: Relation<WorkflowWorkspaceEntity>;
|
||||
|
||||
@WorkspaceJoinColumn('workflow')
|
||||
workflowId: string;
|
||||
}
|
||||
@ -18,7 +18,6 @@ import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sy
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { FavoriteWorkspaceEntity } from 'src/modules/favorite/standard-objects/favorite.workspace-entity';
|
||||
import { TimelineActivityWorkspaceEntity } from 'src/modules/timeline/standard-objects/timeline-activity.workspace-entity';
|
||||
import { WorkflowEventListenerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-event-listener.workspace-entity';
|
||||
import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity';
|
||||
import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity';
|
||||
import { WorkflowAutomatedTriggerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-automated-trigger.workspace-entity';
|
||||
@ -125,17 +124,6 @@ export class WorkflowWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
})
|
||||
runs: Relation<WorkflowRunWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: WORKFLOW_STANDARD_FIELD_IDS.eventListeners,
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
label: msg`Event Listeners`,
|
||||
description: msg`Workflow event listeners linked to the workflow.`,
|
||||
inverseSideTarget: () => WorkflowEventListenerWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
eventListeners: Relation<WorkflowEventListenerWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: WORKFLOW_STANDARD_FIELD_IDS.automatedTriggers,
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
|
||||
@ -11,7 +11,6 @@ import {
|
||||
WorkflowCommonException,
|
||||
WorkflowCommonExceptionCode,
|
||||
} from 'src/modules/workflow/common/exceptions/workflow-common.exception';
|
||||
import { WorkflowEventListenerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-event-listener.workspace-entity';
|
||||
import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity';
|
||||
import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity';
|
||||
import { WorkflowActionType } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
|
||||
@ -137,21 +136,12 @@ export class WorkflowCommonWorkspaceService {
|
||||
'workflowRun',
|
||||
);
|
||||
|
||||
const workflowEventListenerRepository =
|
||||
await this.twentyORMManager.getRepository<WorkflowEventListenerWorkspaceEntity>(
|
||||
'workflowEventListener',
|
||||
);
|
||||
|
||||
const workflowAutomatedTriggerRepository =
|
||||
await this.twentyORMManager.getRepository<WorkflowAutomatedTriggerWorkspaceEntity>(
|
||||
'workflowAutomatedTrigger',
|
||||
);
|
||||
|
||||
workflowIds.forEach((workflowId) => {
|
||||
workflowEventListenerRepository.softDelete({
|
||||
workflowId,
|
||||
});
|
||||
|
||||
workflowAutomatedTriggerRepository.softDelete({
|
||||
workflowId,
|
||||
});
|
||||
|
||||
@ -7,7 +7,6 @@ import {
|
||||
AutomatedTriggerType,
|
||||
WorkflowAutomatedTriggerWorkspaceEntity,
|
||||
} from 'src/modules/workflow/common/standard-objects/workflow-automated-trigger.workspace-entity';
|
||||
import { WorkflowEventListenerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-event-listener.workspace-entity';
|
||||
|
||||
@Injectable()
|
||||
export class AutomatedTriggerWorkspaceService {
|
||||
@ -24,26 +23,6 @@ export class AutomatedTriggerWorkspaceService {
|
||||
type: AutomatedTriggerType;
|
||||
settings: AutomatedTriggerSettings;
|
||||
}) {
|
||||
if (type === AutomatedTriggerType.DATABASE_EVENT) {
|
||||
// Todo: remove workflowEventListenerRepository updates when data are migrated to workflowAutomatedTrigger
|
||||
const workflowEventListenerRepository =
|
||||
await this.twentyORMManager.getRepository<WorkflowEventListenerWorkspaceEntity>(
|
||||
'workflowEventListener',
|
||||
);
|
||||
|
||||
const workflowEventListener = workflowEventListenerRepository.create({
|
||||
workflowId,
|
||||
eventName: settings.eventName,
|
||||
});
|
||||
|
||||
await workflowEventListenerRepository.save(
|
||||
workflowEventListener,
|
||||
{},
|
||||
manager,
|
||||
);
|
||||
// end-Todo
|
||||
}
|
||||
|
||||
const workflowAutomatedTriggerRepository =
|
||||
await this.twentyORMManager.getRepository<WorkflowAutomatedTriggerWorkspaceEntity>(
|
||||
'workflowAutomatedTrigger',
|
||||
@ -69,20 +48,6 @@ export class AutomatedTriggerWorkspaceService {
|
||||
workflowId: string;
|
||||
manager: WorkspaceEntityManager;
|
||||
}) {
|
||||
// Todo: remove workflowEventListenerRepository updates when data are migrated to workflowAutomatedTrigger
|
||||
const workflowEventListenerRepository =
|
||||
await this.twentyORMManager.getRepository<WorkflowEventListenerWorkspaceEntity>(
|
||||
'workflowEventListener',
|
||||
);
|
||||
|
||||
await workflowEventListenerRepository.delete(
|
||||
{
|
||||
workflowId,
|
||||
},
|
||||
manager,
|
||||
);
|
||||
// end-Todo
|
||||
|
||||
const workflowAutomatedTriggerRepository =
|
||||
await this.twentyORMManager.getRepository<WorkflowAutomatedTriggerWorkspaceEntity>(
|
||||
'workflowAutomatedTrigger',
|
||||
|
||||
@ -17,7 +17,10 @@ import {
|
||||
WorkflowTriggerJob,
|
||||
WorkflowTriggerJobData,
|
||||
} from 'src/modules/workflow/workflow-trigger/jobs/workflow-trigger.job';
|
||||
import { WorkflowEventListenerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-event-listener.workspace-entity';
|
||||
import {
|
||||
AutomatedTriggerType,
|
||||
WorkflowAutomatedTriggerWorkspaceEntity,
|
||||
} from 'src/modules/workflow/common/standard-objects/workflow-automated-trigger.workspace-entity';
|
||||
|
||||
@Injectable()
|
||||
export class DatabaseEventTriggerListener {
|
||||
@ -89,8 +92,6 @@ export class DatabaseEventTriggerListener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Todo: uncomment that when data are migrated to workflowAutomatedTrigger
|
||||
/*
|
||||
const workflowAutomatedTriggerRepository =
|
||||
await this.twentyORMGlobalManager.getRepositoryForWorkspace<WorkflowAutomatedTriggerWorkspaceEntity>(
|
||||
workspaceId,
|
||||
@ -103,29 +104,8 @@ export class DatabaseEventTriggerListener {
|
||||
settings: { eventName: databaseEventName },
|
||||
},
|
||||
});
|
||||
*/
|
||||
// end Todo
|
||||
|
||||
// Todo: remove that when data are migrated to workflowAutomatedTrigger
|
||||
const workflowEventListenerRepository =
|
||||
await this.twentyORMGlobalManager.getRepositoryForWorkspace<WorkflowEventListenerWorkspaceEntity>(
|
||||
workspaceId,
|
||||
'workflowEventListener',
|
||||
);
|
||||
|
||||
const oldEventListeners = await workflowEventListenerRepository.find({
|
||||
where: { eventName: databaseEventName },
|
||||
});
|
||||
|
||||
// end Todo
|
||||
|
||||
// Todo: uncomment that when data are migrated to workflowAutomatedTrigger
|
||||
//for (const eventListener of eventListeners) {
|
||||
// end Todo
|
||||
|
||||
// Todo: remove that when data are migrated to workflowAutomatedTrigger
|
||||
for (const eventListener of oldEventListeners) {
|
||||
// end Todo
|
||||
for (const eventListener of eventListeners) {
|
||||
for (const eventPayload of payload.events) {
|
||||
this.messageQueueService.add<WorkflowTriggerJobData>(
|
||||
WorkflowTriggerJob.name,
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
import request from 'supertest';
|
||||
|
||||
const client = request(`http://localhost:${APP_PORT}`);
|
||||
|
||||
describe('workflowAutomatedTriggersResolver (e2e)', () => {
|
||||
it('should find many workflowAutomatedTriggers', () => {
|
||||
const queryData = {
|
||||
query: `
|
||||
query workflowAutomatedTriggers {
|
||||
workflowAutomatedTriggers {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
type
|
||||
settings
|
||||
createdAt
|
||||
updatedAt
|
||||
deletedAt
|
||||
workflowId
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
};
|
||||
|
||||
return client
|
||||
.post('/graphql')
|
||||
.set('Authorization', `Bearer ${ADMIN_ACCESS_TOKEN}`)
|
||||
.send(queryData)
|
||||
.expect(200)
|
||||
.expect((res) => {
|
||||
expect(res.body.data).toBeDefined();
|
||||
expect(res.body.errors).toBeUndefined();
|
||||
})
|
||||
.expect((res) => {
|
||||
const data = res.body.data.workflowAutomatedTriggers;
|
||||
|
||||
expect(data).toBeDefined();
|
||||
expect(Array.isArray(data.edges)).toBe(true);
|
||||
|
||||
const edges = data.edges;
|
||||
|
||||
if (edges.length > 0) {
|
||||
const workflowAutomatedTriggers = edges[0].node;
|
||||
|
||||
expect(workflowAutomatedTriggers).toHaveProperty('id');
|
||||
expect(workflowAutomatedTriggers).toHaveProperty('type');
|
||||
expect(workflowAutomatedTriggers).toHaveProperty('settings');
|
||||
expect(workflowAutomatedTriggers).toHaveProperty('createdAt');
|
||||
expect(workflowAutomatedTriggers).toHaveProperty('updatedAt');
|
||||
expect(workflowAutomatedTriggers).toHaveProperty('deletedAt');
|
||||
expect(workflowAutomatedTriggers).toHaveProperty('workflowId');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -1,55 +0,0 @@
|
||||
import request from 'supertest';
|
||||
|
||||
const client = request(`http://localhost:${APP_PORT}`);
|
||||
|
||||
describe('workflowEventListenersResolver (e2e)', () => {
|
||||
it('should find many workflowEventListeners', () => {
|
||||
const queryData = {
|
||||
query: `
|
||||
query workflowEventListeners {
|
||||
workflowEventListeners {
|
||||
edges {
|
||||
node {
|
||||
eventName
|
||||
id
|
||||
createdAt
|
||||
updatedAt
|
||||
deletedAt
|
||||
workflowId
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
};
|
||||
|
||||
return client
|
||||
.post('/graphql')
|
||||
.set('Authorization', `Bearer ${ADMIN_ACCESS_TOKEN}`)
|
||||
.send(queryData)
|
||||
.expect(200)
|
||||
.expect((res) => {
|
||||
expect(res.body.data).toBeDefined();
|
||||
expect(res.body.errors).toBeUndefined();
|
||||
})
|
||||
.expect((res) => {
|
||||
const data = res.body.data.workflowEventListeners;
|
||||
|
||||
expect(data).toBeDefined();
|
||||
expect(Array.isArray(data.edges)).toBe(true);
|
||||
|
||||
const edges = data.edges;
|
||||
|
||||
if (edges.length > 0) {
|
||||
const workflowEventListeners = edges[0].node;
|
||||
|
||||
expect(workflowEventListeners).toHaveProperty('eventName');
|
||||
expect(workflowEventListeners).toHaveProperty('id');
|
||||
expect(workflowEventListeners).toHaveProperty('createdAt');
|
||||
expect(workflowEventListeners).toHaveProperty('updatedAt');
|
||||
expect(workflowEventListeners).toHaveProperty('deletedAt');
|
||||
expect(workflowEventListeners).toHaveProperty('workflowId');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user