From 5c88037d5ca82d6d7a7bb83948177de4ac58c3b4 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Thu, 3 Jan 2019 15:27:26 +0100 Subject: [PATCH 1/7] WIP - first try to create a report mutation which attaches nodes internally --- src/graphql-schema.js | 7 ++++ src/middleware/permissionsMiddleware.js | 9 +++-- src/schema.graphql | 22 ++++++++++++ src/seed/data/index.js | 4 ++- src/seed/data/reports.js | 45 +++++++++++++++++++++++++ 5 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 src/seed/data/reports.js diff --git a/src/graphql-schema.js b/src/graphql-schema.js index b52c9e232..7a3e65e3c 100644 --- a/src/graphql-schema.js +++ b/src/graphql-schema.js @@ -5,6 +5,7 @@ import bcrypt from 'bcryptjs' import zipObject from 'lodash/zipObject' import generateJwt from './jwt/generateToken' import { fixUrl } from './middleware/fixImageUrlsMiddleware' +import { neo4jgraphql } from 'neo4j-graphql-js' export const typeDefs = fs.readFileSync(process.env.GRAPHQL_SCHEMA || path.join(__dirname, 'schema.graphql')) @@ -121,6 +122,12 @@ export const resolvers = { session.close() throw new Error('No Such User exists.') + }, + report: async (parent, { resource, description }, { driver, req, user }, resolveInfo) => { + return neo4jgraphql(parent, { resource, description }, { driver, req, user }, resolveInfo) + // console.log('params', { resource, description }) + // console.log(`the user with the id ${user.id} tries to create a report on content of type ${resource.type} (${resource.id})`) + // throw new Error(`resource.id: ${resource.id}, resource.type: ${resource.type}, description: ${description}, user: ${user.id}`) } } } diff --git a/src/middleware/permissionsMiddleware.js b/src/middleware/permissionsMiddleware.js index 5b0cb87d2..a0051e856 100644 --- a/src/middleware/permissionsMiddleware.js +++ b/src/middleware/permissionsMiddleware.js @@ -1,11 +1,13 @@ import { rule, shield, allow } from 'graphql-shield' /* - * TODO: implement - * See: https://github.com/Human-Connection/Nitro-Backend/pull/40#pullrequestreview-180898363 +* TODO: implement +* See: https://github.com/Human-Connection/Nitro-Backend/pull/40#pullrequestreview-180898363 +*/ const isAuthenticated = rule()(async (parent, args, ctx, info) => { return ctx.user !== null }) +/* const isAdmin = rule()(async (parent, args, ctx, info) => { return ctx.user.role === 'ADMIN' }) @@ -26,8 +28,9 @@ const permissions = shield({ // customers: and(isAuthenticated, isAdmin) }, Mutation: { + report: isAuthenticated // addFruitToBasket: isAuthenticated - // CreateUser: allow + // CreateUser: allow, }, User: { email: isOwner, diff --git a/src/schema.graphql b/src/schema.graphql index bc6a3829c..978981c6f 100644 --- a/src/schema.graphql +++ b/src/schema.graphql @@ -5,6 +5,7 @@ type Query { type Mutation { login(email: String!, password: String!): LoggedInUser signup(email: String!, password: String!): Boolean! + report(resource: Resource!, description: String): Report } type LoggedInUser { id: ID! @@ -32,6 +33,17 @@ scalar Date scalar Time scalar DateTime +input Resource { + id: ID!, + type: _ResourceType! +} + +enum _ResourceType { + contribution + comment + user +} + enum VisibilityEnum { public friends @@ -138,6 +150,16 @@ type Comment { disabled: Boolean } +type Report { + id: ID! + author: User @relation(name: "REPORTED", direction: "IN") + description: String + createdAt: String + comment: Comment @relation(name: "REPORTED", direction: "OUT") + contribution: Post @relation(name: "REPORTED", direction: "OUT") + user: User @relation(name: "REPORTED", direction: "OUT") +} + type Category { id: ID! name: String! diff --git a/src/seed/data/index.js b/src/seed/data/index.js index e66342fe3..e67ceb59e 100644 --- a/src/seed/data/index.js +++ b/src/seed/data/index.js @@ -15,7 +15,9 @@ const seed = { Organization: require('./organizations.js').default, Post: require('./posts.js').default, Comment: require('./comments.js').default, - UserShouts: require('./users-shouts.js').default + UserShouts: require('./users-shouts.js').default, + + Reports: require('./reports.js').default } let data = {} diff --git a/src/seed/data/reports.js b/src/seed/data/reports.js new file mode 100644 index 000000000..939fe087b --- /dev/null +++ b/src/seed/data/reports.js @@ -0,0 +1,45 @@ +export default function (data) { + return ` + mutation { + r1: CreateReport(id: "r1", description: "Bad Stuff") { + id + } + r2: CreateReport(id: "r2", description: "Please remove this sh**") { + id + } + r3: CreateReport(id: "r3", description: "The user have misbehaved!") { + id + } + ra1: AddReportAuthor(from: { id: "u1" }, to: { id: "r1" }) { + from { + id + } + } + ra2: AddReportAuthor(from: { id: "u2" }, to: { id: "r2" }) { + from { + id + } + } + ra3: AddReportAuthor(from: { id: "u3" }, to: { id: "r3" }) { + from { + id + } + } + rc1: AddReportContribution(from: { id: "r1" }, to: { id: "p2" }) { + from { + id + } + } + rc2: AddReportComment(from: { id: "r2" }, to: { id: "c2" }) { + from { + id + } + } + rc3: AddReportUser(from: { id: "r3" }, to: { id: "u4" }) { + from { + id + } + } + } + ` +} From 6cc6538758d083e864e5713a16d51ced788e2670 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Thu, 3 Jan 2019 17:30:18 +0100 Subject: [PATCH 2/7] Add forgotten schema file --- src/graphql-schema.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/graphql-schema.js b/src/graphql-schema.js index 7a3e65e3c..c23cd1f8f 100644 --- a/src/graphql-schema.js +++ b/src/graphql-schema.js @@ -124,10 +124,10 @@ export const resolvers = { throw new Error('No Such User exists.') }, report: async (parent, { resource, description }, { driver, req, user }, resolveInfo) => { - return neo4jgraphql(parent, { resource, description }, { driver, req, user }, resolveInfo) - // console.log('params', { resource, description }) - // console.log(`the user with the id ${user.id} tries to create a report on content of type ${resource.type} (${resource.id})`) - // throw new Error(`resource.id: ${resource.id}, resource.type: ${resource.type}, description: ${description}, user: ${user.id}`) + // return neo4jgraphql(parent, { resource, description }, { driver, req, user }, resolveInfo) + console.log('params', { resource, description }) + console.log(`the user with the id ${user.id} tries to create a report on content of type ${resource.type} (${resource.id})`) + throw new Error(`resource.id: ${resource.id}, resource.type: ${resource.type}, description: ${description}, user: ${user.id}`) } } } From 52c32bb646e22657222ccf9f7bad134098585596 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Fri, 11 Jan 2019 16:34:06 +0100 Subject: [PATCH 3/7] Report now works --- src/graphql-schema.js | 48 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/src/graphql-schema.js b/src/graphql-schema.js index c23cd1f8f..56a774861 100644 --- a/src/graphql-schema.js +++ b/src/graphql-schema.js @@ -4,6 +4,7 @@ import path from 'path' import bcrypt from 'bcryptjs' import zipObject from 'lodash/zipObject' import generateJwt from './jwt/generateToken' +import uuid from 'uuid/v4' import { fixUrl } from './middleware/fixImageUrlsMiddleware' import { neo4jgraphql } from 'neo4j-graphql-js' @@ -124,10 +125,49 @@ export const resolvers = { throw new Error('No Such User exists.') }, report: async (parent, { resource, description }, { driver, req, user }, resolveInfo) => { - // return neo4jgraphql(parent, { resource, description }, { driver, req, user }, resolveInfo) - console.log('params', { resource, description }) - console.log(`the user with the id ${user.id} tries to create a report on content of type ${resource.type} (${resource.id})`) - throw new Error(`resource.id: ${resource.id}, resource.type: ${resource.type}, description: ${description}, user: ${user.id}`) + const contextId = uuid() + const session = driver.session() + const data = { + id: contextId, + type: resource.type, + createdAt: (new Date()).toISOString(), + description: resource.description + } + await session.run( + 'CREATE (r:Report $report) ' + + 'RETURN r.id, r.type, r.description', { + report: data + } + ) + let contentType + + switch (resource.type) { + case 'post': + case 'contribution': + contentType = 'Post' + break + case 'comment': + contentType = 'Comment' + break + case 'user': + contentType = 'User' + break + } + + await session.run( + `MATCH (author:User {id: $userId}), (context:${contentType} {id: $resourceId}), (report:Report {id: $contextId}) ` + + 'MERGE (report)<-[:REPORTED]-(author) ' + + 'MERGE (context)<-[:REPORTED]-(report) ' + + 'RETURN context', { + resourceId: resource.id, + userId: user.id, + contextId: contextId + } + ) + session.close() + + // TODO: output Report compatible object + return data } } } From feadc0e543470425bb363b67e27518e092cd35fe Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Fri, 11 Jan 2019 19:17:10 +0100 Subject: [PATCH 4/7] Rename _ResourceType to RecourceType in schema --- src/schema.graphql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/schema.graphql b/src/schema.graphql index 978981c6f..44c0cc509 100644 --- a/src/schema.graphql +++ b/src/schema.graphql @@ -35,10 +35,10 @@ scalar DateTime input Resource { id: ID!, - type: _ResourceType! + type: ResourceEnum! } -enum _ResourceType { +enum ResourceEnum { contribution comment user @@ -152,8 +152,9 @@ type Comment { type Report { id: ID! - author: User @relation(name: "REPORTED", direction: "IN") + reporter: User @relation(name: "REPORTED", direction: "IN") description: String + type: ResourceEnum! createdAt: String comment: Comment @relation(name: "REPORTED", direction: "OUT") contribution: Post @relation(name: "REPORTED", direction: "OUT") From 8b20f447f33cbee7efba314ea03ac9b2f8173a0c Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Fri, 18 Jan 2019 10:51:33 +0100 Subject: [PATCH 5/7] Fixed lint issues --- package.json | 4 +- src/graphql-schema.js | 20 +++---- yarn.lock | 126 +++++++++++++++++++++++------------------- 3 files changed, 81 insertions(+), 69 deletions(-) diff --git a/package.json b/package.json index 3efca40be..e564a50e7 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,9 @@ "license": "MIT", "jest": { "verbose": true, - "testMatch": ["**/src/**/?(*.)+(spec|test).js?(x)" ] + "testMatch": [ + "**/src/**/?(*.)+(spec|test).js?(x)" + ] }, "dependencies": { "apollo-cache-inmemory": "~1.4.0", diff --git a/src/graphql-schema.js b/src/graphql-schema.js index 8f6d605e2..e9475539b 100644 --- a/src/graphql-schema.js +++ b/src/graphql-schema.js @@ -135,16 +135,16 @@ export const resolvers = { let contentType switch (resource.type) { - case 'post': - case 'contribution': - contentType = 'Post' - break - case 'comment': - contentType = 'Comment' - break - case 'user': - contentType = 'User' - break + case 'post': + case 'contribution': + contentType = 'Post' + break + case 'comment': + contentType = 'Comment' + break + case 'user': + contentType = 'User' + break } await session.run( diff --git a/yarn.lock b/yarn.lock index a38f8fe6b..6b79c3a40 100644 --- a/yarn.lock +++ b/yarn.lock @@ -841,9 +841,9 @@ integrity sha512-A2TAGbTFdBw9azHbpVd+/FkdW2T6msN1uct1O9bH3vTerEHKZhTXJUQXy+hNq1B0RagfU8U+KBdqiZpxjhOUQA== "@types/node@*", "@types/node@^10.1.0": - version "10.12.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.12.tgz#e15a9d034d9210f00320ef718a50c4a799417c47" - integrity sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A== + version "10.12.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" + integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== "@types/range-parser@*": version "1.2.3" @@ -984,13 +984,13 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" -apollo-cache-control@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/apollo-cache-control/-/apollo-cache-control-0.3.3.tgz#ad71d8f786e06f0275b2432004c15c2d37c48484" - integrity sha512-X6JhKfIaMLfl2jpsK/880BflXA+2lmm2sAsOZL4Bn2VrMsDtOssI1Ij9vNRbch9k9cA4WJvKed7Sql/wUIa1Eg== +apollo-cache-control@0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/apollo-cache-control/-/apollo-cache-control-0.3.4.tgz#286344a417f5489ab034f9fb22ba106ebafbd666" + integrity sha512-9Z9cAfsTQELGvn0CZ4lEg/Kk5WnjRafU58Q9lMi+XOqSrYyX+MRe5pX4dI6jMVMTWfD0D7lyJZxAzoNrF/yZHA== dependencies: apollo-server-env "2.2.0" - graphql-extensions "0.3.3" + graphql-extensions "0.3.7" apollo-cache-control@0.4.0: version "0.4.0" @@ -1046,10 +1046,10 @@ apollo-datasource@0.2.1: apollo-server-caching "0.2.1" apollo-server-env "2.2.0" -apollo-engine-reporting-protobuf@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/apollo-engine-reporting-protobuf/-/apollo-engine-reporting-protobuf-0.1.0.tgz#fbc220cac2a3b7800ffc155d7e54c21c56b7848e" - integrity sha512-GReJtAYTmpwg0drb9VgFtqObYYTCHkJhlHEYCeXY8bJV4fOgXsAZ7CIXR9nPKO0mBaoHIHaGYvXGcyCLrZ36VA== +apollo-engine-reporting-protobuf@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/apollo-engine-reporting-protobuf/-/apollo-engine-reporting-protobuf-0.1.1.tgz#016d9ee1a73c6c0c666de975d117797fb8b390ea" + integrity sha512-HoXf7mcz0ZqTiubXLnymPK50iZOyw4h/HlzVETxCwE+PHNBcVBAA+fWram/oW1cqK2JPTQOYWszxHxPwcus+eQ== dependencies: protobufjs "^6.8.6" @@ -1060,15 +1060,15 @@ apollo-engine-reporting-protobuf@0.2.0: dependencies: protobufjs "^6.8.6" -apollo-engine-reporting@0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/apollo-engine-reporting/-/apollo-engine-reporting-0.1.3.tgz#85ad6ffd71db8f877202ce8b3d7dbfa7cabfbcf9" - integrity sha512-VkjiifHMHIAxydXecT+ck0WtqpFIsMlylKnKeuNAXfIfAXHX/JYtLhbArTTyhDunLrphMiUewfFv9P0K+aX2jw== +apollo-engine-reporting@0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/apollo-engine-reporting/-/apollo-engine-reporting-0.1.4.tgz#2fb52f2cf8880f758a4d790a11bb246e7c934492" + integrity sha512-484nvAuwpmm3WHgIFs7FQ1dhHmRClTHqMT0sLsxJBgpd/MwTWBAw8lDxRa+FrJrqegeWc30K8tCa24hZ3+Ifrw== dependencies: - apollo-engine-reporting-protobuf "0.1.0" + apollo-engine-reporting-protobuf "0.1.1" apollo-server-env "2.2.0" async-retry "^1.2.1" - graphql-extensions "0.3.3" + graphql-extensions "0.3.7" lodash "^4.17.10" apollo-engine-reporting@0.2.0: @@ -1127,24 +1127,24 @@ apollo-server-caching@0.2.1: dependencies: lru-cache "^5.0.0" -apollo-server-core@2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-2.2.6.tgz#33031a3e1156d4cd0ad3c5c49de263173f521b32" - integrity sha512-hC3+Y9A4rN4W2X2cWqjrWWHkjKaG/jUQjtAVpQteDW+7n3bLKHCrpDFiFad++lq0ymRVW8diAaYDS4myJwjmoA== +apollo-server-core@2.2.7: + version "2.2.7" + resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-2.2.7.tgz#1229f5ed54438bafbf2bb3f1c872d5c551b62833" + integrity sha512-fIdoZGoBtYW9U5NWlCdKNb17TOmrdrYIN/f12ILcysoBxTyAsBImZMLOLvyTV0sUSgx7Q9dV7ddiMufXGdAy5Q== dependencies: "@apollographql/apollo-tools" "^0.2.6" "@apollographql/apollo-upload-server" "^5.0.3" "@apollographql/graphql-playground-html" "^1.6.6" "@types/ws" "^6.0.0" - apollo-cache-control "0.3.3" + apollo-cache-control "0.3.4" apollo-datasource "0.2.1" - apollo-engine-reporting "0.1.3" + apollo-engine-reporting "0.1.4" apollo-server-caching "0.2.1" apollo-server-env "2.2.0" apollo-server-errors "2.2.0" - apollo-server-plugin-base "0.1.6" - apollo-tracing "0.3.3" - graphql-extensions "0.3.6" + apollo-server-plugin-base "0.1.7" + apollo-tracing "0.3.4" + graphql-extensions "0.3.7" graphql-subscriptions "^1.0.0" graphql-tag "^2.9.2" graphql-tools "^4.0.0" @@ -1240,10 +1240,10 @@ apollo-server-module-graphiql@^1.3.4, apollo-server-module-graphiql@^1.4.0: resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.4.0.tgz#c559efa285578820709f1769bb85d3b3eed3d8ec" integrity sha512-GmkOcb5he2x5gat+TuiTvabnBf1m4jzdecal3XbXBh/Jg+kx4hcvO3TTDFQ9CuTprtzdcVyA11iqG7iOMOt7vA== -apollo-server-plugin-base@0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.1.6.tgz#56932c0e3a0366e03952a6e2805efe5fa2e046bf" - integrity sha512-nh6I2+mgSL5cYxqYXymAr8xBZ/ju8nunPjHp/21+/mgbF4Is0xtM9oDq5Qf0Q/cGh/djF6YcBuB1yUG+68gJXw== +apollo-server-plugin-base@0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.1.7.tgz#fb91a0ba8ff505c01287227c874de6f272e5512a" + integrity sha512-Bfw++UWh0kzoAHqlsiYa/bxQSftCvwsF4KteFArTOKQjquBn1TTCWb64JTR5itZYuC5GDsoXGFQjQA3wWJyDVw== apollo-server-plugin-base@0.2.1: version "0.2.1" @@ -1251,11 +1251,11 @@ apollo-server-plugin-base@0.2.1: integrity sha512-497NIY9VWRYCrMSkgR11IrIUO4Fsy6aGgnpOJoTdLQAnkDD9SJDSRzwKj4gypUoTT2unfKDng4eMxXVZlHvjOw== apollo-server-testing@~2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/apollo-server-testing/-/apollo-server-testing-2.2.6.tgz#3ec60b6f099c2c55bd313cdbb8c177d8c86cda6d" - integrity sha512-1wUisLnY6fPNPK3RuE56q45K5bWWYIrEzfbw6dJudCBo7dtkMg33IfVwHvekbSFmRXmHIsnD0c1GSA10PV307A== + version "2.2.7" + resolved "https://registry.yarnpkg.com/apollo-server-testing/-/apollo-server-testing-2.2.7.tgz#8210e15ac2d53f174e15f4856a7b47d3a00d8c53" + integrity sha512-S+5yLcbwKe1sJ/mG8tPKSrc9mOCqGq07nCqbzaTwiorkJiKxoChMugHT30CGuNGoa0B7Vfdg2wOq3/zsO1i67w== dependencies: - apollo-server-core "2.2.6" + apollo-server-core "2.2.7" apollo-server@~2.3.1: version "2.3.1" @@ -1268,13 +1268,13 @@ apollo-server@~2.3.1: graphql-subscriptions "^1.0.0" graphql-tools "^4.0.0" -apollo-tracing@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/apollo-tracing/-/apollo-tracing-0.3.3.tgz#b819942180480c1c4d89e613cf2eff8f6d8b595a" - integrity sha512-gsTYgDVjtMlnomPq46aky7yk8XshCQfj9rxalCCismLlMomVW44fq+8GKQnZIkFOwiAsazRy4dzZ0cBbygA9sA== +apollo-tracing@0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/apollo-tracing/-/apollo-tracing-0.3.4.tgz#32f1c3dad6a0a5aa1fb442f006bf2ef248a125ae" + integrity sha512-U10mTuCic6Xi7Xez7SZic+nNuwFmZ4OlQnR835qGIkE8tq2GtXfFNcofO8kEDnGAnJasoUng8KIrZkSlUJdUSg== dependencies: apollo-server-env "2.2.0" - graphql-extensions "0.3.3" + graphql-extensions "0.3.7" apollo-tracing@0.4.0: version "0.4.0" @@ -2212,14 +2212,19 @@ core-js@^2.5.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.1.tgz#87416ae817de957a3f249b3b5ca475d4aaed6042" integrity sha512-L72mmmEayPJBejKIWe2pYtGis5r0tQ5NaJekdhyXgeMQTpJoBsH0NL4ElY2LfSoV15xeQWKQ+XTTOZdyero5Xg== -core-js@^2.5.3, core-js@^2.5.7: +core-js@^2.5.3: version "2.5.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" +core-js@^2.5.7: + version "2.6.2" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.2.tgz#267988d7268323b349e20b4588211655f0e83944" + integrity sha512-NdBPF/RVwPW6jr0NCILuyN9RiqLo2b1mddWHkUL+VnvcB7dzlnBJ1bXYntjpTGOgkZiiLWj2JxmOr7eGE3qK6g== + core-js@^3.0.0-beta.3: - version "3.0.0-beta.4" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0-beta.4.tgz#7443c32990d21198d23de18acb061a5e5bc9f549" - integrity sha512-yz4iJCkkSQLQSLHPGUln6r5ZBkLPzZSvHG0g1nfvcdnmpIe+KE9WOb1ZEEf6EEaEmjp9Ol0Kw5J5vnoIWc5eWw== + version "3.0.0-beta.9" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0-beta.9.tgz#1897789a5ef0ee1190d54777f35f80c38c077633" + integrity sha512-OGLbGro2f0s8UXVyu2s9kIW42pcuRoNEqJsmn8a4rAOO9G5A2t96l++rf+4mHNw9GKrbdozZ9G5ieDKOBl68zQ== core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" @@ -2623,7 +2628,7 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.4.3, es-abstract@^1.5.1: +es-abstract@^1.4.3: version "1.12.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" integrity sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA== @@ -2634,7 +2639,19 @@ es-abstract@^1.4.3, es-abstract@^1.5.1: is-callable "^1.1.3" is-regex "^1.0.4" -es-to-primitive@^1.1.1: +es-abstract@^1.5.1: + version "1.13.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" + integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== + dependencies: + es-to-primitive "^1.2.0" + function-bind "^1.1.1" + has "^1.0.3" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-keys "^1.0.12" + +es-to-primitive@^1.1.1, es-to-primitive@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== @@ -3414,17 +3431,10 @@ graphql-deduplicator@^2.0.1: resolved "https://registry.yarnpkg.com/graphql-deduplicator/-/graphql-deduplicator-2.0.2.tgz#d8608161cf6be97725e178df0c41f6a1f9f778f3" integrity sha512-0CGmTmQh4UvJfsaTPppJAcHwHln8Ayat7yXXxdnuWT+Mb1dBzkbErabCWzjXyKh/RefqlGTTA7EQOZHofMaKJA== -graphql-extensions@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.3.3.tgz#277efe11976bbdfd59915551606a2d550247bb45" - integrity sha512-pudOaHq7Ok+rh1ElzlqFaoYZWGefUNsqn/jX6eKns7rl0VHuB4qZBfhpVLTpquJpM6Y19/hsCYZNPfnUVMFIiA== - dependencies: - "@apollographql/apollo-tools" "^0.2.6" - -graphql-extensions@0.3.6: - version "0.3.6" - resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.3.6.tgz#9ddb294b4b3303df4bbfd8258f10ad402e290dba" - integrity sha512-QGnDQ0TkF1YpVE/ZvKVl3bZ1PfwSbynVBcNU5U1DPU56pLkltETORiFL4TQ/Tt7RzagBX/xVaI3q0xJC6h9M5w== +graphql-extensions@0.3.7: + version "0.3.7" + resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.3.7.tgz#1a7bb99a0e29c105dd64d8dccb955ddc8ddc31ad" + integrity sha512-i9Zo1w5uZmHoKP2qlh4PfxD85Ju08lMYrjUL6tROqipWTdrGMc107kUWBsiRvAVipcTyagKhDLF75FIvJiaHBg== dependencies: "@apollographql/apollo-tools" "^0.2.6" @@ -3681,7 +3691,7 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" -has@^1.0.1: +has@^1.0.1, has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== From 4c265bf3b8395735087406aac16e302ea83b6721 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Fri, 18 Jan 2019 11:22:44 +0100 Subject: [PATCH 6/7] Fixed report seeding --- src/seed/data/reports.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/seed/data/reports.js b/src/seed/data/reports.js index 939fe087b..9cecc4f9a 100644 --- a/src/seed/data/reports.js +++ b/src/seed/data/reports.js @@ -1,26 +1,26 @@ export default function (data) { return ` mutation { - r1: CreateReport(id: "r1", description: "Bad Stuff") { + r1: CreateReport(id: "r1", type: contribution, description: "Bad Stuff") { id } - r2: CreateReport(id: "r2", description: "Please remove this sh**") { + r2: CreateReport(id: "r2", type: comment, description: "Please remove this sh**") { id } - r3: CreateReport(id: "r3", description: "The user have misbehaved!") { + r3: CreateReport(id: "r3", type: user, description: "The user have misbehaved!") { id } - ra1: AddReportAuthor(from: { id: "u1" }, to: { id: "r1" }) { + ra1: AddReportReporter(from: { id: "u1" }, to: { id: "r1" }) { from { id } } - ra2: AddReportAuthor(from: { id: "u2" }, to: { id: "r2" }) { + ra2: AddReportReporter(from: { id: "u2" }, to: { id: "r2" }) { from { id } } - ra3: AddReportAuthor(from: { id: "u3" }, to: { id: "r3" }) { + ra3: AddReportReporter(from: { id: "u3" }, to: { id: "r3" }) { from { id } From 670292b3ec686bb134ef5acdb22c7b162d5abf3c Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Mon, 21 Jan 2019 11:08:37 +0100 Subject: [PATCH 7/7] Disabled report seeding to fix tests --- src/seed/data/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/seed/data/index.js b/src/seed/data/index.js index 84deed404..41f8bddd2 100644 --- a/src/seed/data/index.js +++ b/src/seed/data/index.js @@ -15,9 +15,9 @@ const seed = { Organization: require('./organizations.js').default, Post: require('./posts.js').default, Comment: require('./comments.js').default, - UserShouts: require('./users-shouts.js').default, + UserShouts: require('./users-shouts.js').default - Reports: require('./reports.js').default + // Reports: require('./reports.js').default } let data = {}