mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
import slug from 'slug'
|
|
|
|
export default {
|
|
Mutation: {
|
|
CreatePost: async (resolve, root, args, context, info) => {
|
|
args.slug = slug(args.title, {
|
|
lower: true
|
|
})
|
|
const result = await resolve(root, args, context, info)
|
|
return result
|
|
},
|
|
CreateUser: async (resolve, root, args, context, info) => {
|
|
if (!args.slug) {
|
|
args.slug = slug(args.name, {
|
|
lower: true
|
|
})
|
|
}
|
|
const result = await resolve(root, args, context, info)
|
|
return result
|
|
},
|
|
CreateOrganization: async (resolve, root, args, context, info) => {
|
|
if (!args.slug) {
|
|
args.slug = slug(args.name, {
|
|
lower: true
|
|
})
|
|
}
|
|
const result = await resolve(root, args, context, info)
|
|
return result
|
|
},
|
|
CreateCategory: async (resolve, root, args, context, info) => {
|
|
if (!args.slug) {
|
|
args.slug = slug(args.name, {
|
|
lower: true
|
|
})
|
|
}
|
|
const result = await resolve(root, args, context, info)
|
|
return result
|
|
}
|
|
}
|
|
}
|