Remove definition of mutation disable

This commit is contained in:
Wolfgang Huß 2019-11-06 15:18:24 +01:00
parent 7d217148d3
commit 35b802bf82
3 changed files with 0 additions and 31 deletions

View File

@ -160,7 +160,6 @@ const permissions = shield(
shout: isAuthenticated,
unshout: isAuthenticated,
changePassword: isAuthenticated,
disable: isModerator,
decide: isModerator,
CreateComment: isAuthenticated,
UpdateComment: isAuthor,

View File

@ -1,34 +1,5 @@
export default {
Mutation: {
disable: async (object, params, { user, driver }) => {
const { id: resourceId } = params
const { id: userId } = user
const cypher = `
MATCH (u:User {id: $userId})
MATCH (resource {id: $resourceId})
WHERE resource:User OR resource:Comment OR resource:Post
SET resource.disabled = true
MERGE (resource)<-[decision:DECIDED]-(u)
SET (
CASE
WHEN decision.createdAt IS NOT NULL
THEN decision END).updatedAt = toString(datetime())
SET (
CASE
WHEN decision.createdAt IS NULL
THEN decision END).createdAt = toString(datetime())
SET decision.disable = true, decision.closed = false, decision.last = true
RETURN resource {.id}
`
const session = driver.session()
const res = await session.run(cypher, { resourceId, userId })
session.close()
const [resource] = res.records.map(record => {
return record.get('resource')
})
if (!resource) return null
return resource.id
},
decide: async (_object, params, context, _resolveInfo) => {
let createdRelationshipWithNestedAttributes = null
// Wolle console.log('params: ', params)

View File

@ -24,7 +24,6 @@ type Mutation {
changePassword(oldPassword: String!, newPassword: String!): String!
requestPasswordReset(email: String!): Boolean!
resetPassword(email: String!, nonce: String!, newPassword: String!): Boolean!
disable(id: ID!): ID
# Shout the given Type and ID
shout(id: ID!, type: ShoutTypeEnum): Boolean!
# Unshout the given Type and ID