mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
import faker from 'faker'
|
|
import uuid from 'uuid/v4'
|
|
|
|
export default function(params) {
|
|
const {
|
|
id = uuid(),
|
|
slug = '',
|
|
title = faker.lorem.sentence(),
|
|
content = [
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence(),
|
|
].join('. '),
|
|
image = faker.image.unsplash.imageUrl(),
|
|
visibility = 'public',
|
|
deleted = false,
|
|
categoryIds,
|
|
} = params
|
|
|
|
return {
|
|
mutation: `
|
|
mutation(
|
|
$id: ID!
|
|
$slug: String
|
|
$title: String!
|
|
$content: String!
|
|
$image: String
|
|
$visibility: Visibility
|
|
$deleted: Boolean
|
|
$categoryIds: [ID]
|
|
) {
|
|
CreatePost(
|
|
id: $id
|
|
slug: $slug
|
|
title: $title
|
|
content: $content
|
|
image: $image
|
|
visibility: $visibility
|
|
deleted: $deleted
|
|
categoryIds: $categoryIds
|
|
) {
|
|
title
|
|
content
|
|
}
|
|
}
|
|
`,
|
|
variables: { id, slug, title, content, image, visibility, deleted, categoryIds },
|
|
}
|
|
}
|