mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
23 lines
698 B
JavaScript
23 lines
698 B
JavaScript
import walkRecursive from '../helpers/walkRecursive'
|
|
import { cleanHtml } from '../middleware/helpers/cleanHtml.js'
|
|
|
|
// exclamation mark separetes field names, that should not be sanitized
|
|
const fields = [
|
|
'content',
|
|
'contentExcerpt',
|
|
'reasonDescription',
|
|
'description!embed',
|
|
'descriptionExcerpt',
|
|
]
|
|
|
|
export default {
|
|
Mutation: async (resolve, root, args, context, info) => {
|
|
args = walkRecursive(args, fields, info.fieldName, cleanHtml)
|
|
return resolve(root, args, context, info)
|
|
},
|
|
Query: async (resolve, root, args, context, info) => {
|
|
const result = await resolve(root, args, context, info)
|
|
return walkRecursive(result, fields, info.fieldName, cleanHtml)
|
|
},
|
|
}
|