feat: Expose iconUrl together with steps

This commit is contained in:
Faruk AYDIN
2022-08-06 23:11:42 +03:00
parent 5a24b9ec8a
commit e7f12f4a06
2 changed files with 10 additions and 0 deletions

View File

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

View File

@@ -6,6 +6,7 @@ import Connection from './connection';
import ExecutionStep from './execution-step'; import ExecutionStep from './execution-step';
import type { IStep } from '@automatisch/types'; import type { IStep } from '@automatisch/types';
import Telemetry from '../helpers/telemetry'; import Telemetry from '../helpers/telemetry';
import appConfig from '../config/app';
class Step extends Base { class Step extends Base {
id!: string; id!: string;
@@ -40,6 +41,10 @@ class Step extends Base {
}, },
}; };
static get virtualAttributes() {
return ['iconUrl'];
}
static relationMappings = () => ({ static relationMappings = () => ({
flow: { flow: {
relation: Base.BelongsToOneRelation, 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) { async $afterInsert(queryContext: QueryContext) {
await super.$afterInsert(queryContext); await super.$afterInsert(queryContext);
Telemetry.stepCreated(this); Telemetry.stepCreated(this);