mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
cc @mattwr18 @tirokk @ulfgebhardt @appinteractive The factories don't use string interpolation now but they use variables. This resolves some errors of escaping strings when you send html along with `post.content`. It is much cleaner, too.
52 lines
1.0 KiB
JavaScript
52 lines
1.0 KiB
JavaScript
import faker from 'faker'
|
|
import uuid from 'uuid/v4'
|
|
|
|
export default function create (params) {
|
|
const {
|
|
id = uuid(),
|
|
name = faker.name.findName(),
|
|
slug = '',
|
|
email = faker.internet.email(),
|
|
password = '1234',
|
|
role = 'user',
|
|
avatar = faker.internet.avatar(),
|
|
about = faker.lorem.paragraph()
|
|
} = params
|
|
|
|
return {
|
|
mutation: `
|
|
mutation(
|
|
$id: ID!
|
|
$name: String
|
|
$slug: String
|
|
$password: String!
|
|
$email: String
|
|
$avatar: String
|
|
$about: String
|
|
$role: UserGroupEnum
|
|
) {
|
|
CreateUser(
|
|
id: $id
|
|
name: $name
|
|
slug: $slug
|
|
password: $password
|
|
email: $email
|
|
avatar: $avatar
|
|
about: $about
|
|
role: $role
|
|
) {
|
|
id
|
|
name
|
|
slug
|
|
email
|
|
avatar
|
|
role
|
|
deleted
|
|
disabled
|
|
}
|
|
}
|
|
`,
|
|
variables: { id, name, slug, password, email, avatar, about, role }
|
|
}
|
|
}
|