Created
September 1, 2021 10:31
-
-
Save aqkhan/3ab566751d6544490bb3ca863b32cf42 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
const resolvers = { | |
Query: { | |
findAllCustomers: async (_, args, context) => | |
await context.models.customerModel.queries.findAllCustomers(), | |
}, | |
Mutation: { | |
addCustomer: async (_, args, context) => | |
await context.models.customerModel.mutations.addCustomer( | |
JSON.parse(JSON.stringify(args.newCustomer)) | |
), | |
deleteCustomer: async (_, args, context) => | |
await context.models.customerModel.mutations.deleteCustomer( | |
JSON.parse(JSON.stringify(args.id)) | |
), | |
findCustomer: async (_, args, context) => | |
await context.models.customerModel.mutations.findCustomer( | |
JSON.parse(JSON.stringify(args.id)) | |
), | |
}, | |
}; | |
module.exports = resolvers; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment