Ocelot-Social/src/middleware/softDeleteMiddleware.js
Grzegorz Leoniec 513de69bf9 some cleanup
2018-10-19 12:29:52 +02:00

39 lines
1.1 KiB
JavaScript

export default {
Query: {
Post: async (resolve, root, args, context, info) => {
if (typeof args.deleted !== 'boolean') {
args.deleted = false
}
if (typeof args.disabled !== 'boolean') {
args.disabled = false
}
const result = await resolve(root, args, context, info)
return result
},
Comment: async (resolve, root, args, context, info) => {
// if (typeof args.deleted !== 'boolean') {
// args.deleted = false
// }
// if (typeof args.disabled !== 'boolean') {
// args.disabled = false
// }
const result = await resolve(root, args, context, info)
return result
},
User: async (resolve, root, args, context, info) => {
if (typeof args.deleted !== 'boolean') {
args.deleted = false
}
if (typeof args.disabled !== 'boolean') {
args.disabled = false
}
// console.log('ROOT', root)
// console.log('ARGS', args)
// console.log('CONTEXT', context)
// console.log('info', info.fieldNodes[0].arguments)
const result = await resolve(root, args, context, info)
return result
}
}
}