From 00454c874c8c56906840ce3231248372a9e09adc Mon Sep 17 00:00:00 2001 From: roschaefer Date: Tue, 3 Sep 2019 18:56:03 +0200 Subject: [PATCH] Remove read-only attributes from posts mutations For the comments, the fix is not that easy: They are still using `neo4j-graphql-js` in the resolvers. And that library needs the input params for the query builder. See: https://github.com/Human-Connection/Human-Connection/issues/1454 --- backend/src/middleware/softDeleteMiddleware.spec.js | 2 +- backend/src/schema/resolvers/posts.js | 2 +- backend/src/schema/types/type/Post.gql | 12 ------------ 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/backend/src/middleware/softDeleteMiddleware.spec.js b/backend/src/middleware/softDeleteMiddleware.spec.js index dd6be57ce..b77a7355a 100644 --- a/backend/src/middleware/softDeleteMiddleware.spec.js +++ b/backend/src/middleware/softDeleteMiddleware.spec.js @@ -17,7 +17,7 @@ let user let moderator let troll -let action = () => { +const action = () => { return query({ query: graphqlQuery }) } diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index c27fdbb48..ca3812a37 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -108,7 +108,7 @@ export default { params = await fileUpload(params, { file: 'imageUpload', url: 'image' }) const session = context.driver.session() - let updatePostCypher = `MATCH (post:Post {id: $params.id}) + let updatePostCypher = `MATCH (post:Post {id: $params.id}) SET post = $params ` diff --git a/backend/src/schema/types/type/Post.gql b/backend/src/schema/types/type/Post.gql index 4beee0e36..5f209ea19 100644 --- a/backend/src/schema/types/type/Post.gql +++ b/backend/src/schema/types/type/Post.gql @@ -57,26 +57,18 @@ type Post { type Mutation { CreatePost( id: ID - activityId: String - objectId: String title: String! slug: String content: String! image: String imageUpload: Upload visibility: Visibility - deleted: Boolean - disabled: Boolean - createdAt: String - updatedAt: String language: String categoryIds: [ID] contentExcerpt: String ): Post UpdatePost( id: ID! - activityId: String - objectId: String title: String! slug: String content: String! @@ -84,10 +76,6 @@ type Mutation { image: String imageUpload: Upload visibility: Visibility - deleted: Boolean - disabled: Boolean - createdAt: String - updatedAt: String language: String categoryIds: [ID] ): Post