feat: Implement createEmptyFlow method for user model

This commit is contained in:
Faruk AYDIN
2025-03-10 16:08:52 +01:00
parent 75a7a068f3
commit ac1f644071
4 changed files with 35 additions and 9 deletions

View File

@@ -1,11 +1,7 @@
import { renderObject } from '../../../../helpers/renderer.js';
export default async (request, response) => {
const flow = await request.currentUser.$relatedQuery('flows').insertAndFetch({
name: 'Name your flow',
});
await flow.createInitialSteps();
const flow = await request.currentUser.createEmptyFlow();
renderObject(response, flow, { status: 201 });
};