Incorporate @appinteractive's feedback

@appinteractive can we merge this soon?
This commit is contained in:
Robert Schäfer 2019-02-21 20:00:35 +01:00
parent 132dba04dd
commit eda2ea34fc
9 changed files with 35 additions and 30 deletions

View File

@ -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
})

View File

@ -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(
CreateBadge(
id: "${id}",
key: "${key}",
type: ${type},
status: ${status},
icon: "${icon}") { id }
icon: "${icon}"
) { id }
}
`
}

View File

@ -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

View File

@ -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},

View File

@ -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) {

View File

@ -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}",

View File

@ -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}",

View File

@ -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

View File

@ -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