feat: Introduce position to step model

This commit is contained in:
Faruk AYDIN
2022-01-27 17:32:32 +03:00
committed by Ömer Faruk Aydın
parent c09a535653
commit 4985fb422e
4 changed files with 47 additions and 24 deletions

View File

@@ -5,20 +5,22 @@ import RequestWithCurrentUser from '../../types/express/request-with-current-use
const createFlowResolver = async (req: RequestWithCurrentUser) => {
const flow = await Flow.query().insert({
userId: req.currentUser.id
userId: req.currentUser.id,
});
await Step.query().insert({
flowId: flow.id,
type: 'trigger'
})
type: 'trigger',
position: 1,
});
return flow;
}
};
const createFlow = {
type: flowType,
resolve: (_: any, _params: any, req: RequestWithCurrentUser) => createFlowResolver(req)
resolve: (_: any, _params: any, req: RequestWithCurrentUser) =>
createFlowResolver(req),
};
export default createFlow;