mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Remove definition of mutation disable
This commit is contained in:
parent
7d217148d3
commit
35b802bf82
@ -160,7 +160,6 @@ const permissions = shield(
|
||||
shout: isAuthenticated,
|
||||
unshout: isAuthenticated,
|
||||
changePassword: isAuthenticated,
|
||||
disable: isModerator,
|
||||
decide: isModerator,
|
||||
CreateComment: isAuthenticated,
|
||||
UpdateComment: isAuthor,
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user