feat: write REST API endpoint to update step

This commit is contained in:
Ali BARIN
2024-09-18 14:06:30 +00:00
committed by Faruk AYDIN
parent b29c6105a1
commit 5f7d1f9219
6 changed files with 300 additions and 0 deletions

View File

@@ -334,6 +334,30 @@ class Step extends Base {
await Promise.all(nextStepQueries);
}
async update(newStepData) {
const { connectionId, appKey, key, parameters } = newStepData;
if (this.isTrigger && appKey && key) {
await App.checkAppAndTrigger(appKey, key);
}
if (this.isAction && appKey && key) {
await App.checkAppAndAction(appKey, key);
}
const updatedStep = await this.$query().patchAndFetch({
key: key,
appKey: appKey,
connectionId: connectionId,
parameters: parameters,
status: 'incomplete',
});
await updatedStep.updateWebhookUrl();
return updatedStep;
}
}
export default Step;