From e6740b54516a29fdab0512ef4547c0b1e3e9a272 Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Tue, 14 Mar 2023 09:15:01 +0000 Subject: [PATCH] Remove org template code for when a workflow is created --- .../events/workflowCreated.server.ts | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/apps/webapp/app/services/workflows/events/workflowCreated.server.ts b/apps/webapp/app/services/workflows/events/workflowCreated.server.ts index 77c366d73..6e9ac7517 100644 --- a/apps/webapp/app/services/workflows/events/workflowCreated.server.ts +++ b/apps/webapp/app/services/workflows/events/workflowCreated.server.ts @@ -21,54 +21,6 @@ export class WorkflowCreated { } await this.#sendInternalEvent(workflow.id); - - const orgTemplates = await this.#prismaClient.organizationTemplate.findMany( - { - where: { - organizationId: workflow.organizationId, - template: { - workflowIds: { - has: workflow.slug, - }, - }, - status: "READY_TO_DEPLOY", - }, - include: { - template: true, - }, - } - ); - - const firstOrgTemplate = orgTemplates[0]; - - if (firstOrgTemplate) { - await this.#prismaClient.workflow.update({ - where: { id: workflow.id }, - data: { - organizationTemplateId: firstOrgTemplate.id, - }, - }); - } - - for (const orgTemplate of orgTemplates) { - await this.#prismaClient.organizationTemplate.update({ - where: { id: orgTemplate.id }, - data: { - status: "DEPLOYED", - }, - }); - - await appEventPublisher.publish( - "organization-template.updated", - { - id: orgTemplate.id, - status: "DEPLOYED", - }, - { - "x-organization-template-id": orgTemplate.id, - } - ); - } } async #sendInternalEvent(id: string) {