mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +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
|
return ctx.user.id === parent.id
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -36,8 +36,8 @@ const permissions = shield({
|
|||||||
// CreateUser: allow,
|
// CreateUser: allow,
|
||||||
},
|
},
|
||||||
User: {
|
User: {
|
||||||
email: myself,
|
email: isMyOwn,
|
||||||
password: myself
|
password: isMyOwn
|
||||||
}
|
}
|
||||||
// Post: isAuthenticated
|
// Post: isAuthenticated
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import faker from 'faker'
|
import uuid from 'uuid/v4'
|
||||||
|
|
||||||
export default function (params) {
|
export default function (params) {
|
||||||
const {
|
const {
|
||||||
id = `cat${faker.random.number()}`,
|
id = uuid(),
|
||||||
key,
|
key,
|
||||||
type = 'crowdfunding',
|
type = 'crowdfunding',
|
||||||
status = 'permanent',
|
status = 'permanent',
|
||||||
@ -11,12 +11,13 @@ export default function (params) {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
${id}: CreateBadge(
|
CreateBadge(
|
||||||
id: "${id}",
|
id: "${id}",
|
||||||
key: "${key}",
|
key: "${key}",
|
||||||
type: ${type},
|
type: ${type},
|
||||||
status: ${status},
|
status: ${status},
|
||||||
icon: "${icon}") { id }
|
icon: "${icon}"
|
||||||
|
) { id }
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import faker from 'faker'
|
import uuid from 'uuid/v4'
|
||||||
|
|
||||||
export default function (params) {
|
export default function (params) {
|
||||||
const {
|
const {
|
||||||
id = `cat${faker.random.number()}`,
|
id = uuid(),
|
||||||
name,
|
name,
|
||||||
slug,
|
slug,
|
||||||
icon
|
icon
|
||||||
@ -11,10 +11,10 @@ export default function (params) {
|
|||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
CreateCategory(
|
CreateCategory(
|
||||||
id: "${id}",
|
id: "${id}",
|
||||||
name: "${name}",
|
name: "${name}",
|
||||||
slug: "${slug}",
|
slug: "${slug}",
|
||||||
icon: "${icon}"
|
icon: "${icon}"
|
||||||
) { id, name }
|
) { id, name }
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import faker from 'faker'
|
import faker from 'faker'
|
||||||
|
import uuid from 'uuid/v4'
|
||||||
|
|
||||||
export default function (params) {
|
export default function (params) {
|
||||||
const {
|
const {
|
||||||
id = `c${faker.random.number()}`,
|
id = uuid(),
|
||||||
content = [
|
content = [
|
||||||
faker.lorem.sentence(),
|
faker.lorem.sentence(),
|
||||||
faker.lorem.sentence()
|
faker.lorem.sentence()
|
||||||
@ -13,7 +14,7 @@ export default function (params) {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
${id}: CreateComment(
|
CreateComment(
|
||||||
id: "${id}",
|
id: "${id}",
|
||||||
content: "${content}",
|
content: "${content}",
|
||||||
disabled: ${disabled},
|
disabled: ${disabled},
|
||||||
|
|||||||
@ -51,7 +51,7 @@ export const cleanDatabase = async (options = {}) => {
|
|||||||
driver = getDriver()
|
driver = getDriver()
|
||||||
} = options
|
} = options
|
||||||
const session = driver.session()
|
const session = driver.session()
|
||||||
const cypher = 'MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r'
|
const cypher = 'MATCH (n) DETACH DELETE n'
|
||||||
try {
|
try {
|
||||||
return await session.run(cypher)
|
return await session.run(cypher)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import faker from 'faker'
|
import faker from 'faker'
|
||||||
|
import uuid from 'uuid/v4'
|
||||||
|
|
||||||
export default function create (params) {
|
export default function create (params) {
|
||||||
const {
|
const {
|
||||||
id = `o${faker.random.number()}`,
|
id = uuid(),
|
||||||
name = faker.comany.companyName(),
|
name = faker.comany.companyName(),
|
||||||
description = faker.company.catchPhrase(),
|
description = faker.company.catchPhrase(),
|
||||||
disabled = false,
|
disabled = false,
|
||||||
@ -11,7 +12,7 @@ export default function create (params) {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
${id}: CreateOrganization(
|
CreateOrganization(
|
||||||
id: "${id}",
|
id: "${id}",
|
||||||
name: "${name}",
|
name: "${name}",
|
||||||
description: "${description}",
|
description: "${description}",
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import faker from 'faker'
|
import faker from 'faker'
|
||||||
|
import uuid from 'uuid/v4'
|
||||||
|
|
||||||
export default function (params) {
|
export default function (params) {
|
||||||
const {
|
const {
|
||||||
id = `p${faker.random.number()}`,
|
id = uuid(),
|
||||||
title = faker.lorem.sentence(),
|
title = faker.lorem.sentence(),
|
||||||
content = [
|
content = [
|
||||||
faker.lorem.sentence(),
|
faker.lorem.sentence(),
|
||||||
@ -19,7 +20,7 @@ export default function (params) {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
${id}: CreatePost(
|
CreatePost(
|
||||||
id: "${id}",
|
id: "${id}",
|
||||||
title: "${title}",
|
title: "${title}",
|
||||||
content: "${content}",
|
content: "${content}",
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import faker from 'faker'
|
import uuid from 'uuid/v4'
|
||||||
|
|
||||||
export default function (params) {
|
export default function (params) {
|
||||||
const {
|
const {
|
||||||
id = `t${faker.random.number()}`,
|
id = uuid(),
|
||||||
name
|
name
|
||||||
} = params
|
} = params
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import faker from 'faker'
|
import faker from 'faker'
|
||||||
|
import uuid from 'uuid/v4'
|
||||||
|
|
||||||
export default function create (params) {
|
export default function create (params) {
|
||||||
const {
|
const {
|
||||||
id = `u${faker.random.number()}`,
|
id = uuid(),
|
||||||
name = faker.name.findName(),
|
name = faker.name.findName(),
|
||||||
email = faker.internet.email(),
|
email = faker.internet.email(),
|
||||||
password = '1234',
|
password = '1234',
|
||||||
@ -14,7 +15,7 @@ export default function create (params) {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
${id}: CreateUser(
|
CreateUser(
|
||||||
id: "${id}",
|
id: "${id}",
|
||||||
name: "${name}",
|
name: "${name}",
|
||||||
password: "${password}",
|
password: "${password}",
|
||||||
@ -22,8 +23,8 @@ export default function create (params) {
|
|||||||
avatar: "${avatar}",
|
avatar: "${avatar}",
|
||||||
role: ${role},
|
role: ${role},
|
||||||
disabled: ${disabled},
|
disabled: ${disabled},
|
||||||
deleted: ${deleted}) {
|
deleted: ${deleted}
|
||||||
id
|
) {
|
||||||
name
|
name
|
||||||
email
|
email
|
||||||
avatar
|
avatar
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user