feat: Create flow model and graphQL mutation
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
b42cb759a5
commit
8a7d54bb25
18
packages/backend/src/graphql/mutations/create-flow.ts
Normal file
18
packages/backend/src/graphql/mutations/create-flow.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import Flow from '../../models/flow';
|
||||
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
|
||||
});
|
||||
|
||||
return flow;
|
||||
}
|
||||
|
||||
const createFlow = {
|
||||
type: flowType,
|
||||
resolve: (_: any, _params: any, req: RequestWithCurrentUser) => createFlowResolver(req)
|
||||
};
|
||||
|
||||
export default createFlow;
|
Reference in New Issue
Block a user