mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Incorporate @appinteractive's feedback
@appinteractive can we merge this soon?
This commit is contained in:
parent
132dba04dd
commit
eda2ea34fc
@ -16,7 +16,7 @@ const isModerator = rule()(async (parent, args, ctx, info) => {
|
||||
})
|
||||
*/
|
||||
|
||||
const myself = rule({ cache: 'no_cache' })(async (parent, args, ctx, info) => {
|
||||
const isMyOwn = rule({ cache: 'no_cache' })(async (parent, args, ctx, info) => {
|
||||
return ctx.user.id === parent.id
|
||||
})
|
||||
|
||||
@ -36,8 +36,8 @@ const permissions = shield({
|
||||
// CreateUser: allow,
|
||||
},
|
||||
User: {
|
||||
email: myself,
|
||||
password: myself
|
||||
email: isMyOwn,
|
||||
password: isMyOwn
|
||||
}
|
||||
// Post: isAuthenticated
|
||||
})
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import faker from 'faker'
|
||||
import uuid from 'uuid/v4'
|
||||
|
||||
export default function (params) {
|
||||
const {
|
||||
id = `cat${faker.random.number()}`,
|
||||
id = uuid(),
|
||||
key,
|
||||
type = 'crowdfunding',
|
||||
status = 'permanent',
|
||||
@ -11,12 +11,13 @@ export default function (params) {
|
||||
|
||||
return `
|
||||
mutation {
|
||||
${id}: CreateBadge(
|
||||
id: "${id}",
|
||||
key: "${key}",
|
||||
type: ${type},
|
||||
status: ${status},
|
||||
icon: "${icon}") { id }
|
||||
CreateBadge(
|
||||
id: "${id}",
|
||||
key: "${key}",
|
||||
type: ${type},
|
||||
status: ${status},
|
||||
icon: "${icon}"
|
||||
) { id }
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import faker from 'faker'
|
||||
import uuid from 'uuid/v4'
|
||||
|
||||
export default function (params) {
|
||||
const {
|
||||
id = `cat${faker.random.number()}`,
|
||||
id = uuid(),
|
||||
name,
|
||||
slug,
|
||||
icon
|
||||
@ -11,10 +11,10 @@ export default function (params) {
|
||||
return `
|
||||
mutation {
|
||||
CreateCategory(
|
||||
id: "${id}",
|
||||
name: "${name}",
|
||||
slug: "${slug}",
|
||||
icon: "${icon}"
|
||||
id: "${id}",
|
||||
name: "${name}",
|
||||
slug: "${slug}",
|
||||
icon: "${icon}"
|
||||
) { id, name }
|
||||
}
|
||||
`
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import faker from 'faker'
|
||||
import uuid from 'uuid/v4'
|
||||
|
||||
export default function (params) {
|
||||
const {
|
||||
id = `c${faker.random.number()}`,
|
||||
id = uuid(),
|
||||
content = [
|
||||
faker.lorem.sentence(),
|
||||
faker.lorem.sentence()
|
||||
@ -13,7 +14,7 @@ export default function (params) {
|
||||
|
||||
return `
|
||||
mutation {
|
||||
${id}: CreateComment(
|
||||
CreateComment(
|
||||
id: "${id}",
|
||||
content: "${content}",
|
||||
disabled: ${disabled},
|
||||
|
||||
@ -51,7 +51,7 @@ export const cleanDatabase = async (options = {}) => {
|
||||
driver = getDriver()
|
||||
} = options
|
||||
const session = driver.session()
|
||||
const cypher = 'MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r'
|
||||
const cypher = 'MATCH (n) DETACH DELETE n'
|
||||
try {
|
||||
return await session.run(cypher)
|
||||
} catch (error) {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import faker from 'faker'
|
||||
import uuid from 'uuid/v4'
|
||||
|
||||
export default function create (params) {
|
||||
const {
|
||||
id = `o${faker.random.number()}`,
|
||||
id = uuid(),
|
||||
name = faker.comany.companyName(),
|
||||
description = faker.company.catchPhrase(),
|
||||
disabled = false,
|
||||
@ -11,7 +12,7 @@ export default function create (params) {
|
||||
|
||||
return `
|
||||
mutation {
|
||||
${id}: CreateOrganization(
|
||||
CreateOrganization(
|
||||
id: "${id}",
|
||||
name: "${name}",
|
||||
description: "${description}",
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import faker from 'faker'
|
||||
import uuid from 'uuid/v4'
|
||||
|
||||
export default function (params) {
|
||||
const {
|
||||
id = `p${faker.random.number()}`,
|
||||
id = uuid(),
|
||||
title = faker.lorem.sentence(),
|
||||
content = [
|
||||
faker.lorem.sentence(),
|
||||
@ -19,7 +20,7 @@ export default function (params) {
|
||||
|
||||
return `
|
||||
mutation {
|
||||
${id}: CreatePost(
|
||||
CreatePost(
|
||||
id: "${id}",
|
||||
title: "${title}",
|
||||
content: "${content}",
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import faker from 'faker'
|
||||
import uuid from 'uuid/v4'
|
||||
|
||||
export default function (params) {
|
||||
const {
|
||||
id = `t${faker.random.number()}`,
|
||||
id = uuid(),
|
||||
name
|
||||
} = params
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import faker from 'faker'
|
||||
import uuid from 'uuid/v4'
|
||||
|
||||
export default function create (params) {
|
||||
const {
|
||||
id = `u${faker.random.number()}`,
|
||||
id = uuid(),
|
||||
name = faker.name.findName(),
|
||||
email = faker.internet.email(),
|
||||
password = '1234',
|
||||
@ -14,7 +15,7 @@ export default function create (params) {
|
||||
|
||||
return `
|
||||
mutation {
|
||||
${id}: CreateUser(
|
||||
CreateUser(
|
||||
id: "${id}",
|
||||
name: "${name}",
|
||||
password: "${password}",
|
||||
@ -22,8 +23,8 @@ export default function create (params) {
|
||||
avatar: "${avatar}",
|
||||
role: ${role},
|
||||
disabled: ${disabled},
|
||||
deleted: ${deleted}) {
|
||||
id
|
||||
deleted: ${deleted}
|
||||
) {
|
||||
name
|
||||
email
|
||||
avatar
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user