feat: Introduce position to step model
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
c09a535653
commit
4985fb422e
@@ -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;
|
||||
|
@@ -1,4 +1,9 @@
|
||||
import { GraphQLObjectType, GraphQLString, GraphQLEnumType, GraphQLInt } from 'graphql';
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLEnumType,
|
||||
GraphQLInt,
|
||||
} from 'graphql';
|
||||
import ConnectionType from './connection';
|
||||
|
||||
const stepType = new GraphQLObjectType({
|
||||
@@ -13,11 +18,12 @@ const stepType = new GraphQLObjectType({
|
||||
values: {
|
||||
trigger: { value: 'trigger' },
|
||||
action: { value: 'action' },
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
},
|
||||
connection: { type: ConnectionType }
|
||||
}
|
||||
})
|
||||
connection: { type: ConnectionType },
|
||||
position: { type: GraphQLInt },
|
||||
},
|
||||
});
|
||||
|
||||
export default stepType;
|
||||
|
Reference in New Issue
Block a user