refactor: Use related query from objectionjs for mutations
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
e7c537f217
commit
86d5cceec7
@@ -1,12 +1,9 @@
|
||||
import Flow from '../../models/flow';
|
||||
import Step from '../../models/step';
|
||||
import flowType from '../types/flow';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
|
||||
const createFlowResolver = async (req: RequestWithCurrentUser) => {
|
||||
const flow = await Flow.query().insert({
|
||||
userId: req.currentUser.id,
|
||||
});
|
||||
const flow = await req.currentUser.$relatedQuery('flows').insert();
|
||||
|
||||
await Step.query().insert({
|
||||
flowId: flow.id,
|
||||
|
Reference in New Issue
Block a user