fix: Fetch lastStep directly on the step factory

This commit is contained in:
Faruk AYDIN
2023-10-24 12:11:53 +02:00
parent 8c859f9408
commit 870a110a75

View File

@@ -5,7 +5,7 @@ export const createStep = async (params: Partial<Step> = {}) => {
params.flowId = params?.flowId || (await createFlow()).id;
params.type = params?.type || 'action';
const [lastStep] = await global.knex
const lastStep = await global.knex
.table('steps')
.where('flowId', params.flowId)
.andWhere('deletedAt', '!=', null)