feat: Implement rest api endpoint to test step

This commit is contained in:
Faruk AYDIN
2024-09-02 13:00:28 +03:00
parent d3dc207166
commit 6ca8e8958a
7 changed files with 274 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import Telemetry from '../helpers/telemetry/index.js';
import appConfig from '../config/app.js';
import globalVariable from '../helpers/global-variable.js';
import computeParameters from '../helpers/compute-parameters.js';
import testRun from '../services/test-run.js';
class Step extends Base {
static tableName = 'steps';
@@ -156,6 +157,16 @@ class Step extends Base {
return await App.findOneByKey(this.appKey);
}
async test() {
await testRun({ stepId: this.id });
const updatedStep = await this.$query()
.withGraphFetched('lastExecutionStep')
.patchAndFetch({ status: 'completed' });
return updatedStep;
}
async getLastExecutionStep() {
const lastExecutionStep = await this.$relatedQuery('executionSteps')
.orderBy('created_at', 'desc')