Last active
December 30, 2017 09:02
-
-
Save maticzav/c5c5b47ba6d6e26f4773da112f72d4db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/resolvers/Mutation/file.ts | |
export const file = { | |
renameFile: async (parent, {id, name}, ctx: Context, info) => { | |
return ctx.db.mutation.updateFile({ data: { name }, where: { id } }, info) | |
}, | |
deleteFile: async (parent, { id }, ctx: Context, info) => { | |
return await ctx.db.mutation.deleteFile({ where: { id } }, info) | |
} | |
} | |
// src/resolvers/index.ts | |
import { file } from './Mutation/file' | |
export const resolvers = { | |
Query: { | |
file: async (parent, {id}, context, info) => { | |
return context.db.query.file({ where: { id } }, info) | |
}, | |
files: async (parent, args, context, info) => { | |
return context.db.query.files(args, info) | |
}, | |
}, | |
Mutation: { | |
...file, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment