mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
@ulfgebhardt @mattwr18 @tirokk Here's how I imagined the data validation middleware. If we roll our own input validations I would suggest to put them all in one place. @ulfgebhardt this commit is a great example of how tests can speed you up: Since I can rely on existing tests, I don't have to check the validations manually. With tests you can refactor with confidence! 👍
21 lines
606 B
JavaScript
21 lines
606 B
JavaScript
import dotenv from 'dotenv'
|
|
|
|
import createOrUpdateLocations from './nodes/locations'
|
|
|
|
dotenv.config()
|
|
|
|
export default {
|
|
Mutation: {
|
|
CreateUser: async (resolve, root, args, context, info) => {
|
|
const result = await resolve(root, args, context, info)
|
|
await createOrUpdateLocations(args.id, args.locationName, context.driver)
|
|
return result
|
|
},
|
|
UpdateUser: async (resolve, root, args, context, info) => {
|
|
const result = await resolve(root, args, context, info)
|
|
await createOrUpdateLocations(args.id, args.locationName, context.driver)
|
|
return result
|
|
},
|
|
}
|
|
}
|