From e7f12f4a063ad7136c26d2dde4e9eecc13b60a49 Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Sat, 6 Aug 2022 23:11:42 +0300 Subject: [PATCH] feat: Expose iconUrl together with steps --- packages/backend/src/graphql/schema.graphql | 1 + packages/backend/src/models/step.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/packages/backend/src/graphql/schema.graphql b/packages/backend/src/graphql/schema.graphql index 8762c962..37b70553 100644 --- a/packages/backend/src/graphql/schema.graphql +++ b/packages/backend/src/graphql/schema.graphql @@ -330,6 +330,7 @@ type Step { previousStepId: String key: String appKey: String + iconUrl: String type: StepEnumType parameters: JSONObject connection: Connection diff --git a/packages/backend/src/models/step.ts b/packages/backend/src/models/step.ts index 36b4fe30..57ec44e4 100644 --- a/packages/backend/src/models/step.ts +++ b/packages/backend/src/models/step.ts @@ -6,6 +6,7 @@ import Connection from './connection'; import ExecutionStep from './execution-step'; import type { IStep } from '@automatisch/types'; import Telemetry from '../helpers/telemetry'; +import appConfig from '../config/app'; class Step extends Base { id!: string; @@ -40,6 +41,10 @@ class Step extends Base { }, }; + static get virtualAttributes() { + return ['iconUrl']; + } + static relationMappings = () => ({ flow: { relation: Base.BelongsToOneRelation, @@ -67,6 +72,10 @@ class Step extends Base { }, }); + get iconUrl() { + return `${appConfig.baseUrl}/apps/${this.appKey}/assets/favicon.svg`; + } + async $afterInsert(queryContext: QueryContext) { await super.$afterInsert(queryContext); Telemetry.stepCreated(this);