Merge pull request #398 from automatisch/feature/expose-icon-url-with-steps

feat: Expose iconUrl together with steps
This commit is contained in:
Ömer Faruk Aydın
2022-08-06 23:17:25 +03:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -330,6 +330,7 @@ type Step {
previousStepId: String
key: String
appKey: String
iconUrl: String
type: StepEnumType
parameters: JSONObject
connection: Connection

View File

@@ -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);