feat: introduce singleton webhook URL

This commit is contained in:
Ali BARIN
2023-06-07 22:29:40 +00:00
parent 92638c2e97
commit de7a35dfe9
19 changed files with 285 additions and 78 deletions

View File

@@ -18,6 +18,7 @@ class Flow extends Base {
active: boolean;
status: 'paused' | 'published' | 'draft';
steps: Step[];
triggerStep: Step;
published_at: string;
remoteWebhookId: string;
executions?: Execution[];
@@ -51,6 +52,20 @@ class Flow extends Base {
builder.orderBy('position', 'asc');
},
},
triggerStep: {
relation: Base.HasOneRelation,
modelClass: Step,
join: {
from: 'flows.id',
to: 'steps.flow_id',
},
filter(builder: ExtendedQueryBuilder<Step>) {
builder
.where('type', 'trigger')
.limit(1)
.first();
},
},
executions: {
relation: Base.HasManyRelation,
modelClass: Execution,