mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
47 lines
969 B
JavaScript
47 lines
969 B
JavaScript
import faker from 'faker'
|
|
|
|
export default function (params) {
|
|
const {
|
|
id = `u${faker.random.number()}`,
|
|
title = faker.lorem.sentence(),
|
|
content = [
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence()
|
|
].join('. '),
|
|
image = faker.image.image(),
|
|
visibility = 'public',
|
|
disabled = false,
|
|
deleted = false
|
|
} = params
|
|
|
|
|
|
return `
|
|
mutation {
|
|
${id}: CreatePost(
|
|
id: "${id}",
|
|
title: "${title}",
|
|
content: "${content}",
|
|
image: "${image}",
|
|
visibility: ${visibility},
|
|
disabled: ${disabled},
|
|
deleted: ${deleted}
|
|
) { id, title }
|
|
}
|
|
`
|
|
}
|
|
|
|
export function relate(type, params) {
|
|
const { from, to } = params
|
|
return `
|
|
mutation {
|
|
${from}_${type}_${to}: AddPost${type}(
|
|
from: { id: "${from}" },
|
|
to: { id: "${to}" }
|
|
) { from { id } }
|
|
}
|
|
`
|
|
}
|