From ae283718714cce092c796f075b4b38026478baf0 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Fri, 2 Nov 2018 16:01:25 +0100 Subject: [PATCH 01/33] Switching to apollo server --- server/package-lock.json | 671 +++++++++++++++++++++++++++++++++------ server/package.json | 4 +- server/src/app.js | 36 +-- 3 files changed, 592 insertions(+), 119 deletions(-) diff --git a/server/package-lock.json b/server/package-lock.json index c44492725..f7ebb4cd8 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -4,6 +4,21 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@apollographql/apollo-upload-server": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@apollographql/apollo-upload-server/-/apollo-upload-server-5.0.3.tgz", + "integrity": "sha512-tGAp3ULNyoA8b5o9LsU2Lq6SwgVPUOKAqKywu2liEtTvrFSGPrObwanhYwArq3GPeOqp2bi+JknSJCIU3oQN1Q==", + "requires": { + "@babel/runtime-corejs2": "^7.0.0-rc.1", + "busboy": "^0.2.14", + "object-path": "^0.11.4" + } + }, + "@apollographql/graphql-playground-html": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/@apollographql/graphql-playground-html/-/graphql-playground-html-1.6.4.tgz", + "integrity": "sha512-gwvaQO6/Hv4DEwhDLmmu2tzCU9oPjC5Xl9Kk8Yd0IxyKhYLlLalmkMMjsZLzU5H3fGaalLD96OYfxHL0ClVUDQ==" + }, "@babel/code-frame": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", @@ -117,6 +132,22 @@ "integrity": "sha512-gqmspPZOMW3MIRb9HlrnbZHXI1/KHTOroBwN1NcLL6pWxzqzEKGvRTq0W/PxS45OtQGbaFikSQpkS5zbnsQm2w==", "dev": true }, + "@babel/runtime-corejs2": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.1.2.tgz", + "integrity": "sha512-drxaPByExlcRDKW4ZLubUO4ZkI8/8ax9k9wve1aEthdLKFzjB7XRkOQ0xoTIWGxqdDnWDElkjYq77bt7yrcYJQ==", + "requires": { + "core-js": "^2.5.7", + "regenerator-runtime": "^0.12.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", + "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==" + } + } + }, "@babel/template": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.1.2.tgz", @@ -187,6 +218,60 @@ } } }, + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", + "requires": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" + }, "@sentry/core": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-4.1.1.tgz", @@ -244,6 +329,102 @@ "@sentry/types": "4.1.0" } }, + "@types/accepts": { + "version": "1.3.5", + "resolved": "http://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/body-parser": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.0.tgz", + "integrity": "sha512-a2+YeUjPkztKJu5aIF2yArYFQQp8d51wZ7DavSHjFuY1mqVgidGyzEQ41JIVNy82fXj8yPgy2vJmfIywgESW6w==", + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.32", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz", + "integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==", + "requires": { + "@types/node": "*" + } + }, + "@types/cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.4.tgz", + "integrity": "sha512-ipZjBVsm2tF/n8qFGOuGBkUij9X9ZswVi9G3bx/6dz7POpVa6gVHcj1wsX/LVEn9MMF41fxK/PnZPPoTD1UFPw==", + "requires": { + "@types/express": "*" + } + }, + "@types/events": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", + "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==" + }, + "@types/express": { + "version": "4.16.0", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.16.0.tgz", + "integrity": "sha512-TtPEYumsmSTtTetAPXlJVf3kEqb6wZK0bZojpJQrnD/djV4q1oB6QQ8aKvKqwNPACoe02GNiy5zDzcYivR5Z2w==", + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.16.0", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.16.0.tgz", + "integrity": "sha512-lTeoCu5NxJU4OD9moCgm0ESZzweAx0YqsAcab6OB0EB3+As1OaHtKnaGJvcngQxYsi9UNv0abn4/DRavrRxt4w==", + "requires": { + "@types/events": "*", + "@types/node": "*", + "@types/range-parser": "*" + } + }, + "@types/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz", + "integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==" + }, + "@types/mime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.0.tgz", + "integrity": "sha512-A2TAGbTFdBw9azHbpVd+/FkdW2T6msN1uct1O9bH3vTerEHKZhTXJUQXy+hNq1B0RagfU8U+KBdqiZpxjhOUQA==" + }, + "@types/node": { + "version": "10.12.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.2.tgz", + "integrity": "sha512-53ElVDSnZeFUUFIYzI8WLQ25IhWzb6vbddNp8UHlXQyU0ET2RhV5zg0NfubzU7iNMh5bBXb0htCzfvrSVNgzaQ==" + }, + "@types/range-parser": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.2.tgz", + "integrity": "sha512-HtKGu+qG1NPvYe1z7ezLsyIaXYyi8SoAVqWDZgDQ8dLrsZvSzUNCwZyfX33uhWxL/SU0ZDQZ3nwZ0nimt507Kw==" + }, + "@types/serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-/BZ4QRLpH/bNYgZgwhKEh+5AsboDBcUdlBYgzoLX0fpj3Y2gp6EApyOlM3bK53wQS/OE1SrdSYBAbux2D1528Q==", + "requires": { + "@types/express-serve-static-core": "*", + "@types/mime": "*" + } + }, + "@types/ws": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-5.1.2.tgz", + "integrity": "sha512-NkTXUKTYdXdnPE2aUUbGOXE1XfMK527SCvU/9bj86kyFF6kZ9ZnOQ3mK5jADn98Y2vEUD/7wKDgZa7Qst2wYOg==", + "requires": { + "@types/events": "*", + "@types/node": "*" + } + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -321,10 +502,152 @@ "normalize-path": "^2.0.0" } }, + "apollo-cache-control": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/apollo-cache-control/-/apollo-cache-control-0.2.5.tgz", + "integrity": "sha512-xEDrUvo3U2mQKSzA8NzQmgeqK4ytwFnTGl2YKGKPfG0+r8fZdswKp6CDBue29KLO8KkSuqW/hntveWrAdK51FQ==", + "requires": { + "apollo-server-env": "^2.0.3", + "graphql-extensions": "^0.2.1" + } + }, + "apollo-datasource": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/apollo-datasource/-/apollo-datasource-0.1.3.tgz", + "integrity": "sha512-yEGEe5Cjzqqu5ml1VV3O8+C+thzdknZri9Ny0P3daTGNO+45J3vBOMcmaANeeI2+OOeWxdqUNa5aPOx/35kniw==", + "requires": { + "apollo-server-caching": "0.1.2", + "apollo-server-env": "2.0.3" + } + }, + "apollo-engine-reporting": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/apollo-engine-reporting/-/apollo-engine-reporting-0.0.6.tgz", + "integrity": "sha512-JmfNJ9v3QEJQ8ZhLfCKEDiww53n5kj5HarP85p8LreoYNojbvcWN8Qm6RgvSG5N/ZJrAYHeTRQbSxm1vWwGubw==", + "requires": { + "apollo-engine-reporting-protobuf": "^0.0.1", + "apollo-server-env": "^2.0.3", + "async-retry": "^1.2.1", + "graphql-extensions": "^0.2.1", + "lodash": "^4.17.10" + } + }, + "apollo-engine-reporting-protobuf": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/apollo-engine-reporting-protobuf/-/apollo-engine-reporting-protobuf-0.0.1.tgz", + "integrity": "sha512-AySoDgog2p1Nph44FyyqaU4AfRZOXx8XZxRsVHvYY4dHlrMmDDhhjfF3Jswa7Wr8X/ivvx3xA0jimRn6rsG8Ew==", + "requires": { + "protobufjs": "^6.8.6" + } + }, + "apollo-link": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/apollo-link/-/apollo-link-1.2.3.tgz", + "integrity": "sha512-iL9yS2OfxYhigme5bpTbmRyC+Htt6tyo2fRMHT3K1XRL/C5IQDDz37OjpPy4ndx7WInSvfSZaaOTKFja9VWqSw==", + "requires": { + "apollo-utilities": "^1.0.0", + "zen-observable-ts": "^0.8.10" + } + }, + "apollo-server-caching": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/apollo-server-caching/-/apollo-server-caching-0.1.2.tgz", + "integrity": "sha512-jBRnsTgXN0m8yVpumoelaUq9mXR7YpJ3EE+y/alI7zgXY+0qFDqksRApU8dEfg3q6qUnO7rFxRhdG5eyc0+1ig==", + "requires": { + "lru-cache": "^4.1.3" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + } + } + }, + "apollo-server-core": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.1.0.tgz", + "integrity": "sha512-D1Tw0o3NzCQ2KGM8EWh9AHELHmn/SE361dtlqJxkbelxXqAkCIGIFywF30h+0ezhMbgbO7eqBBJfvRilF/oJHA==", + "requires": { + "@apollographql/apollo-upload-server": "^5.0.3", + "@types/ws": "^5.1.2", + "apollo-cache-control": "^0.2.5", + "apollo-datasource": "^0.1.3", + "apollo-engine-reporting": "^0.0.6", + "apollo-server-caching": "^0.1.2", + "apollo-server-env": "^2.0.3", + "apollo-server-errors": "^2.0.2", + "apollo-tracing": "^0.2.5", + "graphql-extensions": "^0.2.1", + "graphql-subscriptions": "^0.5.8", + "graphql-tag": "^2.9.2", + "graphql-tools": "^3.0.4", + "hash.js": "^1.1.3", + "lodash": "^4.17.10", + "subscriptions-transport-ws": "^0.9.11", + "ws": "^5.2.0" + } + }, + "apollo-server-env": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/apollo-server-env/-/apollo-server-env-2.0.3.tgz", + "integrity": "sha512-uIfKFH8n8xKO0eLb9Fa79+s2DdMuVethgznvW6SrOYq5VzgkIIobqKEuZPKa5wObw9CkCyju/+Sr7b7WWMFxUQ==", + "requires": { + "node-fetch": "^2.1.2", + "util.promisify": "^1.0.0" + } + }, + "apollo-server-errors": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/apollo-server-errors/-/apollo-server-errors-2.0.2.tgz", + "integrity": "sha512-zyWDqAVDCkj9espVsoUpZr9PwDznM8UW6fBfhV+i1br//s2AQb07N6ektZ9pRIEvkhykDZW+8tQbDwAO0vUROg==" + }, + "apollo-server-express": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.1.0.tgz", + "integrity": "sha512-jLFIz1VLduMA/rme4OAy3IPeoaMEZOPoQXpio8AhfjIqCijRPPfoWJ2QMqz56C/g3vas7rZtgcVOrHpjBKudjw==", + "requires": { + "@apollographql/apollo-upload-server": "^5.0.3", + "@apollographql/graphql-playground-html": "^1.6.0", + "@types/accepts": "^1.3.5", + "@types/body-parser": "1.17.0", + "@types/cors": "^2.8.4", + "@types/express": "4.16.0", + "accepts": "^1.3.5", + "apollo-server-core": "^2.1.0", + "body-parser": "^1.18.3", + "cors": "^2.8.4", + "graphql-subscriptions": "^0.5.8", + "graphql-tools": "^3.0.4", + "type-is": "^1.6.16" + } + }, + "apollo-tracing": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/apollo-tracing/-/apollo-tracing-0.2.5.tgz", + "integrity": "sha512-DZO7pfL5LATHeJdVFoTZ/N3HwA+IMf1YnIt5K+uMQW+/MrRgYOtTszUv5tYX2cUIqHYHcbdDaBQUuIXwSpaV2Q==", + "requires": { + "apollo-server-env": "^2.0.3", + "graphql-extensions": "^0.2.1" + } + }, + "apollo-utilities": { + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.0.25.tgz", + "integrity": "sha512-AXvqkhni3Ir1ffm4SA1QzXn8k8I5BBl4PVKEyak734i4jFdp+xgfUyi2VCqF64TJlFTA/B73TRDUvO2D+tKtZg==", + "requires": { + "fast-json-stable-stringify": "^2.0.0" + } + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -396,6 +719,19 @@ "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", "dev": true }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "async-retry": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.2.3.tgz", + "integrity": "sha512-tfDb02Th6CE6pJUF2gjW5ZVjsgwlucVXOEQMvEX9JgSJMs9gAX+Nz3xRuJBKuUYjTSYORqvDBORdAQ3LU59g7Q==", + "requires": { + "retry": "0.12.0" + } + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -1216,10 +1552,16 @@ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "base": { "version": "0.11.2", @@ -1366,6 +1708,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1404,6 +1747,38 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "busboy": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz", + "integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=", + "requires": { + "dicer": "0.2.5", + "readable-stream": "1.1.x" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -1611,7 +1986,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "configstore": { "version": "3.1.2", @@ -1671,14 +2047,12 @@ "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", - "dev": true + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cors": { "version": "2.8.4", @@ -1698,15 +2072,6 @@ "capture-stack-trace": "^1.0.0" } }, - "cross-fetch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.2.2.tgz", - "integrity": "sha1-pH/09/xxLauo9qaVoRyUhEDUVyM=", - "requires": { - "node-fetch": "2.1.2", - "whatwg-fetch": "2.0.4" - } - }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -1759,7 +2124,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -1845,6 +2209,11 @@ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" }, + "deprecated-decorator": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/deprecated-decorator/-/deprecated-decorator-0.1.6.tgz", + "integrity": "sha1-AJZjF7ehL+kvPMgx91g68ym4bDc=" + }, "destroy": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", @@ -1859,6 +2228,38 @@ "repeating": "^2.0.0" } }, + "dicer": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz", + "integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=", + "requires": { + "readable-stream": "1.1.x", + "streamsearch": "0.1.2" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, "doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -1923,7 +2324,6 @@ "version": "1.12.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, "requires": { "es-to-primitive": "^1.1.1", "function-bind": "^1.1.1", @@ -1936,7 +2336,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", - "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -2183,7 +2582,8 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true }, "esquery": { "version": "1.0.1", @@ -2236,6 +2636,11 @@ "through": "^2.3.8" } }, + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" + }, "execa": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", @@ -2308,17 +2713,6 @@ "vary": "~1.1.2" } }, - "express-graphql": { - "version": "0.6.12", - "resolved": "http://registry.npmjs.org/express-graphql/-/express-graphql-0.6.12.tgz", - "integrity": "sha512-ouLWV0hRw4hnaLtXzzwhdC79ewxKbY2PRvm05mPc/zOH5W5WVCHDQ1SmNxEPBQdUeeSNh29aIqW9zEQkA3kMuA==", - "requires": { - "accepts": "^1.3.0", - "content-type": "^1.0.4", - "http-errors": "^1.3.0", - "raw-body": "^2.3.2" - } - }, "extend-shallow": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", @@ -2381,8 +2775,7 @@ "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, "fast-levenshtein": { "version": "2.0.6", @@ -3075,8 +3468,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "functional-red-black-tree": { "version": "1.0.1", @@ -3200,63 +3592,43 @@ "iterall": "^1.2.2" } }, - "graphql-config": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/graphql-config/-/graphql-config-2.2.1.tgz", - "integrity": "sha512-U8+1IAhw9m6WkZRRcyj8ZarK96R6lQBQ0an4lp76Ps9FyhOXENC5YQOxOFGm5CxPrX2rD0g3Je4zG5xdNJjwzQ==", + "graphql-extensions": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.2.1.tgz", + "integrity": "sha512-/1FTPSWSffDjlRyMAV2UwQhojLmca9aQD0ieo1IYiqT5SE+uOWi4r83QF1CoER0sREIsH3s+nTmdH3cvQVG3MA==", "requires": { - "graphql-import": "^0.7.1", - "graphql-request": "^1.5.0", - "js-yaml": "^3.10.0", - "lodash": "^4.17.4", - "minimatch": "^3.0.4" + "apollo-server-env": "^2.0.3" } }, - "graphql-import": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/graphql-import/-/graphql-import-0.7.1.tgz", - "integrity": "sha512-YpwpaPjRUVlw2SN3OPljpWbVRWAhMAyfSba5U47qGMOSsPLi2gYeJtngGpymjm9nk57RFWEpjqwh4+dpYuFAPw==", + "graphql-subscriptions": { + "version": "0.5.8", + "resolved": "http://registry.npmjs.org/graphql-subscriptions/-/graphql-subscriptions-0.5.8.tgz", + "integrity": "sha512-0CaZnXKBw2pwnIbvmVckby5Ge5e2ecmjofhYCdyeACbCly2j3WXDP/pl+s+Dqd2GQFC7y99NB+53jrt55CKxYQ==", "requires": { - "lodash": "^4.17.4", - "resolve-from": "^4.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" - } + "iterall": "^1.2.1" } }, - "graphql-playground-html": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/graphql-playground-html/-/graphql-playground-html-1.6.4.tgz", - "integrity": "sha512-mnpAVYSR3TesYsJ5OLJVJMA0muTCw4npsCI1cKMtW35lbA6KljZkLkz3ZWXhEIYPnHKIeUHEtbn1ZGkEXtAxLg==", - "requires": { - "graphql-config": "2.2.1" - } + "graphql-tag": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.10.0.tgz", + "integrity": "sha512-9FD6cw976TLLf9WYIUPCaaTpniawIjHWZSwIRZSjrfufJamcXbVVYfN2TWvJYbw0Xf2JjYbl1/f2+wDnBVw3/w==" }, - "graphql-playground-middleware-express": { - "version": "1.7.6", - "resolved": "https://registry.npmjs.org/graphql-playground-middleware-express/-/graphql-playground-middleware-express-1.7.6.tgz", - "integrity": "sha512-fICPxYGIdhCxtFlwCnP3uZ2uRWeQ9wj7OkcWUiHNwaFma2TbRD5nNKaPA2u21YWha9xv26qIDxxcdW27F/lcbQ==", + "graphql-tools": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/graphql-tools/-/graphql-tools-3.1.1.tgz", + "integrity": "sha512-yHvPkweUB0+Q/GWH5wIG60bpt8CTwBklCSzQdEHmRUgAdEQKxw+9B7zB3dG7wB3Ym7M7lfrS4Ej+jtDZfA2UXg==", "requires": { - "graphql-playground-html": "1.6.4" - } - }, - "graphql-request": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-1.8.2.tgz", - "integrity": "sha512-dDX2M+VMsxXFCmUX0Vo0TopIZIX4ggzOtiCsThgtrKR4niiaagsGTDIHj3fsOMFETpa064vzovI+4YV4QnMbcg==", - "requires": { - "cross-fetch": "2.2.2" + "apollo-link": "^1.2.2", + "apollo-utilities": "^1.0.1", + "deprecated-decorator": "^0.1.6", + "iterall": "^1.1.3", + "uuid": "^3.1.0" } }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -3279,8 +3651,7 @@ "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", - "dev": true + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" }, "has-value": { "version": "1.0.0", @@ -3342,6 +3713,15 @@ } } }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, "home-or-tmp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", @@ -3544,8 +3924,7 @@ "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" }, "is-ci": { "version": "1.2.1", @@ -3568,8 +3947,7 @@ "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" }, "is-descriptor": { "version": "0.1.6", @@ -3746,7 +4124,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, "requires": { "has": "^1.0.1" } @@ -3773,7 +4150,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", - "dev": true, "requires": { "has-symbols": "^1.0.0" } @@ -3821,6 +4197,7 @@ "version": "3.12.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -3937,6 +4314,11 @@ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" }, + "long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -4081,10 +4463,16 @@ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4764,8 +5152,12 @@ "object-keys": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" + }, + "object-path": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.4.tgz", + "integrity": "sha1-NwrnUvvzfePqcKhhwju6iRVpGUk=" }, "object-visit": { "version": "1.0.1", @@ -4808,6 +5200,15 @@ "has": "^1.0.1" } }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", @@ -5123,6 +5524,26 @@ "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==", "dev": true }, + "protobufjs": { + "version": "6.8.8", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", + "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==", + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.0", + "@types/node": "^10.1.0", + "long": "^4.0.0" + } + }, "proxy-addr": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", @@ -5144,8 +5565,7 @@ "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" }, "pstree.remy": { "version": "1.1.0", @@ -5762,6 +6182,11 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -6135,7 +6560,8 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "stack-trace": { "version": "0.0.10", @@ -6178,6 +6604,11 @@ "through": "~2.3.4" } }, + "streamsearch": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", + "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=" + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -6241,12 +6672,29 @@ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, + "subscriptions-transport-ws": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.15.tgz", + "integrity": "sha512-f9eBfWdHsePQV67QIX+VRhf++dn1adyC/PZHP6XI5AfKnZ4n0FW+v5omxwdHVpd4xq2ZijaHEcmlQrhBY79ZWQ==", + "requires": { + "backo2": "^1.0.2", + "eventemitter3": "^3.1.0", + "iterall": "^1.2.1", + "symbol-observable": "^1.0.4", + "ws": "^5.2.0" + } + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" + }, "table": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/table/-/table-5.1.0.tgz", @@ -6589,11 +7037,25 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, "v8flags": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", @@ -6618,11 +7080,6 @@ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, - "whatwg-fetch": { - "version": "2.0.4", - "resolved": "http://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz", - "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==" - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -6673,6 +7130,14 @@ "signal-exit": "^3.0.2" } }, + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "requires": { + "async-limiter": "~1.0.0" + } + }, "xdg-basedir": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", @@ -6682,8 +7147,20 @@ "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + }, + "zen-observable": { + "version": "0.8.11", + "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.11.tgz", + "integrity": "sha512-N3xXQVr4L61rZvGMpWe8XoCGX8vhU35dPyQ4fm5CY/KDlG0F75un14hjbckPXTDuKUY6V0dqR2giT6xN8Y4GEQ==" + }, + "zen-observable-ts": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.10.tgz", + "integrity": "sha512-5vqMtRggU/2GhePC9OU4sYEWOdvmayp2k3gjPf4F0mXwB3CSbbNznfDUvDJx9O2ZTa1EIXdJhPchQveFKwNXPQ==", + "requires": { + "zen-observable": "^0.8.0" + } } } } diff --git a/server/package.json b/server/package.json index 73c601f30..bc2983b27 100644 --- a/server/package.json +++ b/server/package.json @@ -26,13 +26,11 @@ }, "dependencies": { "@sentry/node": "^4.1.1", + "apollo-server-express": "^2.1.0", "axios": "^0.18.0", - "cors": "^2.8.4", "dotenv": "^6.0.0", "express": "^4.16.3", - "express-graphql": "^0.6.12", "graphql": "^14.0.0", - "graphql-playground-middleware-express": "^1.7.6", "mongoose": "^5.3.4" } } diff --git a/server/src/app.js b/server/src/app.js index b36f54aef..56654310a 100644 --- a/server/src/app.js +++ b/server/src/app.js @@ -1,8 +1,6 @@ import 'dotenv/config'; import express from 'express'; -import cors from 'cors'; -import graphqlHTTP from 'express-graphql'; -import expressPlayground from 'graphql-playground-middleware-express'; +import { ApolloServer } from 'apollo-server-express'; import * as Sentry from '@sentry/node'; import schema from './schema'; @@ -12,27 +10,27 @@ const app = express(); Sentry.init({ dsn: process.env.SENTRY_DNS }); app.use(Sentry.Handlers.requestHandler()); -// authorising CORS -app.use(cors()); // Starting the graphql server -app.use('/graphql', graphqlHTTP(req => ({ +const server = new ApolloServer({ schema, - context: { - userId: req.headers.userid, - authorization: req.headers.authorization, + playground: { + settings: { + 'editor.theme': 'dark', + 'editor.cursorShape': 'line', + }, }, - formatError(err) { - return { - message: err.message, - code: err.originalError && err.originalError.code, - path: err.path, - }; - }, -}))); + formatError: error => ({ + code: error.extensions.exception.code, + message: error.message, + path: error.path, + }), +}); -// Starting the graphql server -app.get('/playground', expressPlayground({ endpoint: '/graphql' })); +server.applyMiddleware({ + app, + cors: true, +}); // Sentry error handling middleware if anything pass through app.use(Sentry.Handlers.errorHandler()); From d58ffd0219efb96ca39607f6aad557e3c93cc370 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Fri, 2 Nov 2018 16:33:33 +0100 Subject: [PATCH 02/33] Refactoring models in order to facilitate lisibility --- server/src/models/event.js | 78 +++++++++++++++++++++++++++++------- server/src/models/formula.js | 15 +++++-- server/src/models/plotter.js | 30 +++++++++++--- 3 files changed, 99 insertions(+), 24 deletions(-) diff --git a/server/src/models/event.js b/server/src/models/event.js index c72ce3187..7c28d7dfc 100644 --- a/server/src/models/event.js +++ b/server/src/models/event.js @@ -6,32 +6,80 @@ import { EventStatusEnum, } from '../enums/EventStatus'; +const { ObjectId } = Schema.Types; + const eventSchema = new Schema({ - designator: { type: String, required: true }, - status: { type: String, enum: EventStatusEnum, default: UNPUBLISHED }, - name: { type: String, required: true }, - hostId: { type: String, required: true }, + designator: { + type: String, + required: true, + }, + status: { + type: String, + enum: EventStatusEnum, + default: UNPUBLISHED, + }, + name: { + type: String, + required: true, + }, + hostId: { + type: String, + required: true, + }, description: String, - startDatetime: { type: Number, required: true }, - finishDatetime: { type: Number, required: true }, - formula: { type: Schema.Types.ObjectId, ref: Formula.modelName }, - plotter: { type: Schema.Types.ObjectId, ref: Plotter.modelName }, + startDatetime: { + type: Number, + required: true, + }, + finishDatetime: { + type: Number, + required: true, + }, + formula: { + type: ObjectId, + ref: Formula.modelName, + }, + plotter: { + type: ObjectId, + ref: Plotter.modelName, + }, rules: [{ - position: { type: Number, required: true }, - title: { type: String, required: true }, + position: { + type: Number, + required: true, + }, + title: { + type: String, + required: true, + }, description: String, }], prizes: [{ - rank: { type: Number, required: true }, - amount: { type: Number, required: true }, + rank: { + type: Number, + required: true, + }, + amount: { + type: Number, + required: true, + }, additional: [{ condition: String, - amount: { type: Number, required: true }, - asset: { type: String, required: true }, + amount: { + type: Number, + required: true, + }, + asset: { + type: String, + required: true, + }, }], }], participants: [{ - teamId: { type: String, required: true }, + teamId: { + type: String, + required: true, + }, botId: String, releaseId: String, }], diff --git a/server/src/models/formula.js b/server/src/models/formula.js index 43132bbf2..ccc774334 100644 --- a/server/src/models/formula.js +++ b/server/src/models/formula.js @@ -1,9 +1,18 @@ import mongoose, { Schema } from 'mongoose'; const formulaSchema = new Schema({ - ownerId: { type: String, required: true }, - isTemplate: { type: Boolean, default: false }, - name: { type: String, required: true }, + ownerId: { + type: String, + required: true, + }, + isTemplate: { + type: Boolean, + default: false, + }, + name: { + type: String, + required: true, + }, }); const Formula = mongoose.model('Formula', formulaSchema); diff --git a/server/src/models/plotter.js b/server/src/models/plotter.js index 77f274206..a9a7feb92 100644 --- a/server/src/models/plotter.js +++ b/server/src/models/plotter.js @@ -1,12 +1,30 @@ import mongoose, { Schema } from 'mongoose'; const plotterSchema = new Schema({ - ownerId: { type: String, required: true }, - isTemplate: { type: Boolean, default: false }, - name: { type: String, required: true }, - host: { type: String, required: true }, - repo: { type: String, required: true }, - moduleName: { type: String, required: true }, + ownerId: { + type: String, + required: true, + }, + isTemplate: { + type: Boolean, + default: false, + }, + name: { + type: String, + required: true, + }, + host: { + type: String, + required: true, + }, + repo: { + type: String, + required: true, + }, + moduleName: { + type: String, + required: true, + }, }); const Plotter = mongoose.model('Plotter', plotterSchema); From fa02ee759341649a612220332ab7d787b60a6771 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Fri, 2 Nov 2018 20:00:40 +0100 Subject: [PATCH 03/33] Adding a preshared key verification middleware --- server/.env.example | 2 ++ server/src/app.js | 9 +++++++++ server/src/errors/notAllowed.json | 8 ++++++++ 3 files changed, 19 insertions(+) create mode 100644 server/src/errors/notAllowed.json diff --git a/server/.env.example b/server/.env.example index a96aeb926..81868d2aa 100644 --- a/server/.env.example +++ b/server/.env.example @@ -1,3 +1,5 @@ +PRESHARED_GATEWAY_KEY=SECRET_STUFF + PORT=3000 DB_USERNAME=example_name DB_PASSWORD=example_password diff --git a/server/src/app.js b/server/src/app.js index 56654310a..2a53b0250 100644 --- a/server/src/app.js +++ b/server/src/app.js @@ -3,6 +3,7 @@ import express from 'express'; import { ApolloServer } from 'apollo-server-express'; import * as Sentry from '@sentry/node'; import schema from './schema'; +import wrongPreshared from './errors/notAllowed.json'; const app = express(); @@ -10,6 +11,14 @@ const app = express(); Sentry.init({ dsn: process.env.SENTRY_DNS }); app.use(Sentry.Handlers.requestHandler()); +app.post('/graphql', (req, res, next) => { + if (req.headers.preshared === process.env.PRESHARED_GATEWAY_KEY) { + next(); + } else { + res.send(wrongPreshared); + } +}); + // Starting the graphql server const server = new ApolloServer({ diff --git a/server/src/errors/notAllowed.json b/server/src/errors/notAllowed.json new file mode 100644 index 000000000..b76604aa2 --- /dev/null +++ b/server/src/errors/notAllowed.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "code": 401, + "message": "Wait, you're not supposed to be here, go through the gate as everyone else" + } + ] +} From b85dcb474f2abf1bfe537ef6f24e4622b0e357ac Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Fri, 2 Nov 2018 22:51:05 +0100 Subject: [PATCH 04/33] Adding the context configuration to apollo server --- server/src/app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/app.js b/server/src/app.js index 2a53b0250..5dfc2d97c 100644 --- a/server/src/app.js +++ b/server/src/app.js @@ -29,6 +29,10 @@ const server = new ApolloServer({ 'editor.cursorShape': 'line', }, }, + context: ({ req }) => ({ + userId: req.headers.userid, + authorization: req.headers.authorization, + }), formatError: error => ({ code: error.extensions.exception.code, message: error.message, From 895eb3c475cc1f4684f81f54f63010d28cde2c21 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Fri, 2 Nov 2018 22:54:49 +0100 Subject: [PATCH 05/33] Adapting team verification calls to go through gateway --- server/.env.example | 2 +- server/src/schema/mutations/EditParticipant.js | 5 ++--- server/src/schema/mutations/RegisterToEvent.js | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/server/.env.example b/server/.env.example index 81868d2aa..25c16847a 100644 --- a/server/.env.example +++ b/server/.env.example @@ -7,4 +7,4 @@ DB_DOMAIN=example.com:1234/example_name SENTRY_DNS=https://some-val@sentry.io/some-id -TEAMS_ENDPOINT=https://teams-api.advancedalgos.net/graphql/ +GATEWAY_ENDPOINT=https://app-api.advancedalgos.net/graphql/ diff --git a/server/src/schema/mutations/EditParticipant.js b/server/src/schema/mutations/EditParticipant.js index 0abb8db32..fde3145da 100644 --- a/server/src/schema/mutations/EditParticipant.js +++ b/server/src/schema/mutations/EditParticipant.js @@ -28,19 +28,18 @@ const resolve = (parent, { } return new Promise((res, rej) => { axios({ - url: process.env.TEAMS_ENDPOINT, + url: process.env.GATEWAY_ENDPOINT, method: 'post', data: { query: ` { - teamsByRole{ + teams_TeamsByRole{ id } } `, }, headers: { - userid, authorization: context.authorization, }, }).then( diff --git a/server/src/schema/mutations/RegisterToEvent.js b/server/src/schema/mutations/RegisterToEvent.js index 7b3ee5050..a3443c4de 100644 --- a/server/src/schema/mutations/RegisterToEvent.js +++ b/server/src/schema/mutations/RegisterToEvent.js @@ -29,19 +29,18 @@ const resolve = (parent, { } return new Promise((res, rej) => { axios({ - url: process.env.TEAMS_ENDPOINT, + url: process.env.GATEWAY_ENDPOINT, method: 'post', data: { query: ` { - teamsByRole{ + teams_TeamsByRole{ id } } `, }, headers: { - userid, authorization: context.authorization, }, }).then( From f4cf5884f5e00d043446772224a692515301c679 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Sat, 3 Nov 2018 15:52:08 +0100 Subject: [PATCH 06/33] New types in order to dry up the code --- server/src/schema/types/AdditionalPrize.js | 8 +++-- server/src/schema/types/Event.js | 1 + server/src/schema/types/Formula.js | 1 + server/src/schema/types/Participant.js | 1 + server/src/schema/types/Plotter.js | 1 + server/src/schema/types/Prize.js | 6 ++-- server/src/schema/types/Rule.js | 1 + .../src/schema/types/input/AdditionalPrize.js | 18 ++++++++++++ server/src/schema/types/input/Event.js | 29 +++++++++++++++++++ server/src/schema/types/input/Formula.js | 15 ++++++++++ server/src/schema/types/input/Participant.js | 17 +++++++++++ server/src/schema/types/input/Plotter.js | 18 ++++++++++++ server/src/schema/types/input/Prize.js | 21 ++++++++++++++ server/src/schema/types/input/Rule.js | 18 ++++++++++++ server/src/schema/types/input/index.js | 17 +++++++++++ 15 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 server/src/schema/types/input/AdditionalPrize.js create mode 100644 server/src/schema/types/input/Event.js create mode 100644 server/src/schema/types/input/Formula.js create mode 100644 server/src/schema/types/input/Participant.js create mode 100644 server/src/schema/types/input/Plotter.js create mode 100644 server/src/schema/types/input/Prize.js create mode 100644 server/src/schema/types/input/Rule.js create mode 100644 server/src/schema/types/input/index.js diff --git a/server/src/schema/types/AdditionalPrize.js b/server/src/schema/types/AdditionalPrize.js index ee3a791ff..1c888b687 100644 --- a/server/src/schema/types/AdditionalPrize.js +++ b/server/src/schema/types/AdditionalPrize.js @@ -1,15 +1,17 @@ import { GraphQLObjectType, + GraphQLNonNull, GraphQLString, GraphQLInt, } from 'graphql'; const AdditionalPrizeType = new GraphQLObjectType({ - name: 'OtherPrize', + name: 'AdditionalPrize', + description: 'Non algo complementary prize', fields: () => ({ condition: { type: GraphQLString }, - amount: { type: GraphQLInt }, - asset: { type: GraphQLString }, + amount: { type: new GraphQLNonNull(GraphQLInt) }, + asset: { type: new GraphQLNonNull(GraphQLString) }, }), }); diff --git a/server/src/schema/types/Event.js b/server/src/schema/types/Event.js index 7917e3032..ec0bf6c2b 100644 --- a/server/src/schema/types/Event.js +++ b/server/src/schema/types/Event.js @@ -15,6 +15,7 @@ import { const EventType = new GraphQLObjectType({ name: 'Event', + description: 'Everything you need to know about an event', fields: () => ({ designator: { type: GraphQLID }, name: { type: GraphQLString }, diff --git a/server/src/schema/types/Formula.js b/server/src/schema/types/Formula.js index f5d312327..934cbcd60 100644 --- a/server/src/schema/types/Formula.js +++ b/server/src/schema/types/Formula.js @@ -6,6 +6,7 @@ import { const FormulaType = new GraphQLObjectType({ name: 'Formula', + description: 'For now it\'s simplay a named field', fields: () => ({ id: { type: GraphQLString }, ownerId: { type: GraphQLString }, diff --git a/server/src/schema/types/Participant.js b/server/src/schema/types/Participant.js index f3afb7745..28c2833df 100644 --- a/server/src/schema/types/Participant.js +++ b/server/src/schema/types/Participant.js @@ -5,6 +5,7 @@ import { const ParticipantType = new GraphQLObjectType({ name: 'Participant', + description: 'Informations about the participant of an event', fields: () => ({ teamId: { type: GraphQLString }, botId: { type: GraphQLString }, diff --git a/server/src/schema/types/Plotter.js b/server/src/schema/types/Plotter.js index 9e86390a5..798d197af 100644 --- a/server/src/schema/types/Plotter.js +++ b/server/src/schema/types/Plotter.js @@ -6,6 +6,7 @@ import { const PlotterType = new GraphQLObjectType({ name: 'Plotter', + description: 'Will soon change in order to use contained plotter objects', fields: () => ({ id: { type: GraphQLString }, ownerId: { type: GraphQLString }, diff --git a/server/src/schema/types/Prize.js b/server/src/schema/types/Prize.js index 4b2fc8aba..7a81a702a 100644 --- a/server/src/schema/types/Prize.js +++ b/server/src/schema/types/Prize.js @@ -2,14 +2,16 @@ import { GraphQLObjectType, GraphQLList, GraphQLInt, + GraphQLNonNull, } from 'graphql'; import { AdditionalPrizeType } from './index'; const PrizeType = new GraphQLObjectType({ name: 'Prize', + description: 'Prize, by default in algos', fields: () => ({ - rank: { type: GraphQLInt }, - amount: { type: GraphQLInt }, + rank: { type: new GraphQLNonNull(GraphQLInt) }, + amount: { type: new GraphQLNonNull(GraphQLInt) }, additional: { type: new GraphQLList(AdditionalPrizeType), resolve(parent) { diff --git a/server/src/schema/types/Rule.js b/server/src/schema/types/Rule.js index e39a877fc..46358242d 100644 --- a/server/src/schema/types/Rule.js +++ b/server/src/schema/types/Rule.js @@ -6,6 +6,7 @@ import { const RuleType = new GraphQLObjectType({ name: 'Rule', + description: 'Textual rules of an event', fields: () => ({ position: { type: GraphQLInt }, title: { type: GraphQLString }, diff --git a/server/src/schema/types/input/AdditionalPrize.js b/server/src/schema/types/input/AdditionalPrize.js new file mode 100644 index 000000000..0fe28c2f0 --- /dev/null +++ b/server/src/schema/types/input/AdditionalPrize.js @@ -0,0 +1,18 @@ +import { + GraphQLInputObjectType, + GraphQLNonNull, + GraphQLString, + GraphQLInt, +} from 'graphql'; + +const Type = new GraphQLInputObjectType({ + name: 'AdditionalPrizeInput', + description: 'Payload for formula input', + fields: () => ({ + condition: { type: GraphQLString }, + amount: { type: new GraphQLNonNull(GraphQLInt) }, + asset: { type: new GraphQLNonNull(GraphQLString) }, + }), +}); + +export default Type; diff --git a/server/src/schema/types/input/Event.js b/server/src/schema/types/input/Event.js new file mode 100644 index 000000000..54c8e0865 --- /dev/null +++ b/server/src/schema/types/input/Event.js @@ -0,0 +1,29 @@ +import { + GraphQLString, + GraphQLInt, + GraphQLInputObjectType, + GraphQLList, +} from 'graphql'; +import InputFormulaType from './Formula'; +import InputPlotterType from './Plotter'; +import InputPrizeType from './Prize'; +import InputParticipantType from './Participant'; + +const Type = new GraphQLInputObjectType({ + name: 'EventInput', + description: 'Payload for event input', + fields: () => ({ + name: { type: GraphQLString }, + description: { type: GraphQLString }, + startDatetime: { type: GraphQLInt }, + finishDatetime: { type: GraphQLInt }, + formulaId: { type: GraphQLString }, + formula: { type: InputFormulaType }, + plotterId: { type: GraphQLString }, + plotter: { type: InputPlotterType }, + prizes: { type: new GraphQLList(InputPrizeType) }, + participants: { type: new GraphQLList(InputParticipantType) }, + }), +}); + +export default Type; diff --git a/server/src/schema/types/input/Formula.js b/server/src/schema/types/input/Formula.js new file mode 100644 index 000000000..bd9d070f1 --- /dev/null +++ b/server/src/schema/types/input/Formula.js @@ -0,0 +1,15 @@ +import { + GraphQLNonNull, + GraphQLString, + GraphQLInputObjectType, +} from 'graphql'; + +const Type = new GraphQLInputObjectType({ + name: 'FormulaInput', + description: 'Payload for formula input', + fields: () => ({ + name: { type: new GraphQLNonNull(GraphQLString) }, + }), +}); + +export default Type; diff --git a/server/src/schema/types/input/Participant.js b/server/src/schema/types/input/Participant.js new file mode 100644 index 000000000..c3853df83 --- /dev/null +++ b/server/src/schema/types/input/Participant.js @@ -0,0 +1,17 @@ +import { + GraphQLInputObjectType, + GraphQLString, + GraphQLNonNull, +} from 'graphql'; + +const Type = new GraphQLInputObjectType({ + name: 'ParticipantInput', + description: 'Payload for formula input', + fields: () => ({ + teamId: { type: new GraphQLNonNull(GraphQLString) }, + botId: { type: GraphQLString }, + releaseId: { type: GraphQLString }, + }), +}); + +export default Type; diff --git a/server/src/schema/types/input/Plotter.js b/server/src/schema/types/input/Plotter.js new file mode 100644 index 000000000..1368aecf9 --- /dev/null +++ b/server/src/schema/types/input/Plotter.js @@ -0,0 +1,18 @@ +import { + GraphQLNonNull, + GraphQLString, + GraphQLInputObjectType, +} from 'graphql'; + +const Type = new GraphQLInputObjectType({ + name: 'PlotterInput', + description: 'Payload for plotter input', + fields: () => ({ + name: { type: new GraphQLNonNull(GraphQLString) }, + host: { type: GraphQLString }, + repo: { type: GraphQLString }, + moduleName: { type: GraphQLString }, + }), +}); + +export default Type; diff --git a/server/src/schema/types/input/Prize.js b/server/src/schema/types/input/Prize.js new file mode 100644 index 000000000..5be06f0f2 --- /dev/null +++ b/server/src/schema/types/input/Prize.js @@ -0,0 +1,21 @@ +import { + GraphQLInputObjectType, + GraphQLList, + GraphQLInt, + GraphQLNonNull, +} from 'graphql'; +import InputAdditionalPrizeType from './AdditionalPrize'; + +const Type = new GraphQLInputObjectType({ + name: 'PrizeInput', + description: 'Payload for formula input', + fields: () => ({ + rank: { type: new GraphQLNonNull(GraphQLInt) }, + amount: { type: new GraphQLNonNull(GraphQLInt) }, + additional: { + type: new GraphQLList(InputAdditionalPrizeType), + }, + }), +}); + +export default Type; diff --git a/server/src/schema/types/input/Rule.js b/server/src/schema/types/input/Rule.js new file mode 100644 index 000000000..220b99412 --- /dev/null +++ b/server/src/schema/types/input/Rule.js @@ -0,0 +1,18 @@ +import { + GraphQLNonNull, + GraphQLString, + GraphQLInt, + GraphQLInputObjectType, +} from 'graphql'; + +const Type = new GraphQLInputObjectType({ + name: 'RuleInput', + description: 'Payload for rule input', + fields: () => ({ + position: { type: GraphQLInt }, + title: { type: new GraphQLNonNull(GraphQLString) }, + description: { type: GraphQLString }, + }), +}); + +export default Type; diff --git a/server/src/schema/types/input/index.js b/server/src/schema/types/input/index.js new file mode 100644 index 000000000..5bab6702a --- /dev/null +++ b/server/src/schema/types/input/index.js @@ -0,0 +1,17 @@ +import PlotterInputType from './Plotter'; +import RuleInputType from './Rule'; +import PrizeInputType from './Prize'; +import FormulaInputType from './Formula'; +import EventInputType from './Event'; +import AdditionalPrizeInputType from './AdditionalPrize'; +import ParticipantInputType from './Participant'; + +export { + PlotterInputType, + RuleInputType, + PrizeInputType, + FormulaInputType, + EventInputType, + AdditionalPrizeInputType, + ParticipantInputType, +}; From 3a46009042be2165e457975ba0c20cfb82dcf9a9 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Sat, 3 Nov 2018 16:31:11 +0100 Subject: [PATCH 07/33] Saving formulaId as formulaIf instead of Formula in the Db same for the plotters --- server/src/models/event.js | 16 ++++++++++------ server/src/schema/types/Event.js | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/src/models/event.js b/server/src/models/event.js index 7c28d7dfc..7f1b430b4 100644 --- a/server/src/models/event.js +++ b/server/src/models/event.js @@ -26,7 +26,9 @@ const eventSchema = new Schema({ type: String, required: true, }, - description: String, + description: { + type: String, + }, startDatetime: { type: Number, required: true, @@ -35,11 +37,11 @@ const eventSchema = new Schema({ type: Number, required: true, }, - formula: { + formulaId: { type: ObjectId, ref: Formula.modelName, }, - plotter: { + plotterId: { type: ObjectId, ref: Plotter.modelName, }, @@ -52,7 +54,9 @@ const eventSchema = new Schema({ type: String, required: true, }, - description: String, + description: { + type: String, + }, }], prizes: [{ rank: { @@ -86,10 +90,10 @@ const eventSchema = new Schema({ }); eventSchema.pre('find', function populate() { - this.populate('formula').populate('plotter'); + this.populate('formulaId').populate('plotterId'); }); eventSchema.post('save', (doc, next) => { - doc.populate('formula').populate('plotter').execPopulate().then(() => { + doc.populate('formulaId').populate('plotterId').execPopulate().then(() => { next(); }); }); diff --git a/server/src/schema/types/Event.js b/server/src/schema/types/Event.js index ec0bf6c2b..d54ecf377 100644 --- a/server/src/schema/types/Event.js +++ b/server/src/schema/types/Event.js @@ -26,13 +26,13 @@ const EventType = new GraphQLObjectType({ formula: { type: FormulaType, resolve(parent) { - return parent.formula; + return parent.formulaId; }, }, plotter: { type: PlotterType, resolve(parent) { - return parent.plotter; + return parent.plotterId; }, }, rules: { From 100119a75ba4a7d40aa3a42c20ae5215b146e6f2 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Sun, 4 Nov 2018 16:02:31 +0100 Subject: [PATCH 08/33] Adding Rules to Event input types --- server/src/schema/types/input/Event.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/schema/types/input/Event.js b/server/src/schema/types/input/Event.js index 54c8e0865..fba283123 100644 --- a/server/src/schema/types/input/Event.js +++ b/server/src/schema/types/input/Event.js @@ -8,6 +8,7 @@ import InputFormulaType from './Formula'; import InputPlotterType from './Plotter'; import InputPrizeType from './Prize'; import InputParticipantType from './Participant'; +import InputRuleType from './Rule'; const Type = new GraphQLInputObjectType({ name: 'EventInput', @@ -23,6 +24,7 @@ const Type = new GraphQLInputObjectType({ plotter: { type: InputPlotterType }, prizes: { type: new GraphQLList(InputPrizeType) }, participants: { type: new GraphQLList(InputParticipantType) }, + rules: { type: new GraphQLList(InputRuleType) }, }), }); From 73e1dbcdb8886779bcc9ec13814d3b688c4e8a01 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Sun, 4 Nov 2018 16:05:07 +0100 Subject: [PATCH 09/33] Removing userless mutation and adapting CreateEvent with new format --- server/src/schema/mutations/AddPrize.js | 62 ---------------- server/src/schema/mutations/AddRule.js | 70 ------------------- .../schema/mutations/CreateAndSetFormula.js | 56 --------------- .../schema/mutations/CreateAndSetPlotter.js | 65 ----------------- server/src/schema/mutations/CreateEvent.js | 65 +++++++++++++++++ server/src/schema/mutations/EditPrize.js | 56 --------------- server/src/schema/mutations/EditRule.js | 64 ----------------- server/src/schema/mutations/HostEvent.js | 52 -------------- server/src/schema/mutations/ReorderRules.js | 60 ---------------- server/src/schema/mutations/index.js | 18 +---- 10 files changed, 67 insertions(+), 501 deletions(-) delete mode 100644 server/src/schema/mutations/AddPrize.js delete mode 100644 server/src/schema/mutations/AddRule.js delete mode 100644 server/src/schema/mutations/CreateAndSetFormula.js delete mode 100644 server/src/schema/mutations/CreateAndSetPlotter.js create mode 100644 server/src/schema/mutations/CreateEvent.js delete mode 100644 server/src/schema/mutations/EditPrize.js delete mode 100644 server/src/schema/mutations/EditRule.js delete mode 100644 server/src/schema/mutations/HostEvent.js delete mode 100644 server/src/schema/mutations/ReorderRules.js diff --git a/server/src/schema/mutations/AddPrize.js b/server/src/schema/mutations/AddPrize.js deleted file mode 100644 index ff22e69ab..000000000 --- a/server/src/schema/mutations/AddPrize.js +++ /dev/null @@ -1,62 +0,0 @@ -import { - GraphQLNonNull, - GraphQLID, - GraphQLInt, -} from 'graphql'; -import { - AuthentificationError, - DatabaseError, - WrongArgumentsError, -} from '../../errors'; -import { EventType } from '../types'; -import { Event } from '../../models'; - -const args = { - eventDesignator: { type: new GraphQLNonNull(GraphQLID) }, - rank: { type: new GraphQLNonNull(GraphQLInt) }, - amount: { type: new GraphQLNonNull(GraphQLInt) }, -}; - -const resolve = (parent, { eventDesignator, rank, amount }, context) => { - const hostId = context.userId; - if (!hostId) { - throw new AuthentificationError(); - } - return new Promise((res, rej) => { - Event.findOne({ designator: eventDesignator, hostId }).exec((err, event) => { - if (err) { - rej(err); - return; - } - if (!event) { - rej(new DatabaseError('None of the events you own respond to that designator')); - return; - } - if (event.prizes.some(prize => prize.rank === rank)) { - rej(new WrongArgumentsError('A prize for that rank already exists')); - return; - } - event.prizes.push({ - rank, - amount, - }); - event.save((error) => { - if (error) { - rej(error); - return; - } - res(event); - }); - }); - }); -}; - -const mutation = { - addPrize: { - type: EventType, - args, - resolve, - }, -}; - -export default mutation; diff --git a/server/src/schema/mutations/AddRule.js b/server/src/schema/mutations/AddRule.js deleted file mode 100644 index c7b43cdb5..000000000 --- a/server/src/schema/mutations/AddRule.js +++ /dev/null @@ -1,70 +0,0 @@ -import { - GraphQLNonNull, - GraphQLID, - GraphQLString, -} from 'graphql'; -import { - AuthentificationError, - DatabaseError, - WrongArgumentsError, -} from '../../errors'; -import { EventType } from '../types'; -import { Event } from '../../models'; - -const args = { - eventDesignator: { type: new GraphQLNonNull(GraphQLID) }, - title: { type: new GraphQLNonNull(GraphQLString) }, - description: { type: new GraphQLNonNull(GraphQLString) }, -}; - -const resolve = (parent, { eventDesignator, title, description }, context) => { - const hostId = context.userId; - if (!hostId) { - throw new AuthentificationError(); - } - return new Promise((res, rej) => { - Event.findOne({ designator: eventDesignator, hostId }).exec((err, event) => { - if (err) { - rej(err); - return; - } - if (!event) { - rej(new DatabaseError('None of the events you own respond to that designator')); - return; - } - if (event.rules.some(rule => rule.title === title)) { - rej(new WrongArgumentsError('A prize for that rank already exists')); - return; - } - const isFree = pos => event.rules.some(rule => rule.pos === pos); - let position = 1; - let shouldGrow = isFree(position); - while (shouldGrow) { - position += 1; - shouldGrow = isFree(position); - } - event.rules.push({ - position, - title, - description, - }); - event.save((error) => { - if (error) { - rej(error); - return; - } - res(event); - }); - }); - }); -}; - -const mutation = { - addRule: { - type: EventType, - args, - resolve, - }, -}; - -export default mutation; diff --git a/server/src/schema/mutations/CreateAndSetFormula.js b/server/src/schema/mutations/CreateAndSetFormula.js deleted file mode 100644 index d1d45970f..000000000 --- a/server/src/schema/mutations/CreateAndSetFormula.js +++ /dev/null @@ -1,56 +0,0 @@ -import { - GraphQLNonNull, - GraphQLString, -} from 'graphql'; -import { AuthentificationError, DatabaseError } from '../../errors'; -import { EventType } from '../types'; -import { Event, Formula } from '../../models'; - -const args = { - eventDesignator: { type: new GraphQLNonNull(GraphQLString) }, - name: { type: new GraphQLNonNull(GraphQLString) }, -}; - -const resolve = (parent, { name, eventDesignator }, context) => { - const ownerId = context.userId; - if (!ownerId) { - throw new AuthentificationError(); - } - const newFormula = new Formula({ name, ownerId }); - return new Promise((res, reject) => { - Event.findOne({ designator: eventDesignator, hostId: ownerId }).exec((err, event) => { - if (err) { - reject(err); - return; - } - if (!event) { - reject(new DatabaseError('None of the events you own respond to that designator')); - return; - } - newFormula.save((error) => { - if (error) { - reject(error); - return; - } - event.formula = newFormula._id; - event.save((eventError) => { - if (eventError) { - reject(eventError); - return; - } - res(event); - }); - }); - }); - }); -}; - -const mutation = { - createAndSetFormula: { - type: EventType, - args, - resolve, - }, -}; - -export default mutation; diff --git a/server/src/schema/mutations/CreateAndSetPlotter.js b/server/src/schema/mutations/CreateAndSetPlotter.js deleted file mode 100644 index 11cbfe846..000000000 --- a/server/src/schema/mutations/CreateAndSetPlotter.js +++ /dev/null @@ -1,65 +0,0 @@ -import { - GraphQLNonNull, - GraphQLString, -} from 'graphql'; -import { AuthentificationError, DatabaseError } from '../../errors'; -import { EventType } from '../types'; -import { Event, Plotter } from '../../models'; - -const args = { - eventDesignator: { type: new GraphQLNonNull(GraphQLString) }, - name: { type: new GraphQLNonNull(GraphQLString) }, - host: { type: new GraphQLNonNull(GraphQLString) }, - repo: { type: new GraphQLNonNull(GraphQLString) }, - moduleName: { type: new GraphQLNonNull(GraphQLString) }, -}; - -const resolve = (parent, { - name, host, repo, moduleName, eventDesignator, -}, context) => { - const ownerId = context.userId; - if (!ownerId) { - throw new AuthentificationError(); - } - const newPlotter = new Plotter({ - name, host, repo, moduleName, ownerId, - }); - return new Promise((res, rej) => { - Event.findOne({ designator: eventDesignator, hostId: ownerId }).exec((err, event) => { - if (err) { - rej(err); - return; - } - if (!event) { - rej(new DatabaseError('None of the events you own respond to that designator')); - return; - } - - newPlotter.save((error) => { - if (error) { - rej(error); - return; - } - - event.plotter = newPlotter._id; - event.save((eventError) => { - if (eventError) { - rej(eventError); - return; - } - res(event); - }); - }); - }); - }); -}; - -const mutation = { - createAndSetPlotter: { - type: EventType, - args, - resolve, - }, -}; - -export default mutation; diff --git a/server/src/schema/mutations/CreateEvent.js b/server/src/schema/mutations/CreateEvent.js new file mode 100644 index 000000000..abb920a3f --- /dev/null +++ b/server/src/schema/mutations/CreateEvent.js @@ -0,0 +1,65 @@ +import { AuthentificationError } from '../../errors'; +import { EventType } from '../types'; +import { Event, Formula, Plotter } from '../../models'; +import { slugify } from '../../utils/functions'; +import { EventInputType } from '../types/input'; + +export const args = { + event: { type: EventInputType }, +}; + +const resolve = (parent, { event }, context) => { + const hostId = context.userId; + if (!hostId) { + throw new AuthentificationError(); + } + + const eventSqueleton = { ...event }; + delete eventSqueleton.plotter; + delete eventSqueleton.formula; + eventSqueleton.hostId = hostId; + + const newEvent = new Event(eventSqueleton); + newEvent.designator = `${slugify(newEvent.name)}-${newEvent._id}`; + const { formula, plotter } = event; + + return new Promise((res, rej) => { + if (formula) { + formula.ownerId = hostId; + const newFormula = new Formula(formula); + newFormula.save((err) => { + if (err) { + rej(err); + } + }); + newEvent.formulaId = newFormula._id; + } + if (plotter) { + plotter.ownerId = hostId; + const newPlotter = new Plotter(plotter); + newPlotter.save((err) => { + if (err) { + rej(err); + } + }); + newEvent.plotterId = newPlotter._id; + } + newEvent.save((err) => { + if (err) { + rej(err); + return; + } + res(newEvent); + }); + }); +}; + +const mutation = { + createEvent: { + type: EventType, + args, + resolve, + }, +}; + +export default mutation; diff --git a/server/src/schema/mutations/EditPrize.js b/server/src/schema/mutations/EditPrize.js deleted file mode 100644 index 279733d85..000000000 --- a/server/src/schema/mutations/EditPrize.js +++ /dev/null @@ -1,56 +0,0 @@ -import { - GraphQLNonNull, - GraphQLID, - GraphQLInt, -} from 'graphql'; -import { AuthentificationError, DatabaseError } from '../../errors'; -import { EventType } from '../types'; -import { Event } from '../../models'; - -const args = { - eventDesignator: { type: new GraphQLNonNull(GraphQLID) }, - rank: { type: new GraphQLNonNull(GraphQLInt) }, - amount: { type: GraphQLInt }, -}; - -const resolve = (parent, { eventDesignator, rank, amount }, context) => { - const hostId = context.userId; - if (!hostId) { - throw new AuthentificationError(); - } - return new Promise((res, rej) => { - Event.findOne({ designator: eventDesignator, hostId }).exec((err, event) => { - if (err) { - rej(err); - return; - } - if (!event) { - rej(new DatabaseError('None of the events you own respond to that designator')); - return; - } - const prizeIndex = event.prizes.findIndex(prize => prize.rank === rank); - if (!prizeIndex) { - rej(new DatabaseError('There is no prize for that index')); - return; - } - event.prizes[prizeIndex].amount = amount || event.prizes[prizeIndex].amount; - event.save((error) => { - if (error) { - rej(error); - return; - } - res(event); - }); - }); - }); -}; - -const mutation = { - editPrize: { - type: EventType, - args, - resolve, - }, -}; - -export default mutation; diff --git a/server/src/schema/mutations/EditRule.js b/server/src/schema/mutations/EditRule.js deleted file mode 100644 index c931151ce..000000000 --- a/server/src/schema/mutations/EditRule.js +++ /dev/null @@ -1,64 +0,0 @@ -import { - GraphQLNonNull, - GraphQLID, - GraphQLString, -} from 'graphql'; -import { AuthentificationError, DatabaseError, WrongArgumentsError } from '../../errors'; -import { EventType } from '../types'; -import { Event } from '../../models'; - -const args = { - eventDesignator: { type: new GraphQLNonNull(GraphQLID) }, - title: { type: new GraphQLNonNull(GraphQLString) }, - newtitle: { type: GraphQLString }, - description: { type: GraphQLString }, -}; - -const resolve = (parent, { - eventDesignator, title, newtitle, description, -}, context) => { - const hostId = context.userId; - if (!hostId) { - throw new AuthentificationError(); - } - return new Promise((res, rej) => { - Event.findOne({ designator: eventDesignator, hostId }).exec((err, event) => { - if (err) { - rej(err); - return; - } - if (!event) { - rej(new DatabaseError('None of the events you own respond to that designator')); - return; - } - const ruleIndex = event.rules.findIndex(rule => rule.title === title); - if (!ruleIndex) { - rej(new DatabaseError('There is no rule with that title')); - return; - } - event.rules[ruleIndex].description = description || event.rules[ruleIndex].description; - if (event.rules.some(rule => rule.title === newtitle)) { - rej(new WrongArgumentsError('There is already a rule using your new title')); - return; - } - event.rules[ruleIndex].title = newtitle || event.rules[ruleIndex].title; - event.save((error) => { - if (error) { - rej(error); - return; - } - res(event); - }); - }); - }); -}; - -const mutation = { - editRule: { - type: EventType, - args, - resolve, - }, -}; - -export default mutation; diff --git a/server/src/schema/mutations/HostEvent.js b/server/src/schema/mutations/HostEvent.js deleted file mode 100644 index 13fd6b494..000000000 --- a/server/src/schema/mutations/HostEvent.js +++ /dev/null @@ -1,52 +0,0 @@ -import { - GraphQLNonNull, - GraphQLInt, - GraphQLString, -} from 'graphql'; -import { AuthentificationError } from '../../errors'; -import { EventType } from '../types'; -import { Event } from '../../models'; -import { slugify } from '../../utils/functions'; - -const args = { - name: { type: new GraphQLNonNull(GraphQLString) }, - description: { type: new GraphQLNonNull(GraphQLString) }, - startDatetime: { type: new GraphQLNonNull(GraphQLInt) }, - finishDatetime: { type: new GraphQLNonNull(GraphQLInt) }, -}; - -const resolve = (parent, { - name, description, startDatetime, finishDatetime, -}, context) => { - const hostId = context.userId; - if (!hostId) { - throw new AuthentificationError(); - } - const newEvent = new Event({ - hostId, - name, - description, - startDatetime, - finishDatetime, - }); - newEvent.designator = `${slugify(newEvent.name)}-${newEvent._id}`; - return new Promise((res, rej) => { - newEvent.save((err) => { - if (err) { - rej(err); - return; - } - res(newEvent); - }); - }); -}; - -const mutation = { - hostEvent: { - type: EventType, - args, - resolve, - }, -}; - -export default mutation; diff --git a/server/src/schema/mutations/ReorderRules.js b/server/src/schema/mutations/ReorderRules.js deleted file mode 100644 index 8f16546aa..000000000 --- a/server/src/schema/mutations/ReorderRules.js +++ /dev/null @@ -1,60 +0,0 @@ -import { - GraphQLNonNull, - GraphQLID, - GraphQLInt, -} from 'graphql'; -import { AuthentificationError, DatabaseError } from '../../errors'; -import { isBetween } from '../../utils/functions'; -import { EventType } from '../types'; -import { Event } from '../../models'; - -const args = { - eventDesignator: { type: new GraphQLNonNull(GraphQLID) }, - fromPosition: { type: new GraphQLNonNull(GraphQLInt) }, - toPosition: { type: new GraphQLNonNull(GraphQLInt) }, -}; - -const resolve = (parent, { eventDesignator, fromPosition, toPosition }, context) => { - const hostId = context.userId; - if (!hostId) { - throw new AuthentificationError(); - } - return new Promise((res, rej) => { - Event.findOne({ designator: eventDesignator, hostId: context.userId }).exec((err, event) => { - if (err) { - rej(err); - return; - } - if (!event) { - rej(new DatabaseError('None of the events you own respond to that designator')); - return; - } - const delta = fromPosition > toPosition ? 1 : -1; - event.rules.forEach((part) => { - if (part.position === fromPosition) { - part.position = toPosition; - } else if (isBetween(part.position, fromPosition, toPosition)) { - part.position += delta; - } - }); - - event.save((error) => { - if (error) { - rej(error); - return; - } - res(event); - }); - }); - }); -}; - -const mutation = { - reorderRules: { - type: EventType, - args, - resolve, - }, -}; - -export default mutation; diff --git a/server/src/schema/mutations/index.js b/server/src/schema/mutations/index.js index ffefe7dcf..1f621f13e 100644 --- a/server/src/schema/mutations/index.js +++ b/server/src/schema/mutations/index.js @@ -2,36 +2,22 @@ import { GraphQLObjectType, } from 'graphql'; -import HostEventMutation from './HostEvent'; +import CreateEventMutation from './CreateEvent'; import EditEventMutation from './EditEvent'; import RegisterToEventMutation from './RegisterToEvent'; import EditParticipantMutation from './EditParticipant'; -import AddRuleMutation from './AddRule'; -import EditRuleMutation from './EditRule'; -import ReorderRulesMutation from './ReorderRules'; -import AddPrizeMutation from './AddPrize'; -import EditPrizeMutation from './EditPrize'; import CreateFormulaMutation from './CreateFormula'; -import CreateAndSetFormulaMutation from './CreateAndSetFormula'; import CreatePlotterMutation from './CreatePlotter'; -import CreateAndSetPlotterMutation from './CreateAndSetPlotter'; const Mutation = new GraphQLObjectType({ name: 'Mutation', fields: Object.assign( - HostEventMutation, + CreateEventMutation, EditEventMutation, RegisterToEventMutation, EditParticipantMutation, - AddRuleMutation, - EditRuleMutation, - ReorderRulesMutation, - AddPrizeMutation, - EditPrizeMutation, CreateFormulaMutation, - CreateAndSetFormulaMutation, CreatePlotterMutation, - CreateAndSetPlotterMutation, ), }); From 91b1a9959818379d104bd9daa966c746fb3360dd Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Sun, 4 Nov 2018 16:37:05 +0100 Subject: [PATCH 10/33] Stop using soon to be deprecated function --- server/src/db.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/db.js b/server/src/db.js index 4492e884f..fb87523ca 100644 --- a/server/src/db.js +++ b/server/src/db.js @@ -2,6 +2,7 @@ import 'dotenv/config'; import mongoose from 'mongoose'; mongoose.connect(`mongodb://${process.env.DB_USERNAME}:${process.env.DB_PASSWORD}@${process.env.DB_DOMAIN}`, { useNewUrlParser: true }); +mongoose.set('useCreateIndex', true); mongoose.Promise = global.Promise; const db = mongoose.connection; From 189a8f1d8441d8f4371d1089b504d2666c664cc1 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Mon, 5 Nov 2018 15:27:04 +0100 Subject: [PATCH 11/33] Master refactoring, remove designator field --- server/src/db.js | 1 + server/src/models/event.js | 9 ++-- server/src/schema/mutations/CreateEvent.js | 36 ++-------------- server/src/schema/mutations/CreateFormula.js | 15 ++++--- server/src/schema/mutations/CreatePlotter.js | 22 ++++------ server/src/schema/mutations/EditEvent.js | 41 ++++--------------- .../src/schema/mutations/EditParticipant.js | 25 +++++------ .../src/schema/mutations/RegisterToEvent.js | 23 ++++------- server/src/schema/queries/Event.js | 8 ++-- server/src/schema/types/Event.js | 2 +- server/src/schema/types/input/Event.js | 4 -- 11 files changed, 56 insertions(+), 130 deletions(-) diff --git a/server/src/db.js b/server/src/db.js index fb87523ca..4ed47a0c2 100644 --- a/server/src/db.js +++ b/server/src/db.js @@ -3,6 +3,7 @@ import mongoose from 'mongoose'; mongoose.connect(`mongodb://${process.env.DB_USERNAME}:${process.env.DB_PASSWORD}@${process.env.DB_DOMAIN}`, { useNewUrlParser: true }); mongoose.set('useCreateIndex', true); +mongoose.set('useFindAndModify', false); mongoose.Promise = global.Promise; const db = mongoose.connection; diff --git a/server/src/models/event.js b/server/src/models/event.js index 7f1b430b4..87d495ccd 100644 --- a/server/src/models/event.js +++ b/server/src/models/event.js @@ -9,10 +9,6 @@ import { const { ObjectId } = Schema.Types; const eventSchema = new Schema({ - designator: { - type: String, - required: true, - }, status: { type: String, enum: EventStatusEnum, @@ -97,6 +93,11 @@ eventSchema.post('save', (doc, next) => { next(); }); }); +eventSchema.post('findOneAndUpdate', (doc, next) => { + doc.populate('formulaId').populate('plotterId').execPopulate().then(() => { + next(); + }); +}); const Event = mongoose.model('Event', eventSchema); diff --git a/server/src/schema/mutations/CreateEvent.js b/server/src/schema/mutations/CreateEvent.js index abb920a3f..2704f53e7 100644 --- a/server/src/schema/mutations/CreateEvent.js +++ b/server/src/schema/mutations/CreateEvent.js @@ -1,49 +1,21 @@ import { AuthentificationError } from '../../errors'; import { EventType } from '../types'; -import { Event, Formula, Plotter } from '../../models'; -import { slugify } from '../../utils/functions'; +import { Event } from '../../models'; import { EventInputType } from '../types/input'; export const args = { event: { type: EventInputType }, }; -const resolve = (parent, { event }, context) => { - const hostId = context.userId; +const resolve = (parent, { event }, { userId: hostId }) => { if (!hostId) { throw new AuthentificationError(); } - const eventSqueleton = { ...event }; - delete eventSqueleton.plotter; - delete eventSqueleton.formula; - eventSqueleton.hostId = hostId; - - const newEvent = new Event(eventSqueleton); - newEvent.designator = `${slugify(newEvent.name)}-${newEvent._id}`; - const { formula, plotter } = event; + event.hostId = hostId; + const newEvent = new Event(event); return new Promise((res, rej) => { - if (formula) { - formula.ownerId = hostId; - const newFormula = new Formula(formula); - newFormula.save((err) => { - if (err) { - rej(err); - } - }); - newEvent.formulaId = newFormula._id; - } - if (plotter) { - plotter.ownerId = hostId; - const newPlotter = new Plotter(plotter); - newPlotter.save((err) => { - if (err) { - rej(err); - } - }); - newEvent.plotterId = newPlotter._id; - } newEvent.save((err) => { if (err) { rej(err); diff --git a/server/src/schema/mutations/CreateFormula.js b/server/src/schema/mutations/CreateFormula.js index 4ff97b8c1..198c1fd0e 100644 --- a/server/src/schema/mutations/CreateFormula.js +++ b/server/src/schema/mutations/CreateFormula.js @@ -1,21 +1,20 @@ -import { - GraphQLNonNull, - GraphQLString, -} from 'graphql'; import { AuthentificationError } from '../../errors'; import { FormulaType } from '../types'; import { Formula } from '../../models'; +import { FormulaInputType } from '../types/input'; const args = { - name: { type: new GraphQLNonNull(GraphQLString) }, + formula: { type: FormulaInputType }, }; -const resolve = (parent, { name }, context) => { - const ownerId = context.userId; +const resolve = (parent, { formula }, { userId: ownerId }) => { if (!ownerId) { throw new AuthentificationError(); } - const newFormula = new Formula({ name, ownerId }); + + formula.ownerId = ownerId; + const newFormula = new Formula(formula); + return new Promise((res, rej) => { newFormula.save((err) => { if (err) { diff --git a/server/src/schema/mutations/CreatePlotter.js b/server/src/schema/mutations/CreatePlotter.js index a4fcdf26a..6cf060fbf 100644 --- a/server/src/schema/mutations/CreatePlotter.js +++ b/server/src/schema/mutations/CreatePlotter.js @@ -1,28 +1,20 @@ -import { - GraphQLNonNull, - GraphQLString, -} from 'graphql'; import { AuthentificationError } from '../../errors'; import { PlotterType } from '../types'; import { Plotter } from '../../models'; +import { PlotterInputType } from '../types/input'; const args = { - name: { type: new GraphQLNonNull(GraphQLString) }, - host: { type: new GraphQLNonNull(GraphQLString) }, - repo: { type: new GraphQLNonNull(GraphQLString) }, - moduleName: { type: new GraphQLNonNull(GraphQLString) }, + plotter: { type: PlotterInputType }, }; -const resolve = (parent, { - name, host, repo, moduleName, -}, context) => { - const ownerId = context.userId; +const resolve = (parent, { plotter }, { userId: ownerId }) => { if (!ownerId) { throw new AuthentificationError(); } - const newPlotter = new Plotter({ - name, host, repo, moduleName, ownerId, - }); + + plotter.ownerId = ownerId; + const newPlotter = new Plotter(plotter); + return new Promise((res, reject) => { newPlotter.save((err) => { if (err) { diff --git a/server/src/schema/mutations/EditEvent.js b/server/src/schema/mutations/EditEvent.js index e60cf6cbd..093376207 100644 --- a/server/src/schema/mutations/EditEvent.js +++ b/server/src/schema/mutations/EditEvent.js @@ -1,54 +1,29 @@ import { GraphQLNonNull, GraphQLID, - GraphQLInt, - GraphQLString, } from 'graphql'; -import { AuthentificationError, DatabaseError } from '../../errors'; +import { AuthentificationError } from '../../errors'; import { EventType } from '../types'; import { Event } from '../../models'; +import { EventInputType } from '../types/input'; const args = { - designator: { type: new GraphQLNonNull(GraphQLID) }, - name: { type: GraphQLString }, - description: { type: GraphQLString }, - startDatetime: { type: GraphQLInt }, - finishDatetime: { type: GraphQLInt }, - formulaId: { type: GraphQLString }, - plotterId: { type: GraphQLString }, + eventId: { type: new GraphQLNonNull(GraphQLID) }, + event: { type: EventInputType }, }; -const resolve = (parent, { - designator, name, description, startDatetime, finishDatetime, formulaId, plotterId, -}, context) => { - const hostId = context.userId; +const resolve = (parent, { eventId: _id, event }, { userId: hostId }) => { if (!hostId) { throw new AuthentificationError(); } + return new Promise((res, rej) => { - Event.findOne({ designator, hostId }).exec((err, event) => { + Event.findOneAndUpdate({ _id, hostId }, event, { new: true }, (err, modifiedEvent) => { if (err) { rej(err); return; } - if (!event) { - rej(new DatabaseError('None of the events you own respond to that designator')); - return; - } - event.name = name || event.name; - event.description = description || event.description; - event.startDatetime = startDatetime || event.startDatetime; - event.finishDatetime = finishDatetime || event.finishDatetime; - event.formula = formulaId || event.formula; - event.plotter = plotterId || event.plotter; - - event.save((error) => { - if (error) { - rej(error); - return; - } - res(event); - }); + res(modifiedEvent); }); }); }; diff --git a/server/src/schema/mutations/EditParticipant.js b/server/src/schema/mutations/EditParticipant.js index fde3145da..a241f34b4 100644 --- a/server/src/schema/mutations/EditParticipant.js +++ b/server/src/schema/mutations/EditParticipant.js @@ -1,7 +1,6 @@ import { GraphQLNonNull, GraphQLID, - GraphQLString, } from 'graphql'; import axios from 'axios'; import { @@ -11,19 +10,17 @@ import { } from '../../errors'; import { EventType } from '../types'; import { Event } from '../../models'; +import { ParticipantInputType } from '../types/input'; const args = { - eventDesignator: { type: new GraphQLNonNull(GraphQLID) }, - teamId: { type: new GraphQLNonNull(GraphQLString) }, - botId: { type: GraphQLString }, - releaseId: { type: GraphQLString }, + eventId: { type: new GraphQLNonNull(GraphQLID) }, + participant: { type: ParticipantInputType }, }; -const resolve = (parent, { - eventDesignator, teamId, botId, releaseId, -}, context) => { - const userid = context.userId; - if (!userid) { +const resolve = (parent, + { eventId: _id, participant: { teamId, botId, releaseId } }, + { userId, authorization }) => { + if (!userId) { throw new AuthentificationError(); } return new Promise((res, rej) => { @@ -39,16 +36,14 @@ const resolve = (parent, { } `, }, - headers: { - authorization: context.authorization, - }, + headers: { authorization }, }).then( (result) => { if (!result.data.data.teamsByRole.some(team => team.id === teamId)) { - rej(new WrongArgumentsError('You are not eligible to register this team')); + rej(new WrongArgumentsError('You are not eligible to edit this team')); return; } - Event.findOne({ designator: eventDesignator }).exec((err, event) => { + Event.findOne({ _id }).exec((err, event) => { if (err) { rej(err); return; diff --git a/server/src/schema/mutations/RegisterToEvent.js b/server/src/schema/mutations/RegisterToEvent.js index a3443c4de..445e26628 100644 --- a/server/src/schema/mutations/RegisterToEvent.js +++ b/server/src/schema/mutations/RegisterToEvent.js @@ -2,7 +2,6 @@ import 'dotenv/config'; import { GraphQLNonNull, GraphQLID, - GraphQLString, } from 'graphql'; import axios from 'axios'; import { @@ -12,19 +11,17 @@ import { } from '../../errors'; import { EventType } from '../types'; import { Event } from '../../models'; +import { ParticipantInputType } from '../types/input'; const args = { - designator: { type: new GraphQLNonNull(GraphQLID) }, - teamId: { type: new GraphQLNonNull(GraphQLString) }, - botId: { type: GraphQLString }, - releaseId: { type: GraphQLString }, + eventId: { type: new GraphQLNonNull(GraphQLID) }, + participant: { type: ParticipantInputType }, }; -const resolve = (parent, { - designator, teamId, botId, releaseId, -}, context) => { - const userid = context.userId; - if (!userid) { +const resolve = (parent, + { eventId: _id, participant: { teamId, botId, releaseId } }, + { userId, authorization }) => { + if (!userId) { throw new AuthentificationError(); } return new Promise((res, rej) => { @@ -40,16 +37,14 @@ const resolve = (parent, { } `, }, - headers: { - authorization: context.authorization, - }, + headers: { authorization }, }).then( (result) => { if (!result.data.data.teamsByRole.some(team => team.id === teamId)) { rej(new WrongArgumentsError('You are not eligible to register this team')); return; } - Event.findOne({ designator }).exec((err, event) => { + Event.findOne({ _id }).exec((err, event) => { if (err) { rej(err); return; diff --git a/server/src/schema/queries/Event.js b/server/src/schema/queries/Event.js index c35d48f47..590aac259 100644 --- a/server/src/schema/queries/Event.js +++ b/server/src/schema/queries/Event.js @@ -7,17 +7,17 @@ import { EventType } from '../types'; import { Event } from '../../models'; const args = { - designator: { type: new GraphQLNonNull(GraphQLID) }, + eventId: { type: new GraphQLNonNull(GraphQLID) }, }; -const resolve = (parent, { designator }) => new Promise((res, rej) => { - Event.findOne({ designator }).exec((err, event) => { +const resolve = (parent, { eventId: _id }) => new Promise((res, rej) => { + Event.findOne({ _id }).exec((err, event) => { if (err) { rej(err); return; } if (!event) { - rej(new DatabaseError('None of the events respond to that designator')); + rej(new DatabaseError('None of the events respond to that id')); return; } res(event); diff --git a/server/src/schema/types/Event.js b/server/src/schema/types/Event.js index d54ecf377..4cc843906 100644 --- a/server/src/schema/types/Event.js +++ b/server/src/schema/types/Event.js @@ -17,7 +17,7 @@ const EventType = new GraphQLObjectType({ name: 'Event', description: 'Everything you need to know about an event', fields: () => ({ - designator: { type: GraphQLID }, + id: { type: GraphQLID }, name: { type: GraphQLString }, hostId: { type: GraphQLString }, description: { type: GraphQLString }, diff --git a/server/src/schema/types/input/Event.js b/server/src/schema/types/input/Event.js index fba283123..23fd7c2c7 100644 --- a/server/src/schema/types/input/Event.js +++ b/server/src/schema/types/input/Event.js @@ -4,8 +4,6 @@ import { GraphQLInputObjectType, GraphQLList, } from 'graphql'; -import InputFormulaType from './Formula'; -import InputPlotterType from './Plotter'; import InputPrizeType from './Prize'; import InputParticipantType from './Participant'; import InputRuleType from './Rule'; @@ -19,9 +17,7 @@ const Type = new GraphQLInputObjectType({ startDatetime: { type: GraphQLInt }, finishDatetime: { type: GraphQLInt }, formulaId: { type: GraphQLString }, - formula: { type: InputFormulaType }, plotterId: { type: GraphQLString }, - plotter: { type: InputPlotterType }, prizes: { type: new GraphQLList(InputPrizeType) }, participants: { type: new GraphQLList(InputParticipantType) }, rules: { type: new GraphQLList(InputRuleType) }, From 43f08bc14b94f0da967d11e20f34acf38f21b5c0 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Mon, 5 Nov 2018 16:22:44 +0100 Subject: [PATCH 12/33] removing participants from event creation --- server/src/schema/types/input/Event.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/src/schema/types/input/Event.js b/server/src/schema/types/input/Event.js index 23fd7c2c7..eb34c274f 100644 --- a/server/src/schema/types/input/Event.js +++ b/server/src/schema/types/input/Event.js @@ -5,7 +5,6 @@ import { GraphQLList, } from 'graphql'; import InputPrizeType from './Prize'; -import InputParticipantType from './Participant'; import InputRuleType from './Rule'; const Type = new GraphQLInputObjectType({ @@ -19,7 +18,6 @@ const Type = new GraphQLInputObjectType({ formulaId: { type: GraphQLString }, plotterId: { type: GraphQLString }, prizes: { type: new GraphQLList(InputPrizeType) }, - participants: { type: new GraphQLList(InputParticipantType) }, rules: { type: new GraphQLList(InputRuleType) }, }), }); From 6dd6fac7e69690c4360af4d091bc9c95fb80d13a Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Mon, 5 Nov 2018 16:24:31 +0100 Subject: [PATCH 13/33] updating server's package-lock --- server/package-lock.json | 502 ++++++++++++++++++--------------------- 1 file changed, 237 insertions(+), 265 deletions(-) diff --git a/server/package-lock.json b/server/package-lock.json index f7ebb4cd8..c73da79d8 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -139,13 +139,6 @@ "requires": { "core-js": "^2.5.7", "regenerator-runtime": "^0.12.0" - }, - "dependencies": { - "regenerator-runtime": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", - "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==" - } } }, "@babel/template": { @@ -273,43 +266,43 @@ "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" }, "@sentry/core": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-4.1.1.tgz", - "integrity": "sha512-QJExTxZ1ZA5P/To5gOwd3sowukXW0N/Q9nfu8biRDNa+YURn6ElLjO0fD6eIBqX1f3npo/kTiWZwFBc7LXEzSg==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-4.2.4.tgz", + "integrity": "sha512-Oqn6dQduKBIJ8DNTyA6Hp5Nj3sOH/P0buT02wIv9InIHmxBVJ0zj/b4zRmOOuz77ikglOf5WL3cavdWF/2l2PA==", "requires": { - "@sentry/hub": "4.1.1", - "@sentry/minimal": "4.1.1", - "@sentry/types": "4.1.0", - "@sentry/utils": "4.1.1" + "@sentry/hub": "4.2.4", + "@sentry/minimal": "4.2.4", + "@sentry/types": "4.2.4", + "@sentry/utils": "4.2.4" } }, "@sentry/hub": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-4.1.1.tgz", - "integrity": "sha512-VmcZOgcbFjJzK1oQNwcFP/wgfoWQr24dFv1C0uwdXldNXx3mwyUVkomvklBHz90HwiahsI/gCc+ZmbC3ECQk2Q==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-4.2.4.tgz", + "integrity": "sha512-9X77HAGk/XT7k5OD4F+SUO3PIeLV1uMuzvGgw9cxxl/gSv70MO35bP6mJIVrA0U4NGtvmtYTTWsWB9moRCiE1g==", "requires": { - "@sentry/types": "4.1.0", - "@sentry/utils": "4.1.1" + "@sentry/types": "4.2.4", + "@sentry/utils": "4.2.4" } }, "@sentry/minimal": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-4.1.1.tgz", - "integrity": "sha512-xRKWA46OGnZinJyTljDUel53emPP9mb/XNi/kF6SBaVDOUXl7HAB8kP7Bn7eLBwOanxN8PbYoAzh/lIQXWTmDg==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-4.2.4.tgz", + "integrity": "sha512-IKzva0leEoP1ZOBh6NgIwqsvO2DM+GAKtCuNi0dfKYp1Qt6PLXHZQXaPim6kC0h/bKHe3+m/d4NXrpJdDrD7BQ==", "requires": { - "@sentry/hub": "4.1.1", - "@sentry/types": "4.1.0" + "@sentry/hub": "4.2.4", + "@sentry/types": "4.2.4" } }, "@sentry/node": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-4.1.1.tgz", - "integrity": "sha512-wbo8F2IqZW+exlOyQzQ7+bPNPXIYmG2g73ZgHFh0x3MHVOTSKgfiO3BzCqmFyUDhxqkEL23PQqLhM07GEtH3Bw==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-4.2.4.tgz", + "integrity": "sha512-82wPAOGqBhw1KvCkeeZXvCsWurOaZfEm3d7hfHXj5nnVbUr0Xb2HcRTNzBYPtMYXFZ9N0UNIn5nfGk7zmvpUuA==", "requires": { - "@sentry/core": "4.1.1", - "@sentry/hub": "4.1.1", - "@sentry/types": "4.1.0", - "@sentry/utils": "4.1.1", + "@sentry/core": "4.2.4", + "@sentry/hub": "4.2.4", + "@sentry/types": "4.2.4", + "@sentry/utils": "4.2.4", "cookie": "0.3.1", "lsmod": "1.0.0", "md5": "2.2.1", @@ -317,16 +310,16 @@ } }, "@sentry/types": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-4.1.0.tgz", - "integrity": "sha512-KY7B9wYs1NACHlYzG4OuP6k4uQJkyDPJppftjj3NJYShfwdDTO1I2Swkhhb5dJMEMMMpBJGxXmiqZ2mX5ErISQ==" + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-4.2.4.tgz", + "integrity": "sha512-oMtNVx1R4gMl2cECn8bNthSgEHBknES3yVZftyPbecOp3TwPb6MSbWdIWjxgVai1jXi9a/ZCuE/Zoypy33CBrA==" }, "@sentry/utils": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-4.1.1.tgz", - "integrity": "sha512-XMvGqAWATBrRkOF0lkt0Ij8of2mRmp4WeFTUAgiKzCekxfUBLBaTb4wTaFXz1cnnnjVTwcAq72qBRMhHwQ0IIg==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-4.2.4.tgz", + "integrity": "sha512-S8wZM6X642AhaUejhbYu1neU8IxtFhgc7JeVM5BmNivzXOW/hrTIDpDiDvYZLq1KhdSpH8+Z8WnntmGWhW4PFg==", "requires": { - "@sentry/types": "4.1.0" + "@sentry/types": "4.2.4" } }, "@types/accepts": { @@ -441,9 +434,9 @@ } }, "acorn": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.2.tgz", - "integrity": "sha512-GXmKIvbrN3TV7aVqAzVFaMW8F8wzVX7voEBRO3bDA64+EX37YSayggRJP5Xig6HYHBkWKpFg9W5gg6orklubhg==", + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz", + "integrity": "sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg==", "dev": true }, "acorn-jsx": { @@ -453,9 +446,9 @@ "dev": true }, "ajv": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", - "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.5.tgz", + "integrity": "sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -475,7 +468,7 @@ }, "ansi-escapes": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", "dev": true }, @@ -555,17 +548,6 @@ "integrity": "sha512-jBRnsTgXN0m8yVpumoelaUq9mXR7YpJ3EE+y/alI7zgXY+0qFDqksRApU8dEfg3q6qUnO7rFxRhdG5eyc0+1ig==", "requires": { "lru-cache": "^4.1.3" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", - "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - } } }, "apollo-server-core": { @@ -713,6 +695,14 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, + "async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "requires": { + "lodash": "^4.17.10" + } + }, "async-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", @@ -820,18 +810,6 @@ "@babel/types": "^7.0.0", "eslint-scope": "3.7.1", "eslint-visitor-keys": "^1.0.0" - }, - "dependencies": { - "eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - } } }, "babel-generator": { @@ -1502,6 +1480,14 @@ "requires": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + } } }, "babel-template": { @@ -1737,9 +1723,9 @@ } }, "bson": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.9.tgz", - "integrity": "sha512-IQX9/h7WdMBIW/q/++tGd+emQr0XMdeZ6icnT/74Xk9fnabWn+gZgpE+9V+gujL3hhJOoNrnDVY7tWdzc7NUTg==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz", + "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==" }, "builtin-modules": { "version": "1.1.1", @@ -1754,29 +1740,6 @@ "requires": { "dicer": "0.2.5", "readable-stream": "1.1.x" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } } }, "bytes": { @@ -1831,9 +1794,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30000892", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000892.tgz", - "integrity": "sha512-X9rxMaWZNbJB5qjkDqPtNv/yfViTeUL6ILk0QJNxLV3OhKC5Acn5vxsuUvllR6B48mog8lmS+whwHq/QIYSL9w==", + "version": "1.0.30000905", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000905.tgz", + "integrity": "sha512-cR6ICguvhRrkAjFfBoe54vJQMVOEz7vFmqrV6oor1a7GRg6DdswI40lkiV/QQvAMb4txzTkjSaLaJaiAtSuQzA==", "dev": true }, "capture-stack-trace": { @@ -2055,9 +2018,9 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cors": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", - "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", "requires": { "object-assign": "^4", "vary": "^1" @@ -2073,12 +2036,14 @@ } }, "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { - "lru-cache": "^4.0.1", + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } @@ -2194,14 +2159,6 @@ "pify": "^2.0.0", "pinkie-promise": "^2.0.0", "rimraf": "^2.2.8" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } } }, "depd": { @@ -2235,29 +2192,6 @@ "requires": { "readable-stream": "1.1.x", "streamsearch": "0.1.2" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - } } }, "doctrine": { @@ -2301,9 +2235,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "electron-to-chromium": { - "version": "1.3.79", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.79.tgz", - "integrity": "sha512-LQdY3j4PxuUl6xfxiFruTSlCniTrTrzAd8/HfsLEMi0PUpaQ0Iy+Pr4N4VllDYjs0Hyu2lkTbvzqlG+PX9NsNw==", + "version": "1.3.83", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.83.tgz", + "integrity": "sha512-DqJoDarxq50dcHsOOlMLNoy+qQitlMNbYb6wwbE0oUw2veHdRkpNrhmngiUYKMErdJ8SJ48rpJsZTQgy5SoEAA==", "dev": true }, "encodeurl": { @@ -2425,19 +2359,6 @@ "supports-color": "^5.3.0" } }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, "debug": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", @@ -2447,6 +2368,16 @@ "ms": "^2.1.1" } }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, "globals": { "version": "11.8.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", @@ -2537,6 +2468,12 @@ "esutils": "^2.0.2", "isarray": "^1.0.0" } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true } } }, @@ -2547,9 +2484,9 @@ "dev": true }, "eslint-scope": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", - "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -2654,6 +2591,19 @@ "p-finally": "^1.0.0", "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + } } }, "expand-brackets": { @@ -2711,6 +2661,13 @@ "type-is": "~1.6.16", "utils-merge": "1.0.1", "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } } }, "extend-shallow": { @@ -2835,6 +2792,13 @@ "parseurl": "~1.3.2", "statuses": "~1.4.0", "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } } }, "find-up": { @@ -3549,14 +3513,6 @@ "object-assign": "^4.0.1", "pify": "^2.0.0", "pinkie-promise": "^2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } } }, "got": { @@ -3579,9 +3535,9 @@ } }, "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", "dev": true }, "graphql": { @@ -4161,10 +4117,9 @@ "dev": true }, "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" }, "isexe": { "version": "2.0.0", @@ -4180,6 +4135,15 @@ "optional": true, "requires": { "isarray": "1.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true, + "optional": true + } } }, "iterall": { @@ -4270,14 +4234,6 @@ "parse-json": "^2.2.0", "pify": "^2.0.0", "strip-bom": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } } }, "locate-path": { @@ -4335,13 +4291,12 @@ "dev": true }, "lru-cache": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.2.tgz", - "integrity": "sha1-HRdnnAac2l0ECZGgnbwsDbN35V4=", - "dev": true, + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", "requires": { - "pseudomap": "^1.0.1", - "yallist": "^2.0.0" + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" } }, "lsmod": { @@ -4356,6 +4311,14 @@ "dev": true, "requires": { "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } } }, "map-cache": { @@ -4445,16 +4408,16 @@ "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" }, "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" }, "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", "requires": { - "mime-db": "~1.36.0" + "mime-db": "~1.37.0" } }, "mimic-fn": { @@ -4514,43 +4477,36 @@ } }, "mongodb": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.6.tgz", - "integrity": "sha512-E5QJuXQoMlT7KyCYqNNMfAkhfQD79AT4F8Xd+6x37OX+8BL17GyXyWvfm6wuyx4wnzCCPoCSLeMeUN2S7dU9yw==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.8.tgz", + "integrity": "sha512-yNKwYxQ6m00NV6+pMoWoheFTHSQVv1KkSrfOhRDYMILGWDYtUtQRqHrFqU75rmPIY8hMozVft8zdC4KYMWaM3Q==", "requires": { - "mongodb-core": "3.1.5", + "mongodb-core": "3.1.7", "safe-buffer": "^5.1.2" } }, "mongodb-core": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.5.tgz", - "integrity": "sha512-emT/tM4ZBinqd6RZok+EzDdtN4LjYJIckv71qQVOEFmvXgT5cperZegVmTgox/1cx4XQu6LJ5ZuIwipP/eKdQg==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.7.tgz", + "integrity": "sha512-YffpSrLmgFNmrvkGx+yX00KyBNk64C0BalfEn6vHHkXtcMUGXw8nxrMmhq5eXPLLlYeBpD/CsgNxE2Chf0o4zQ==", "requires": { "bson": "^1.1.0", "require_optional": "^1.0.1", "safe-buffer": "^5.1.2", "saslprep": "^1.0.0" - }, - "dependencies": { - "bson": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz", - "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==" - } } }, "mongoose": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.3.4.tgz", - "integrity": "sha512-DIUWOyYgZv2zGi/BoFEaFiaCVuDonnzGhW3cnc3JFjBScYn6z24tS2j3VB0dtMoX8FFjxmmMVnlmHPEIbV4PKA==", + "version": "5.3.9", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.3.9.tgz", + "integrity": "sha512-FbCW2qCptfPW/ltRwgqKpPCK113WTIhZDnn+0L0hO2XoX9Yp4LuIP0Nab7eBK+TsiIXWZAvzKhnnUKElTbl5ow==", "requires": { "async": "2.6.1", - "bson": "~1.0.5", + "bson": "~1.1.0", "kareem": "2.3.0", "lodash.get": "4.4.2", - "mongodb": "3.1.6", - "mongodb-core": "3.1.5", + "mongodb": "3.1.8", + "mongodb-core": "3.1.7", "mongoose-legacy-pluralize": "1.0.2", "mpath": "0.5.1", "mquery": "3.2.0", @@ -4558,16 +4514,6 @@ "regexp-clone": "0.0.1", "safe-buffer": "5.1.2", "sliced": "1.0.1" - }, - "dependencies": { - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "requires": { - "lodash": "^4.17.10" - } - } } }, "mongoose-legacy-pluralize": { @@ -4677,17 +4623,17 @@ "dev": true }, "node-fetch": { - "version": "2.1.2", - "resolved": "http://registry.npmjs.org/node-fetch/-/node-fetch-2.1.2.tgz", - "integrity": "sha1-q4hOjn5X44qUR1POxwb3iNF2i7U=" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.2.1.tgz", + "integrity": "sha512-ObXBpNCD3A/vYQiQtEWl7DuqjAXjfptYFuGHLdPl5U19/6kJuZV+8uMHLrkj3wJrJoyfg4nhgyFixZdaZoAiEQ==" }, "nodemon": { - "version": "1.18.4", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.18.4.tgz", - "integrity": "sha512-hyK6vl65IPnky/ee+D3IWvVGgJa/m3No2/Xc/3wanS6Ce1MWjCzH6NnhPJ/vZM+6JFym16jtHx51lmCMB9HDtg==", + "version": "1.18.6", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.18.6.tgz", + "integrity": "sha512-4pHQNYEZun+IkIC2jCaXEhkZnfA7rQe73i8RkdRyDJls/K+WxR7IpI5uNUsAvQ0zWvYcCDNGD+XVtw2ZG86/uQ==", "dev": true, "requires": { - "chokidar": "^2.0.2", + "chokidar": "^2.0.4", "debug": "^3.1.0", "ignore-by-default": "^1.0.1", "minimatch": "^3.0.4", @@ -5426,14 +5372,6 @@ "dev": true, "requires": { "pify": "^2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } } }, "pause-stream": { @@ -5446,9 +5384,9 @@ } }, "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "version": "2.3.0", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, "pinkie": { @@ -5588,9 +5526,9 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, "randomatic": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", - "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", "dev": true, "optional": true, "requires": { @@ -5684,18 +5622,14 @@ } }, "readable-stream": { - "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, + "version": "1.1.14", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "requires": { "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" } }, "readdirp": { @@ -5950,6 +5884,12 @@ } } }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", @@ -5982,6 +5922,30 @@ "snapdragon": "^0.8.1", "to-regex": "^3.0.2" } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } } } }, @@ -5992,10 +5956,9 @@ "dev": true }, "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "dev": true + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", + "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==" }, "regenerator-transform": { "version": "0.10.1", @@ -6274,6 +6237,13 @@ "on-finished": "~2.3.0", "range-parser": "~1.2.0", "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } } }, "serve-static": { @@ -6590,9 +6560,9 @@ } }, "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, "stream-combiner": { "version": "0.2.2", @@ -6637,13 +6607,9 @@ } }, "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" }, "strip-ansi": { "version": "3.0.1", @@ -6926,6 +6892,12 @@ "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", "dev": true }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", From b14828655f917c4fe56752d17da50ef083e441eb Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 02:38:13 +0100 Subject: [PATCH 14/33] Installing a clean linter for the frontend --- client/.eslintrc.js | 21 ++ client/package-lock.json | 295 ++++++++++++++---- client/package.json | 4 + client/src/Components/Event/Edit/index.js | 24 +- client/src/Components/Event/Edit/styles.js | 6 +- client/src/Components/Event/Show/index.js | 24 +- client/src/Components/Event/Show/styles.js | 6 +- client/src/Components/Events/index.js | 10 +- client/src/Components/HostedEvents/Event.js | 32 +- client/src/Components/HostedEvents/New.js | 72 +++-- client/src/Components/HostedEvents/index.js | 55 ++-- client/src/Components/HostedEvents/styles.js | 14 +- client/src/Components/Search/Event.js | 32 +- client/src/Components/Search/Tabs/Future.js | 26 +- client/src/Components/Search/Tabs/History.js | 16 +- client/src/Components/Search/Tabs/Incoming.js | 32 +- client/src/Components/Search/Tabs/Past.js | 26 +- client/src/Components/Search/Tabs/index.js | 12 +- client/src/Components/Search/index.js | 72 +++-- client/src/Components/Search/styles.js | 18 +- client/src/Components/TopBar/data.js | 22 +- client/src/Components/TopBar/index.js | 31 +- client/src/Components/TopBar/styles.js | 24 +- client/src/GraphQL/Calls/hostedEvents.js | 12 +- client/src/GraphQL/Calls/index.js | 10 +- client/src/GraphQL/Calls/listEvents.js | 10 +- client/src/GraphQL/Calls/showEvent.js | 10 +- client/src/GraphQL/Fragments/event.js | 6 +- client/src/GraphQL/Fragments/index.js | 8 +- client/src/index.js | 48 +-- client/src/utils/index.js | 18 +- client/src/utils/local-storage.js | 10 +- server/.eslintrc.js | 2 +- 33 files changed, 607 insertions(+), 401 deletions(-) create mode 100644 client/.eslintrc.js diff --git a/client/.eslintrc.js b/client/.eslintrc.js new file mode 100644 index 000000000..250847da1 --- /dev/null +++ b/client/.eslintrc.js @@ -0,0 +1,21 @@ +module.exports = { + parser: 'babel-eslint', + extends: [ + 'airbnb-base', + 'plugin:react/recommended', + ], + rules: { + 'no-underscore-dangle': 'off', + 'no-param-reassign': 'off', + 'react/prop-types': 0, + }, + settings: { + 'react': { + 'pragma': 'React', + 'version': '16.5', + }, + }, + env: { + 'browser': true, + }, +}; diff --git a/client/package-lock.json b/client/package-lock.json index 9ebb00764..839c3b060 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -227,9 +227,9 @@ "integrity": "sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg==" }, "acorn": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.2.tgz", - "integrity": "sha512-GXmKIvbrN3TV7aVqAzVFaMW8F8wzVX7voEBRO3bDA64+EX37YSayggRJP5Xig6HYHBkWKpFg9W5gg6orklubhg==", + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz", + "integrity": "sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg==", "dev": true }, "acorn-jsx": { @@ -239,9 +239,9 @@ "dev": true }, "ajv": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", - "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.5.tgz", + "integrity": "sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -263,9 +263,9 @@ "dev": true }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "ansi-styles": { @@ -381,6 +381,12 @@ "js-tokens": "^3.0.2" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", @@ -496,9 +502,9 @@ "integrity": "sha1-6LL+PX8at9aaMhma/5HqaTFAlRU=" }, "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, "circular-json": { @@ -730,16 +736,16 @@ "dev": true }, "eslint": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz", - "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.8.0.tgz", + "integrity": "sha512-Zok6Bru3y2JprqTNm14mgQ15YQu/SMDkWdnmHfFg770DIUlmMFd/gqqzCHekxzjHZJxXv3tmTpH0C1icaYJsRQ==", "dev": true, "requires": { - "ajv": "^6.5.0", - "babel-code-frame": "^6.26.0", + "@babel/code-frame": "^7.0.0", + "ajv": "^6.5.3", "chalk": "^2.1.0", "cross-spawn": "^6.0.5", - "debug": "^3.1.0", + "debug": "^4.0.1", "doctrine": "^2.1.0", "eslint-scope": "^4.0.0", "eslint-utils": "^1.3.1", @@ -751,11 +757,11 @@ "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", "globals": "^11.7.0", - "ignore": "^4.0.2", + "ignore": "^4.0.6", "imurmurhash": "^0.1.4", - "inquirer": "^5.2.0", + "inquirer": "^6.1.0", "is-resolvable": "^1.1.0", - "js-yaml": "^3.11.0", + "js-yaml": "^3.12.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", "lodash": "^4.17.5", @@ -766,15 +772,24 @@ "path-is-inside": "^1.0.2", "pluralize": "^7.0.0", "progress": "^2.0.0", - "regexpp": "^2.0.0", + "regexpp": "^2.0.1", "require-uncached": "^1.0.3", - "semver": "^5.5.0", + "semver": "^5.5.1", "strip-ansi": "^4.0.0", "strip-json-comments": "^2.0.1", - "table": "^4.0.3", + "table": "^5.0.2", "text-table": "^0.2.0" }, "dependencies": { + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, "eslint-scope": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", @@ -787,6 +802,17 @@ } } }, + "eslint-config-airbnb-base": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-13.1.0.tgz", + "integrity": "sha512-XWwQtf3U3zIoKO1BbHh6aUhJZQweOwSt4c2JrPDg9FP3Ltv3+YfEv7jIDB8275tVnO/qOHbfuYg3kzw6Je7uWw==", + "dev": true, + "requires": { + "eslint-restricted-globals": "^0.1.1", + "object.assign": "^4.1.0", + "object.entries": "^1.0.4" + } + }, "eslint-config-standard": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz", @@ -953,6 +979,12 @@ "integrity": "sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA==", "dev": true }, + "eslint-restricted-globals": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz", + "integrity": "sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc=", + "dev": true + }, "eslint-scope": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", @@ -1023,13 +1055,13 @@ "dev": true }, "external-editor": { - "version": "2.2.0", - "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", "dev": true, "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", "tmp": "^0.0.33" } }, @@ -1219,6 +1251,14 @@ "dev": true, "requires": { "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } } }, "has-flag": { @@ -1316,21 +1356,21 @@ "dev": true }, "inquirer": { - "version": "5.2.0", - "resolved": "http://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", - "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "dev": true, "requires": { "ansi-escapes": "^3.0.0", "chalk": "^2.0.0", "cli-cursor": "^2.1.0", "cli-width": "^2.0.0", - "external-editor": "^2.1.0", + "external-editor": "^3.0.0", "figures": "^2.0.0", - "lodash": "^4.3.0", + "lodash": "^4.17.10", "mute-stream": "0.0.7", "run-async": "^2.2.0", - "rxjs": "^5.5.2", + "rxjs": "^6.1.0", "string-width": "^2.1.0", "strip-ansi": "^4.0.0", "through": "^2.3.6" @@ -1788,6 +1828,30 @@ "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", "dev": true }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.entries": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.0.4.tgz", + "integrity": "sha1-G/mk3SKI9bM/Opk9JXZh8F0WGl8=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.6.1", + "function-bind": "^1.1.0", + "has": "^1.0.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2327,20 +2391,12 @@ "dev": true }, "rxjs": { - "version": "5.5.12", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz", - "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", + "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", "dev": true, "requires": { - "symbol-observable": "1.0.1" - }, - "dependencies": { - "symbol-observable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", - "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", - "dev": true - } + "tslib": "^1.9.0" } }, "safer-buffer": { @@ -2463,6 +2519,131 @@ "eslint-plugin-react": "~7.11.1", "eslint-plugin-standard": "~4.0.0", "standard-engine": "~9.0.0" + }, + "dependencies": { + "chardet": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, + "eslint": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz", + "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==", + "dev": true, + "requires": { + "ajv": "^6.5.0", + "babel-code-frame": "^6.26.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^3.1.0", + "doctrine": "^2.1.0", + "eslint-scope": "^4.0.0", + "eslint-utils": "^1.3.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^4.0.0", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^2.0.0", + "functional-red-black-tree": "^1.0.1", + "glob": "^7.1.2", + "globals": "^11.7.0", + "ignore": "^4.0.2", + "imurmurhash": "^0.1.4", + "inquirer": "^5.2.0", + "is-resolvable": "^1.1.0", + "js-yaml": "^3.11.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.5", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "path-is-inside": "^1.0.2", + "pluralize": "^7.0.0", + "progress": "^2.0.0", + "regexpp": "^2.0.0", + "require-uncached": "^1.0.3", + "semver": "^5.5.0", + "strip-ansi": "^4.0.0", + "strip-json-comments": "^2.0.1", + "table": "^4.0.3", + "text-table": "^0.2.0" + } + }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "external-editor": { + "version": "2.2.0", + "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "dev": true, + "requires": { + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" + } + }, + "inquirer": { + "version": "5.2.0", + "resolved": "http://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", + "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.1.0", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^5.5.2", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + } + }, + "rxjs": { + "version": "5.5.12", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz", + "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "dev": true, + "requires": { + "symbol-observable": "1.0.1" + } + }, + "symbol-observable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", + "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", + "dev": true + }, + "table": { + "version": "4.0.3", + "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", + "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", + "dev": true, + "requires": { + "ajv": "^6.0.1", + "ajv-keywords": "^3.0.0", + "chalk": "^2.1.0", + "lodash": "^4.17.4", + "slice-ansi": "1.0.0", + "string-width": "^2.1.1" + } + } } }, "standard-engine": { @@ -2502,14 +2683,6 @@ "dev": true, "requires": { "ansi-regex": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - } } }, "strip-bom": { @@ -2539,15 +2712,13 @@ "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=" }, "table": { - "version": "4.0.3", - "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", - "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/table/-/table-5.1.0.tgz", + "integrity": "sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg==", "dev": true, "requires": { - "ajv": "^6.0.1", - "ajv-keywords": "^3.0.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", + "ajv": "^6.5.3", + "lodash": "^4.17.10", "slice-ansi": "1.0.0", "string-width": "^2.1.1" } diff --git a/client/package.json b/client/package.json index 96d0f6959..c02059c10 100644 --- a/client/package.json +++ b/client/package.json @@ -13,6 +13,10 @@ }, "devDependencies": { "babel-eslint": "^10.0.1", + "eslint": "^5.8.0", + "eslint-config-airbnb-base": "^13.1.0", + "eslint-plugin-import": "^2.14.0", + "eslint-plugin-react": "^7.11.1", "react-hot-loader": "^4.3.11", "standard": "^12.0.1" }, diff --git a/client/src/Components/Event/Edit/index.js b/client/src/Components/Event/Edit/index.js index 1a17154bb..6fc58c7f0 100644 --- a/client/src/Components/Event/Edit/index.js +++ b/client/src/Components/Event/Edit/index.js @@ -1,15 +1,15 @@ -import React from 'react' -import { Query } from 'react-apollo' +import React from 'react'; +import { Query } from 'react-apollo'; -import Typography from '@material-ui/core/Typography' -import { withStyles } from '@material-ui/core/styles' +import Typography from '@material-ui/core/Typography'; +import { withStyles } from '@material-ui/core/styles'; -import styles from './styles' +import styles from './styles'; -import { showEventCalls } from '../../../GraphQL/Calls/index' +import { showEventCalls } from '../../../GraphQL/Calls/index'; class Edit extends React.Component { - render () { + render() { return ( {({ loading, error, data }) => { - if (loading) return 'Loading...' - if (error) return `Error! ${error.message}` + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; return (

{data.events_Event.description}

- ) + ); }}
- ) + ); } } -export default withStyles(styles)(Edit) +export default withStyles(styles)(Edit); diff --git a/client/src/Components/Event/Edit/styles.js b/client/src/Components/Event/Edit/styles.js index 175dc52e5..12fd82051 100644 --- a/client/src/Components/Event/Edit/styles.js +++ b/client/src/Components/Event/Edit/styles.js @@ -1,4 +1,4 @@ -const styles = theme => ({ -}) +const styles = () => ({ +}); -export default styles +export default styles; diff --git a/client/src/Components/Event/Show/index.js b/client/src/Components/Event/Show/index.js index aaf59fb06..86b2b61bc 100644 --- a/client/src/Components/Event/Show/index.js +++ b/client/src/Components/Event/Show/index.js @@ -1,15 +1,15 @@ -import React from 'react' -import { Query } from 'react-apollo' +import React from 'react'; +import { Query } from 'react-apollo'; -import Typography from '@material-ui/core/Typography' -import { withStyles } from '@material-ui/core/styles' +import Typography from '@material-ui/core/Typography'; +import { withStyles } from '@material-ui/core/styles'; -import styles from './styles' +import styles from './styles'; -import { showEventCalls } from '../../../GraphQL/Calls/index' +import { showEventCalls } from '../../../GraphQL/Calls/index'; class Show extends React.Component { - render () { + render() { return ( {({ loading, error, data }) => { - if (loading) return 'Loading...' - if (error) return `Error! ${error.message}` + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; return (

{data.events_Event.description}

- ) + ); }}
- ) + ); } } -export default withStyles(styles)(Show) +export default withStyles(styles)(Show); diff --git a/client/src/Components/Event/Show/styles.js b/client/src/Components/Event/Show/styles.js index 175dc52e5..12fd82051 100644 --- a/client/src/Components/Event/Show/styles.js +++ b/client/src/Components/Event/Show/styles.js @@ -1,4 +1,4 @@ -const styles = theme => ({ -}) +const styles = () => ({ +}); -export default styles +export default styles; diff --git a/client/src/Components/Events/index.js b/client/src/Components/Events/index.js index 96d83a55d..dde254d73 100644 --- a/client/src/Components/Events/index.js +++ b/client/src/Components/Events/index.js @@ -1,9 +1,5 @@ -import React from 'react' +import React from 'react'; -class Index extends React.Component { - render () { - return

Here will come a list the competitions you applied for

- } -} +const Index = () =>

Here will come a list the competitions you applied for

; -export default Index +export default Index; diff --git a/client/src/Components/HostedEvents/Event.js b/client/src/Components/HostedEvents/Event.js index 47ad49c54..7ccb22ec7 100644 --- a/client/src/Components/HostedEvents/Event.js +++ b/client/src/Components/HostedEvents/Event.js @@ -1,27 +1,27 @@ -import React from 'react' -import { Link } from 'react-router-dom' +import React from 'react'; +import { Link } from 'react-router-dom'; import { Grid, Paper, Typography, - Button -} from '@material-ui/core' -import { withStyles } from '@material-ui/core/styles' -import styles from './styles' + Button, +} from '@material-ui/core'; +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -import { toLocalTime } from '../../utils' +import { toLocalTime } from '../../utils'; class Event extends React.Component { - render () { - const classes = this.props.classes + render() { + const { classes } = this.props; const { name, designator, startDatetime, finishDatetime, host, - description - } = this.props.event + description, + } = this.props.event; return ( @@ -31,7 +31,9 @@ class Event extends React.Component { To : {toLocalTime(finishDatetime)} - Hosted by: {host.alias} ({host.lastName} {host.firstName}) + + Hosted by: {host.alias} ({host.lastName} {host.firstName}) + Formula: First prize: @@ -58,7 +60,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={'/show/' + designator} + to={`/show/${designator}`} > Show @@ -67,8 +69,8 @@ class Event extends React.Component { - ) + ); } } -export default withStyles(styles)(Event) +export default withStyles(styles)(Event); diff --git a/client/src/Components/HostedEvents/New.js b/client/src/Components/HostedEvents/New.js index 61b4d72ff..3b2d41245 100644 --- a/client/src/Components/HostedEvents/New.js +++ b/client/src/Components/HostedEvents/New.js @@ -1,64 +1,70 @@ -import React from 'react' -import { Mutation } from 'react-apollo' -import { hostedEventsCalls } from '../../GraphQL/Calls/index' -import { DateTime } from 'luxon' +import React from 'react'; +import { Mutation } from 'react-apollo'; +import { DateTime } from 'luxon'; import { Button, - TextField -} from '@material-ui/core' -import { ChevronLeft, ChevronRight } from '@material-ui/icons' -import { DateTimePicker } from 'material-ui-pickers' + TextField, +} from '@material-ui/core'; +import { ChevronLeft, ChevronRight } from '@material-ui/icons'; +import { DateTimePicker } from 'material-ui-pickers'; +import { hostedEventsCalls } from '../../GraphQL/Calls/index'; class New extends React.Component { - constructor (props) { - super(props) + constructor(props) { + super(props); this.state = { name: '', description: '', startDatetime: DateTime.local().plus({ days: 1 }).startOf('day'), - finishDatetime: DateTime.local().plus({ days: 8 }).startOf('day') - } + finishDatetime: DateTime.local().plus({ days: 8 }).startOf('day'), + }; } - render () { - const { name, description, startDatetime, finishDatetime } = this.state + render() { + const { + name, description, startDatetime, finishDatetime, + } = this.state; return ( { - const { events_EventsByHost: hostedEvents } = store.readQuery({ query: hostedEventsCalls.EVENTS_EVENTSBYHOST }) + const { events_EventsByHost: hostedEvents } = store.readQuery({ + query: hostedEventsCalls.EVENTS_EVENTSBYHOST, + }); store.writeQuery({ query: hostedEventsCalls.EVENTS_EVENTSBYHOST, - data: { events_EventsByHost: hostedEvents.concat([data.events_HostEvent]) } - }) - this.props.handleNewEvent(data.events_HostEvent) + data: { events_EventsByHost: hostedEvents.concat([data.events_HostEvent]) }, + }); + this.props.handleNewEvent(data.events_HostEvent); } } > - {(hostEvent, { data }) => ( + {hostEvent => (
{ - e.preventDefault() - hostEvent({ variables: { - name: name, - description: description, - startDatetime: startDatetime.valueOf() / 1000, - finishDatetime: startDatetime.valueOf() / 1000 - } }) + onSubmit={(e) => { + e.preventDefault(); + hostEvent({ + variables: { + name, + description, + startDatetime: startDatetime.valueOf() / 1000, + finishDatetime: startDatetime.valueOf() / 1000, + }, + }); }} > this.setState({ name: e.target.value })} + onChange={e => this.setState({ name: e.target.value })} fullWidth /> this.setState({ description: e.target.value })} + onChange={e => this.setState({ description: e.target.value })} fullWidth /> } rightArrowIcon={} value={startDatetime} - onChange={(date) => this.setState({ startDatetime: date })} + onChange={date => this.setState({ startDatetime: date })} helperText='Competition start date' /> } rightArrowIcon={} value={finishDatetime} - onChange={(date) => this.setState({ finishDatetime: date })} + onChange={date => this.setState({ finishDatetime: date })} helperText='Competition finishing date' /> @@ -91,8 +97,8 @@ class New extends React.Component {
)}
- ) + ); } } -export default New +export default New; diff --git a/client/src/Components/HostedEvents/index.js b/client/src/Components/HostedEvents/index.js index 248d0d929..dfd5b8353 100644 --- a/client/src/Components/HostedEvents/index.js +++ b/client/src/Components/HostedEvents/index.js @@ -1,41 +1,41 @@ -import React from 'react' -import { Query } from 'react-apollo' +import React from 'react'; +import { Query } from 'react-apollo'; import { Button, Dialog, DialogContent, DialogContentText, - DialogTitle -} from '@material-ui/core' + DialogTitle, +} from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from './styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -import { hostedEventsCalls } from '../../GraphQL/Calls/index' +import { hostedEventsCalls } from '../../GraphQL/Calls/index'; -import New from './New' -import Event from './Event' +import New from './New'; +import Event from './Event'; class HostedEvent extends React.Component { - constructor (props) { - super(props) + constructor(props) { + super(props); this.state = { - isNewEventOpen: false - } + isNewEventOpen: false, + }; } handleNewEvent = (event) => { - this.props.history.push(`/edit/${event.designator}`) + this.props.history.push(`/edit/${event.designator}`); }; - render () { - const { classes } = this.props + render() { + const { classes } = this.props; return ( @@ -43,24 +43,22 @@ class HostedEvent extends React.Component { query={hostedEventsCalls.EVENTS_EVENTSBYHOST} > {({ loading, error, data }) => { - if (loading) return 'Loading...' - if (error) return `Error! ${error.message}` - const list = data.events_EventsByHost.map((event, index) => { - return ( + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; + const list = data.events_EventsByHost.map((event, index) => ( - ) - }) + )); return ( { list } - ) + ); }} { this.setState({ isNewEventOpen: false }) }} + onClose={() => { this.setState({ isNewEventOpen: false }); }} aria-labelledby='addEvent-dialog-title' > @@ -68,14 +66,15 @@ class HostedEvent extends React.Component { - Here you will add just the minimal information, will be settable in the edit page of your event. + Here you will add just the minimal information, + will be settable in the edit page of your event. - ) + ); } } -export default withStyles(styles)(HostedEvent) +export default withStyles(styles)(HostedEvent); diff --git a/client/src/Components/HostedEvents/styles.js b/client/src/Components/HostedEvents/styles.js index e867e8174..8a55c4d41 100644 --- a/client/src/Components/HostedEvents/styles.js +++ b/client/src/Components/HostedEvents/styles.js @@ -5,22 +5,22 @@ const styles = theme => ({ marginTop: 20, marginBottom: 20, marginLeft: 400, - marginRight: 400 + marginRight: 400, }, buttonList: { margin: theme.spacing.unit, - float: 'right' + float: 'right', }, buttonGrid: { - marginTop: -20 + marginTop: -20, }, addButton: { display: 'block', padding: 20, marginTop: 20, marginRight: 20, - marginLeft: 'auto' - } -}) + marginLeft: 'auto', + }, +}); -export default styles +export default styles; diff --git a/client/src/Components/Search/Event.js b/client/src/Components/Search/Event.js index 8a3579416..42865cc2c 100644 --- a/client/src/Components/Search/Event.js +++ b/client/src/Components/Search/Event.js @@ -1,27 +1,27 @@ -import React from 'react' -import { Link } from 'react-router-dom' +import React from 'react'; +import { Link } from 'react-router-dom'; import { Grid, Paper, Typography, - Button -} from '@material-ui/core' -import { withStyles } from '@material-ui/core/styles' -import styles from './styles' + Button, +} from '@material-ui/core'; +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -import { toLocalTime } from '../../utils' +import { toLocalTime } from '../../utils'; class Event extends React.Component { - render () { - const classes = this.props.classes + render() { + const { classes } = this.props; const { name, designator, startDatetime, finishDatetime, host, - description - } = this.props.event + description, + } = this.props.event; return ( @@ -31,7 +31,9 @@ class Event extends React.Component { To : {toLocalTime(finishDatetime)} - Hosted by: {host.alias} ({host.lastName} {host.firstName}) + + Hosted by: {host.alias} ({host.lastName} {host.firstName}) + Formula: First prize: @@ -48,7 +50,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={'/show/' + designator} + to={`/show/${designator}`} > Show @@ -57,8 +59,8 @@ class Event extends React.Component { - ) + ); } } -export default withStyles(styles)(Event) +export default withStyles(styles)(Event); diff --git a/client/src/Components/Search/Tabs/Future.js b/client/src/Components/Search/Tabs/Future.js index 2a46f4995..6a83bf3c9 100644 --- a/client/src/Components/Search/Tabs/Future.js +++ b/client/src/Components/Search/Tabs/Future.js @@ -1,21 +1,19 @@ -import React from 'react' -import { Typography } from '@material-ui/core' +import React from 'react'; +import { Typography } from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from '../styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; -import Event from '../Event' +import Event from '../Event'; class Future extends React.Component { - render () { - const classes = this.props.classes - const { FutureEvents } = this.props + render() { + const { classes } = this.props; + const { FutureEvents } = this.props; - const futureEvents = FutureEvents.map((event, index) => { - return ( + const futureEvents = FutureEvents.map((event, index) => ( - ) - }) + )); return ( {futureEvents} - ) + ); } } -export default withStyles(styles)(Future) +export default withStyles(styles)(Future); diff --git a/client/src/Components/Search/Tabs/History.js b/client/src/Components/Search/Tabs/History.js index 0db046e5c..21d848289 100644 --- a/client/src/Components/Search/Tabs/History.js +++ b/client/src/Components/Search/Tabs/History.js @@ -1,12 +1,12 @@ -import React from 'react' -import { Typography } from '@material-ui/core' +import React from 'react'; +import { Typography } from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from '../styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; class History extends React.Component { - render () { - const classes = this.props.classes + render() { + const { classes } = this.props; return ( Your old events (maybe here, maybe not, who knows) - ) + ); } } -export default withStyles(styles)(History) +export default withStyles(styles)(History); diff --git a/client/src/Components/Search/Tabs/Incoming.js b/client/src/Components/Search/Tabs/Incoming.js index 3956aa6d7..94fe6b93b 100644 --- a/client/src/Components/Search/Tabs/Incoming.js +++ b/client/src/Components/Search/Tabs/Incoming.js @@ -1,26 +1,22 @@ -import React from 'react' -import { Typography } from '@material-ui/core' +import React from 'react'; +import { Typography } from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from '../styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; -import Event from '../Event' +import Event from '../Event'; class Incoming extends React.Component { - render () { - const classes = this.props.classes - const { IncomingEvents, OngoingEvents } = this.props + render() { + const { classes } = this.props; + const { IncomingEvents, OngoingEvents } = this.props; - const incomingEvents = IncomingEvents.map((event, index) => { - return ( + const incomingEvents = IncomingEvents.map((event, index) => ( - ) - }) - const ongoingEvents = OngoingEvents.map((event, index) => { - return ( + )); + const ongoingEvents = OngoingEvents.map((event, index) => ( - ) - }) + )); return ( {incomingEvents} - ) + ); } } -export default withStyles(styles)(Incoming) +export default withStyles(styles)(Incoming); diff --git a/client/src/Components/Search/Tabs/Past.js b/client/src/Components/Search/Tabs/Past.js index 60a6bc5aa..5ca060c67 100644 --- a/client/src/Components/Search/Tabs/Past.js +++ b/client/src/Components/Search/Tabs/Past.js @@ -1,21 +1,19 @@ -import React from 'react' -import { Typography } from '@material-ui/core' +import React from 'react'; +import { Typography } from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from '../styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; -import Event from '../Event' +import Event from '../Event'; class Past extends React.Component { - render () { - const classes = this.props.classes - const { PastEvents } = this.props + render() { + const { classes } = this.props; + const { PastEvents } = this.props; - const pastEvents = PastEvents.map((event, index) => { - return ( + const pastEvents = PastEvents.map((event, index) => ( - ) - }) + )); return ( {pastEvents} - ) + ); } } -export default withStyles(styles)(Past) +export default withStyles(styles)(Past); diff --git a/client/src/Components/Search/Tabs/index.js b/client/src/Components/Search/Tabs/index.js index a4077c1ac..d15abeb9c 100644 --- a/client/src/Components/Search/Tabs/index.js +++ b/client/src/Components/Search/Tabs/index.js @@ -1,11 +1,11 @@ -import Future from './Future' -import History from './History' -import Incoming from './Incoming' -import Past from './Past' +import Future from './Future'; +import History from './History'; +import Incoming from './Incoming'; +import Past from './Past'; export { Future, History, Incoming, - Past -} + Past, +}; diff --git a/client/src/Components/Search/index.js b/client/src/Components/Search/index.js index 0d50b2f86..d1799aa7f 100644 --- a/client/src/Components/Search/index.js +++ b/client/src/Components/Search/index.js @@ -1,68 +1,70 @@ -import React from 'react' -import { Query } from 'react-apollo' -import { DateTime } from 'luxon' +import React from 'react'; +import { Query } from 'react-apollo'; +import { DateTime } from 'luxon'; import { Typography, AppBar, Tabs, - Tab -} from '@material-ui/core' + Tab, +} from '@material-ui/core'; import { GetApp as IncomingIcon, AlarmAdd as FutureIcon, - History as HistoryIcon -} from '@material-ui/icons' + History as HistoryIcon, +} from '@material-ui/icons'; -import { withStyles } from '@material-ui/core/styles' -import styles from './styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -import { listEventsCalls } from '../../GraphQL/Calls/index' +import { listEventsCalls } from '../../GraphQL/Calls/index'; import { Future, History, Incoming, - Past -} from './Tabs' + Past, +} from './Tabs'; -function TabContainer (props) { +function TabContainer(props) { return ( {props.children} - ) + ); } class Search extends React.Component { - constructor (props) { - super(props) + constructor(props) { + super(props); this.state = { - value: 0 - } + value: 0, + }; } handleChange = (event, value) => { - this.setState({ value }) + this.setState({ value }); } - render () { - const classes = this.props.classes - const { value } = this.state + render() { + const { classes } = this.props; + const { value } = this.state; return ( {({ loading, error, data }) => { - if (loading) return 'Loading...' - if (error) return `Error! ${error.message}` - const now = ~~(DateTime.local().valueOf() / 1000) - const inTwoWeeks = ~~(DateTime.local().plus({ weeks: 2 }).valueOf() / 1000) + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; + const now = Math.floor(DateTime.local().valueOf() / 1000); + const inTwoWeeks = Math.floor(DateTime.local().plus({ weeks: 2 }).valueOf() / 1000); - const IncomingEvents = data.events_Events.filter(event => event.startDatetime > now && event.startDatetime < inTwoWeeks) - const OngoingEvents = data.events_Events.filter(event => event.finishDatetime > now && event.startDatetime < now) - const FutureEvents = data.events_Events.filter(event => event.startDatetime > now) - const PastEvents = data.events_Events.filter(event => event.finishDatetime < now) + const IncomingEvents = data.events_Events.filter(event => event.startDatetime > now + && event.startDatetime < inTwoWeeks); + const OngoingEvents = data.events_Events.filter(event => event.finishDatetime > now + && event.startDatetime < now); + const FutureEvents = data.events_Events.filter(event => event.startDatetime > now); + const PastEvents = data.events_Events.filter(event => event.finishDatetime < now); return ( @@ -98,17 +100,19 @@ class Search extends React.Component { /> - {value === 0 && } + {value === 0 && + + } {value === 1 && } {value === 2 && } {value === 3 && } - ) + ); }} - ) + ); } } -export default withStyles(styles)(Search) +export default withStyles(styles)(Search); diff --git a/client/src/Components/Search/styles.js b/client/src/Components/Search/styles.js index 9981d904a..139e732cb 100644 --- a/client/src/Components/Search/styles.js +++ b/client/src/Components/Search/styles.js @@ -4,11 +4,11 @@ const styles = theme => ({ width: '100%', backgroundColor: theme.palette.background.paper, padding: 0, - margin: 0 + margin: 0, }, tabTitle: { width: '25%', - maxWidth: 'none' + maxWidth: 'none', }, card: { flexGrow: 1, @@ -16,18 +16,18 @@ const styles = theme => ({ marginTop: 20, marginBottom: 20, marginLeft: 400, - marginRight: 400 + marginRight: 400, }, buttonList: { margin: theme.spacing.unit, - float: 'right' + float: 'right', }, buttonGrid: { - marginTop: -20 + marginTop: -20, }, title: { - marginTop: 20 - } -}) + marginTop: 20, + }, +}); -export default styles +export default styles; diff --git a/client/src/Components/TopBar/data.js b/client/src/Components/TopBar/data.js index 8726e606d..918c91daa 100644 --- a/client/src/Components/TopBar/data.js +++ b/client/src/Components/TopBar/data.js @@ -1,11 +1,17 @@ -import GamesIcon from '@material-ui/icons/Games' -import SearchIcon from '@material-ui/icons/Search' -import LibraryAddIcon from '@material-ui/icons/LibraryAdd' +import GamesIcon from '@material-ui/icons/Games'; +import SearchIcon from '@material-ui/icons/Search'; +import LibraryAddIcon from '@material-ui/icons/LibraryAdd'; const data = [ - { title: 'Look for an event', to: '/', icon: SearchIcon, text: '' }, - { title: 'Events you are enrolled in', to: '/my', icon: GamesIcon, text: '' }, - { title: 'Host your own competition', to: '/host', icon: LibraryAddIcon, text: '' } -] + { + title: 'Look for an event', to: '/', icon: SearchIcon, text: '', + }, + { + title: 'Events you are enrolled in', to: '/my', icon: GamesIcon, text: '', + }, + { + title: 'Host your own competition', to: '/host', icon: LibraryAddIcon, text: '', + }, +]; -export default data +export default data; diff --git a/client/src/Components/TopBar/index.js b/client/src/Components/TopBar/index.js index 06fe761f6..c3ac67581 100644 --- a/client/src/Components/TopBar/index.js +++ b/client/src/Components/TopBar/index.js @@ -1,16 +1,18 @@ -import React from 'react' -import { Link } from 'react-router-dom' -import classNames from 'classnames' +import React from 'react'; +import { Link } from 'react-router-dom'; +import classNames from 'classnames'; -import { AppBar, Toolbar, Typography, Button } from '@material-ui/core' -import { withStyles } from '@material-ui/core/styles' +import { + AppBar, Toolbar, Typography, Button, +} from '@material-ui/core'; +import { withStyles } from '@material-ui/core/styles'; -import datas from './data' -import styles from './styles' +import datas from './data'; +import styles from './styles'; -const TopBar = ({ classes, user, match }) => { +const TopBar = ({ classes }) => { const buttons = datas.map((data, index) => { - const Icon = data.icon + const Icon = data.icon; return ( ) - } - ) + ); + }); return (
@@ -36,7 +37,7 @@ const TopBar = ({ classes, user, match }) => {
- ) -} + ); +}; -export default withStyles(styles)(TopBar) +export default withStyles(styles)(TopBar); diff --git a/client/src/Components/TopBar/styles.js b/client/src/Components/TopBar/styles.js index 25cf9ab3b..6202592d6 100644 --- a/client/src/Components/TopBar/styles.js +++ b/client/src/Components/TopBar/styles.js @@ -1,37 +1,37 @@ const styles = theme => ({ root: { - flexGrow: 1 + flexGrow: 1, }, flex: { flexGrow: 1, - marginLeft: 30 + marginLeft: 30, }, menuButton: { marginLeft: -12, - marginRight: 20 + marginRight: 20, }, cssRoot: { color: '#FFFFFF', backgroundColor: theme.palette.secondary, '&:hover': { - backgroundColor: theme.palette.dark + backgroundColor: theme.palette.dark, }, whiteSpace: 'nowrap', paddingRight: 2 * theme.spacing.unit, - paddingLeft: 2 * theme.spacing.unit + paddingLeft: 2 * theme.spacing.unit, }, button: { - margin: theme.spacing.unit + margin: theme.spacing.unit, }, leftIcon: { - marginRight: theme.spacing.unit + marginRight: theme.spacing.unit, }, rightIcon: { - marginLeft: theme.spacing.unit + marginLeft: theme.spacing.unit, }, iconSmall: { - fontSize: 20 - } -}) + fontSize: 20, + }, +}); -export default styles +export default styles; diff --git a/client/src/GraphQL/Calls/hostedEvents.js b/client/src/GraphQL/Calls/hostedEvents.js index 05b3f77f2..badd88e1e 100644 --- a/client/src/GraphQL/Calls/hostedEvents.js +++ b/client/src/GraphQL/Calls/hostedEvents.js @@ -1,5 +1,5 @@ -import gql from 'graphql-tag' -import { eventMinimalInfo } from '../Fragments' +import gql from 'graphql-tag'; +import { eventMinimalInfo } from '../Fragments'; const EVENTS_HOSTEVENT = gql` mutation Hosts_HostEvent($name: String!, $description: String!, $startDatetime: Int!, $finishDatetime: Int!) { @@ -8,7 +8,7 @@ const EVENTS_HOSTEVENT = gql` } } ${eventMinimalInfo} -` +`; const EVENTS_EVENTSBYHOST = gql` query Hosts_EventsByHost{ events_EventsByHost { @@ -16,8 +16,8 @@ const EVENTS_EVENTSBYHOST = gql` } } ${eventMinimalInfo} -` +`; export default { EVENTS_HOSTEVENT, - EVENTS_EVENTSBYHOST -} + EVENTS_EVENTSBYHOST, +}; diff --git a/client/src/GraphQL/Calls/index.js b/client/src/GraphQL/Calls/index.js index d3fe57c6d..334af1c78 100644 --- a/client/src/GraphQL/Calls/index.js +++ b/client/src/GraphQL/Calls/index.js @@ -1,9 +1,9 @@ -import hostedEventsCalls from './hostedEvents' -import listEventsCalls from './listEvents' -import showEventCalls from './showEvent' +import hostedEventsCalls from './hostedEvents'; +import listEventsCalls from './listEvents'; +import showEventCalls from './showEvent'; export { hostedEventsCalls, listEventsCalls, - showEventCalls -} + showEventCalls, +}; diff --git a/client/src/GraphQL/Calls/listEvents.js b/client/src/GraphQL/Calls/listEvents.js index c115eb746..f5c3204e0 100644 --- a/client/src/GraphQL/Calls/listEvents.js +++ b/client/src/GraphQL/Calls/listEvents.js @@ -1,5 +1,5 @@ -import gql from 'graphql-tag' -import { eventMinimalInfo } from '../Fragments' +import gql from 'graphql-tag'; +import { eventMinimalInfo } from '../Fragments'; const EVENTS_EVENTS = gql` query Hosts_Events{ @@ -8,7 +8,7 @@ const EVENTS_EVENTS = gql` } } ${eventMinimalInfo} -` +`; export default { - EVENTS_EVENTS -} + EVENTS_EVENTS, +}; diff --git a/client/src/GraphQL/Calls/showEvent.js b/client/src/GraphQL/Calls/showEvent.js index b26b0e0dc..105e09779 100644 --- a/client/src/GraphQL/Calls/showEvent.js +++ b/client/src/GraphQL/Calls/showEvent.js @@ -1,5 +1,5 @@ -import gql from 'graphql-tag' -import { eventFullInfo } from '../Fragments' +import gql from 'graphql-tag'; +import { eventFullInfo } from '../Fragments'; const EVENTS_EVENT = gql` query Hosts_Event($designator: ID!) { @@ -8,8 +8,8 @@ const EVENTS_EVENT = gql` } } ${eventFullInfo} -` +`; export default { - EVENTS_EVENT -} + EVENTS_EVENT, +}; diff --git a/client/src/GraphQL/Fragments/event.js b/client/src/GraphQL/Fragments/event.js index 9fd7a4610..bf1bba058 100644 --- a/client/src/GraphQL/Fragments/event.js +++ b/client/src/GraphQL/Fragments/event.js @@ -1,4 +1,4 @@ -import gql from 'graphql-tag' +import gql from 'graphql-tag'; export const eventMinimalInfo = gql` fragment EventMinimalInfo on events_Event { @@ -13,7 +13,7 @@ export const eventMinimalInfo = gql` } description } -` +`; export const eventFullInfo = gql` fragment EventFullInfo on events_Event { @@ -58,4 +58,4 @@ export const eventFullInfo = gql` } } } -` +`; diff --git a/client/src/GraphQL/Fragments/index.js b/client/src/GraphQL/Fragments/index.js index 93d8f9971..cb2ce691c 100644 --- a/client/src/GraphQL/Fragments/index.js +++ b/client/src/GraphQL/Fragments/index.js @@ -1,9 +1,9 @@ import { eventMinimalInfo, - eventFullInfo -} from './event' + eventFullInfo, +} from './event'; export { eventMinimalInfo, - eventFullInfo -} + eventFullInfo, +}; diff --git a/client/src/index.js b/client/src/index.js index 6989c8551..3f1c182da 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -1,40 +1,40 @@ -import React, { Component } from 'react' -import { Route, BrowserRouter, Switch } from 'react-router-dom' +import React, { Component } from 'react'; +import { Route, BrowserRouter, Switch } from 'react-router-dom'; -import { MuiPickersUtilsProvider } from 'material-ui-pickers' -import LuxonUtils from 'material-ui-pickers/utils/luxon-utils' +import { MuiPickersUtilsProvider } from 'material-ui-pickers'; +import LuxonUtils from 'material-ui-pickers/utils/luxon-utils'; -import { getItem } from './utils/local-storage' +import { getItem } from './utils/local-storage'; -import TopBar from './Components/TopBar' -import Search from './Components/Search' -import Events from './Components/Events' -import HostedEvents from './Components/HostedEvents' -import EditEvent from './Components/Event/Edit' +import TopBar from './Components/TopBar'; +import Search from './Components/Search'; +import Events from './Components/Events'; +import HostedEvents from './Components/HostedEvents'; +import EditEvent from './Components/Event/Edit'; class App extends Component { - constructor (props) { - super(props) + constructor(props) { + super(props); this.state = { - user: null - } + user: null, + }; } - async componentDidMount () { - let user = await getItem('user') + async componentDidMount() { + let user = await getItem('user'); if (user !== null && user !== undefined && user !== 'undefined') { - user = JSON.parse(user) - this.setState({ user }) + user = JSON.parse(user); + this.setState({ user }); } } - render () { - let loggedIn + render() { + let loggedIn; if (this.state.user !== null) { - loggedIn = () + loggedIn = (); } else { - loggedIn = '' + loggedIn = ''; } return ( @@ -51,8 +51,8 @@ class App extends Component { - ) + ); } } -export default App +export default App; diff --git a/client/src/utils/index.js b/client/src/utils/index.js index 36ed3a467..2d2a69e07 100644 --- a/client/src/utils/index.js +++ b/client/src/utils/index.js @@ -1,10 +1,12 @@ export const toLocalTime = (epoch) => { - let localDate = new Date(0) - localDate.setUTCSeconds(epoch) - var options = { year: 'numeric', month: 'long', day: '2-digit' } + const localDate = new Date(0); + localDate.setUTCSeconds(epoch); + const options = { year: 'numeric', month: 'long', day: '2-digit' }; return ( - localDate.toLocaleDateString(options) + - ' at ' + - localDate.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' }) - ) -} + `${localDate.toLocaleDateString(options) + } at ${ + localDate.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' })}` + ); +}; + +export const temporaryFunction = input => input; diff --git a/client/src/utils/local-storage.js b/client/src/utils/local-storage.js index 963ba0f36..9da53f424 100644 --- a/client/src/utils/local-storage.js +++ b/client/src/utils/local-storage.js @@ -1,9 +1,9 @@ -const getItem = async name => window.localStorage.getItem(name) -const setItem = async (name, value) => window.localStorage.setItem(name, value) -const removeItem = async name => window.localStorage.removeItem(name) +const getItem = async name => window.localStorage.getItem(name); +const setItem = async (name, value) => window.localStorage.setItem(name, value); +const removeItem = async name => window.localStorage.removeItem(name); export { getItem, setItem, - removeItem -} + removeItem, +}; diff --git a/server/.eslintrc.js b/server/.eslintrc.js index b41dc444e..800621670 100644 --- a/server/.eslintrc.js +++ b/server/.eslintrc.js @@ -3,6 +3,6 @@ module.exports = { extends: 'airbnb-base', rules: { 'no-underscore-dangle': 'off', - 'no-param-reassign': 'off' + 'no-param-reassign': 'off', } }; From 59743d7221fdc6002685f7bdeda120beb1e68729 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 03:38:23 +0100 Subject: [PATCH 15/33] Adapting code for new API --- client/src/Components/Event/Edit/index.js | 2 +- client/src/Components/Event/Show/index.js | 2 +- client/src/Components/HostedEvents/Event.js | 6 +++--- client/src/Components/HostedEvents/New.js | 16 +++++++++------- client/src/Components/HostedEvents/index.js | 2 +- client/src/Components/Search/Event.js | 4 ++-- client/src/GraphQL/Calls/hostedEvents.js | 10 +++++----- client/src/GraphQL/Calls/listEvents.js | 2 +- client/src/GraphQL/Calls/showEvent.js | 4 ++-- client/src/GraphQL/Fragments/event.js | 4 ++-- client/src/index.js | 2 +- 11 files changed, 28 insertions(+), 26 deletions(-) diff --git a/client/src/Components/Event/Edit/index.js b/client/src/Components/Event/Edit/index.js index 6fc58c7f0..f63874df6 100644 --- a/client/src/Components/Event/Edit/index.js +++ b/client/src/Components/Event/Edit/index.js @@ -22,7 +22,7 @@ class Edit extends React.Component { {({ loading, error, data }) => { if (loading) return 'Loading...'; diff --git a/client/src/Components/Event/Show/index.js b/client/src/Components/Event/Show/index.js index 86b2b61bc..4c83b98bd 100644 --- a/client/src/Components/Event/Show/index.js +++ b/client/src/Components/Event/Show/index.js @@ -22,7 +22,7 @@ class Show extends React.Component { {({ loading, error, data }) => { if (loading) return 'Loading...'; diff --git a/client/src/Components/HostedEvents/Event.js b/client/src/Components/HostedEvents/Event.js index 7ccb22ec7..4ba395132 100644 --- a/client/src/Components/HostedEvents/Event.js +++ b/client/src/Components/HostedEvents/Event.js @@ -15,8 +15,8 @@ class Event extends React.Component { render() { const { classes } = this.props; const { + id, name, - designator, startDatetime, finishDatetime, host, @@ -50,7 +50,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={`/edit/${designator}`} + to={`/edit/${id}`} > Edit @@ -60,7 +60,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={`/show/${designator}`} + to={`/show/${id}`} > Show diff --git a/client/src/Components/HostedEvents/New.js b/client/src/Components/HostedEvents/New.js index 3b2d41245..3d2012f24 100644 --- a/client/src/Components/HostedEvents/New.js +++ b/client/src/Components/HostedEvents/New.js @@ -26,16 +26,16 @@ class New extends React.Component { name, description, startDatetime, finishDatetime, } = this.state; return ( - { const { events_EventsByHost: hostedEvents } = store.readQuery({ query: hostedEventsCalls.EVENTS_EVENTSBYHOST, }); store.writeQuery({ query: hostedEventsCalls.EVENTS_EVENTSBYHOST, - data: { events_EventsByHost: hostedEvents.concat([data.events_HostEvent]) }, + data: { events_EventsByHost: hostedEvents.concat([data.events_CreateEvent]) }, }); - this.props.handleNewEvent(data.events_HostEvent); + this.props.handleNewEvent(data.events_CreateEvent); } } > @@ -46,10 +46,12 @@ class New extends React.Component { e.preventDefault(); hostEvent({ variables: { - name, - description, - startDatetime: startDatetime.valueOf() / 1000, - finishDatetime: startDatetime.valueOf() / 1000, + event: { + name, + description, + startDatetime: startDatetime.valueOf() / 1000, + finishDatetime: startDatetime.valueOf() / 1000, + }, }, }); }} diff --git a/client/src/Components/HostedEvents/index.js b/client/src/Components/HostedEvents/index.js index dfd5b8353..bc25a705d 100644 --- a/client/src/Components/HostedEvents/index.js +++ b/client/src/Components/HostedEvents/index.js @@ -26,7 +26,7 @@ class HostedEvent extends React.Component { } handleNewEvent = (event) => { - this.props.history.push(`/edit/${event.designator}`); + this.props.history.push(`/edit/${event.id}`); }; render() { diff --git a/client/src/Components/Search/Event.js b/client/src/Components/Search/Event.js index 42865cc2c..43c72f0ec 100644 --- a/client/src/Components/Search/Event.js +++ b/client/src/Components/Search/Event.js @@ -15,8 +15,8 @@ class Event extends React.Component { render() { const { classes } = this.props; const { + id, name, - designator, startDatetime, finishDatetime, host, @@ -50,7 +50,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={`/show/${designator}`} + to={`/show/${id}`} > Show diff --git a/client/src/GraphQL/Calls/hostedEvents.js b/client/src/GraphQL/Calls/hostedEvents.js index badd88e1e..2fe4460be 100644 --- a/client/src/GraphQL/Calls/hostedEvents.js +++ b/client/src/GraphQL/Calls/hostedEvents.js @@ -1,16 +1,16 @@ import gql from 'graphql-tag'; import { eventMinimalInfo } from '../Fragments'; -const EVENTS_HOSTEVENT = gql` - mutation Hosts_HostEvent($name: String!, $description: String!, $startDatetime: Int!, $finishDatetime: Int!) { - events_HostEvent(name: $name, description: $description, startDatetime: $startDatetime, finishDatetime: $finishDatetime) { +const EVENTS_CREATEEVENT = gql` + mutation Events_CreateEvent($event:events_EventInput!) { + events_CreateEvent(event: $event) { ...EventMinimalInfo } } ${eventMinimalInfo} `; const EVENTS_EVENTSBYHOST = gql` - query Hosts_EventsByHost{ + query Events_EventsByHost{ events_EventsByHost { ...EventMinimalInfo } @@ -18,6 +18,6 @@ const EVENTS_EVENTSBYHOST = gql` ${eventMinimalInfo} `; export default { - EVENTS_HOSTEVENT, + EVENTS_CREATEEVENT, EVENTS_EVENTSBYHOST, }; diff --git a/client/src/GraphQL/Calls/listEvents.js b/client/src/GraphQL/Calls/listEvents.js index f5c3204e0..6941002fc 100644 --- a/client/src/GraphQL/Calls/listEvents.js +++ b/client/src/GraphQL/Calls/listEvents.js @@ -2,7 +2,7 @@ import gql from 'graphql-tag'; import { eventMinimalInfo } from '../Fragments'; const EVENTS_EVENTS = gql` - query Hosts_Events{ + query Events_Events{ events_Events { ...EventMinimalInfo } diff --git a/client/src/GraphQL/Calls/showEvent.js b/client/src/GraphQL/Calls/showEvent.js index 105e09779..855c9b510 100644 --- a/client/src/GraphQL/Calls/showEvent.js +++ b/client/src/GraphQL/Calls/showEvent.js @@ -2,8 +2,8 @@ import gql from 'graphql-tag'; import { eventFullInfo } from '../Fragments'; const EVENTS_EVENT = gql` - query Hosts_Event($designator: ID!) { - events_Event(designator: $designator) { + query Events_Event($eventId: ID!) { + events_Event(eventId: $eventId) { ...EventFullInfo } } diff --git a/client/src/GraphQL/Fragments/event.js b/client/src/GraphQL/Fragments/event.js index bf1bba058..299f00687 100644 --- a/client/src/GraphQL/Fragments/event.js +++ b/client/src/GraphQL/Fragments/event.js @@ -2,8 +2,8 @@ import gql from 'graphql-tag'; export const eventMinimalInfo = gql` fragment EventMinimalInfo on events_Event { + id name - designator startDatetime finishDatetime host { @@ -17,7 +17,7 @@ export const eventMinimalInfo = gql` export const eventFullInfo = gql` fragment EventFullInfo on events_Event { - designator + id name host{ alias diff --git a/client/src/index.js b/client/src/index.js index 3f1c182da..f1f7dc90c 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -44,7 +44,7 @@ class App extends Component { - + From 8b53cf1539cc8ec049d351e50cc0e5bf7d5e8fa8 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 05:24:21 +0100 Subject: [PATCH 16/33] Instoring the status type . --- client/src/GraphQL/Fragments/event.js | 2 ++ server/src/enums/EventStatus.js | 2 ++ server/src/schema/queries/Events.js | 2 ++ server/src/schema/queries/EventsByHost.js | 3 ++- server/src/schema/queries/EventsByTeam.js | 7 ++++++- server/src/schema/types/Event.js | 2 ++ server/src/schema/types/enum/EventStatus.js | 19 +++++++++++++++++++ 7 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 server/src/schema/types/enum/EventStatus.js diff --git a/client/src/GraphQL/Fragments/event.js b/client/src/GraphQL/Fragments/event.js index 299f00687..cd72463a7 100644 --- a/client/src/GraphQL/Fragments/event.js +++ b/client/src/GraphQL/Fragments/event.js @@ -3,6 +3,7 @@ import gql from 'graphql-tag'; export const eventMinimalInfo = gql` fragment EventMinimalInfo on events_Event { id + status name startDatetime finishDatetime @@ -18,6 +19,7 @@ export const eventMinimalInfo = gql` export const eventFullInfo = gql` fragment EventFullInfo on events_Event { id + status name host{ alias diff --git a/server/src/enums/EventStatus.js b/server/src/enums/EventStatus.js index 50a4bc53e..025c28fca 100644 --- a/server/src/enums/EventStatus.js +++ b/server/src/enums/EventStatus.js @@ -4,6 +4,7 @@ export const CANCELLED = 'CANCELLED'; export const RUNNING = 'RUNNING'; export const INTERRUPTED = 'INTERRUPTED'; export const FINISHED = 'FINISHED'; +export const ARCHIVED = 'ARCHIVED'; export const EventStatusEnum = [ UNPUBLISHED, @@ -12,6 +13,7 @@ export const EventStatusEnum = [ RUNNING, INTERRUPTED, FINISHED, + ARCHIVED, ]; export default EventStatusEnum; diff --git a/server/src/schema/queries/Events.js b/server/src/schema/queries/Events.js index c5b1b5e9f..e8d0bcfef 100644 --- a/server/src/schema/queries/Events.js +++ b/server/src/schema/queries/Events.js @@ -4,6 +4,7 @@ import { } from 'graphql'; import { EventType } from '../types'; import { Event } from '../../models'; +import { UNPUBLISHED, ARCHIVED } from '../../enums/EventStatus'; const args = { minDate: { type: GraphQLInt }, @@ -12,6 +13,7 @@ const args = { const resolve = (parent, { minDate, maxDate }) => Event.find( Object.assign( + { status: { $nin: [UNPUBLISHED, ARCHIVED] } }, minDate || maxDate ? { startDatetime: diff --git a/server/src/schema/queries/EventsByHost.js b/server/src/schema/queries/EventsByHost.js index ac4975f40..449314cb1 100644 --- a/server/src/schema/queries/EventsByHost.js +++ b/server/src/schema/queries/EventsByHost.js @@ -5,6 +5,7 @@ import { } from 'graphql'; import { EventType } from '../types'; import { Event } from '../../models'; +import { UNPUBLISHED, ARCHIVED } from '../../enums/EventStatus'; const args = { hostId: { type: GraphQLString }, @@ -14,7 +15,7 @@ const args = { const resolve = (parent, { hostId, minDate, maxDate }, context) => Event.find( Object.assign( - hostId ? { hostId } : { hostId: context.userId }, + hostId ? { hostId, status: { $nin: [UNPUBLISHED, ARCHIVED] } } : { hostId: context.userId }, minDate || maxDate ? { startDatetime: diff --git a/server/src/schema/queries/EventsByTeam.js b/server/src/schema/queries/EventsByTeam.js index 10a914288..7816ff347 100644 --- a/server/src/schema/queries/EventsByTeam.js +++ b/server/src/schema/queries/EventsByTeam.js @@ -6,6 +6,7 @@ import { } from 'graphql'; import { EventType } from '../types'; import { Event } from '../../models'; +import { UNPUBLISHED, ARCHIVED } from '../../enums/EventStatus'; const args = { teamId: { type: new GraphQLNonNull(GraphQLString) }, @@ -15,7 +16,11 @@ const args = { const resolve = (parent, { teamId, minDate, maxDate }) => Event.find( Object.assign( - { participants: { $elemMatch: { teamId } } }, + { + participants: { $elemMatch: { teamId } }, + status: { $nin: [UNPUBLISHED, ARCHIVED] }, + }, + minDate || maxDate ? { startDatetime: diff --git a/server/src/schema/types/Event.js b/server/src/schema/types/Event.js index 4cc843906..a53041cb4 100644 --- a/server/src/schema/types/Event.js +++ b/server/src/schema/types/Event.js @@ -12,12 +12,14 @@ import { ParticipantType, PrizeType, } from './index'; +import EventStatusEnumType from './enum/EventStatus'; const EventType = new GraphQLObjectType({ name: 'Event', description: 'Everything you need to know about an event', fields: () => ({ id: { type: GraphQLID }, + status: { type: EventStatusEnumType }, name: { type: GraphQLString }, hostId: { type: GraphQLString }, description: { type: GraphQLString }, diff --git a/server/src/schema/types/enum/EventStatus.js b/server/src/schema/types/enum/EventStatus.js new file mode 100644 index 000000000..372abd92f --- /dev/null +++ b/server/src/schema/types/enum/EventStatus.js @@ -0,0 +1,19 @@ +import { + GraphQLEnumType, +} from 'graphql'; + +import { EventStatusEnum } from '../../../enums/EventStatus'; + +const values = {}; +EventStatusEnum.forEach((EventStatus) => { + values[EventStatus] = { value: EventStatus }; +}); + +const EventStatusEnumType = new GraphQLEnumType({ + name: 'EventStatusEnum', + values, +}); + +export { + EventStatusEnumType as default, +}; From c22ff708685a058a611d59dc692b6c55855ee19e Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 06:23:10 +0100 Subject: [PATCH 17/33] Exporting the create action out of the modaal into a dedicated button --- .../New.js => Event/Create/index.js} | 18 ++-- client/src/Components/Event/Create/styles.js | 4 + client/src/Components/HostedEvents/index.js | 92 +++++-------------- client/src/Components/HostedEvents/styles.js | 7 -- client/src/Components/TopBar/data.js | 18 ++-- client/src/index.js | 2 + 6 files changed, 46 insertions(+), 95 deletions(-) rename client/src/Components/{HostedEvents/New.js => Event/Create/index.js} (85%) create mode 100644 client/src/Components/Event/Create/styles.js diff --git a/client/src/Components/HostedEvents/New.js b/client/src/Components/Event/Create/index.js similarity index 85% rename from client/src/Components/HostedEvents/New.js rename to client/src/Components/Event/Create/index.js index 3d2012f24..599d10f0e 100644 --- a/client/src/Components/HostedEvents/New.js +++ b/client/src/Components/Event/Create/index.js @@ -8,9 +8,12 @@ import { } from '@material-ui/core'; import { ChevronLeft, ChevronRight } from '@material-ui/icons'; import { DateTimePicker } from 'material-ui-pickers'; -import { hostedEventsCalls } from '../../GraphQL/Calls/index'; +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -class New extends React.Component { +import { hostedEventsCalls } from '../../../GraphQL/Calls'; + +class Create extends React.Component { constructor(props) { super(props); this.state = { @@ -28,14 +31,7 @@ class New extends React.Component { return ( { - const { events_EventsByHost: hostedEvents } = store.readQuery({ - query: hostedEventsCalls.EVENTS_EVENTSBYHOST, - }); - store.writeQuery({ - query: hostedEventsCalls.EVENTS_EVENTSBYHOST, - data: { events_EventsByHost: hostedEvents.concat([data.events_CreateEvent]) }, - }); - this.props.handleNewEvent(data.events_CreateEvent); + this.props.history.push(`/edit/${data.events_CreateEvent.id}`); } } > @@ -103,4 +99,4 @@ class New extends React.Component { } } -export default New; +export default withStyles(styles)(Create); diff --git a/client/src/Components/Event/Create/styles.js b/client/src/Components/Event/Create/styles.js new file mode 100644 index 000000000..12fd82051 --- /dev/null +++ b/client/src/Components/Event/Create/styles.js @@ -0,0 +1,4 @@ +const styles = () => ({ +}); + +export default styles; diff --git a/client/src/Components/HostedEvents/index.js b/client/src/Components/HostedEvents/index.js index bc25a705d..20b531949 100644 --- a/client/src/Components/HostedEvents/index.js +++ b/client/src/Components/HostedEvents/index.js @@ -1,80 +1,30 @@ import React from 'react'; import { Query } from 'react-apollo'; -import { - Button, - Dialog, - DialogContent, - DialogContentText, - DialogTitle, -} from '@material-ui/core'; - -import { withStyles } from '@material-ui/core/styles'; -import styles from './styles'; - import { hostedEventsCalls } from '../../GraphQL/Calls/index'; -import New from './New'; import Event from './Event'; -class HostedEvent extends React.Component { - constructor(props) { - super(props); - this.state = { - isNewEventOpen: false, - }; - } +const HostedEvent = () => ( + + + {({ loading, error, data }) => { + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; + const list = data.events_EventsByHost.map((event, index) => ( + + )); + return ( + + { list } + + ); + }} + + +); - handleNewEvent = (event) => { - this.props.history.push(`/edit/${event.id}`); - }; - render() { - const { classes } = this.props; - return ( - - - - - {({ loading, error, data }) => { - if (loading) return 'Loading...'; - if (error) return `Error! ${error.message}`; - const list = data.events_EventsByHost.map((event, index) => ( - - )); - return ( - - { list } - - ); - }} - - - { this.setState({ isNewEventOpen: false }); }} - aria-labelledby='addEvent-dialog-title' - > - - Host an event - - - - Here you will add just the minimal information, - will be settable in the edit page of your event. - - - - - - ); - } -} - -export default withStyles(styles)(HostedEvent); +export default HostedEvent; diff --git a/client/src/Components/HostedEvents/styles.js b/client/src/Components/HostedEvents/styles.js index 8a55c4d41..866f1e2fc 100644 --- a/client/src/Components/HostedEvents/styles.js +++ b/client/src/Components/HostedEvents/styles.js @@ -14,13 +14,6 @@ const styles = theme => ({ buttonGrid: { marginTop: -20, }, - addButton: { - display: 'block', - padding: 20, - marginTop: 20, - marginRight: 20, - marginLeft: 'auto', - }, }); export default styles; diff --git a/client/src/Components/TopBar/data.js b/client/src/Components/TopBar/data.js index 918c91daa..5077584e1 100644 --- a/client/src/Components/TopBar/data.js +++ b/client/src/Components/TopBar/data.js @@ -1,16 +1,22 @@ -import GamesIcon from '@material-ui/icons/Games'; -import SearchIcon from '@material-ui/icons/Search'; -import LibraryAddIcon from '@material-ui/icons/LibraryAdd'; +import { + Search, + GamepadRounded, + AccessibilityNew, + LibraryAdd, +} from '@material-ui/icons'; const data = [ { - title: 'Look for an event', to: '/', icon: SearchIcon, text: '', + title: 'Look for an event', to: '/', icon: Search, text: '', }, { - title: 'Events you are enrolled in', to: '/my', icon: GamesIcon, text: '', + title: 'Events you are enrolled in', to: '/my', icon: GamepadRounded, text: '', }, { - title: 'Host your own competition', to: '/host', icon: LibraryAddIcon, text: '', + title: 'Your hosted competition', to: '/host', icon: AccessibilityNew, text: '', + }, + { + title: 'Host a new competition', to: '/create', icon: LibraryAdd, text: '', }, ]; diff --git a/client/src/index.js b/client/src/index.js index f1f7dc90c..63d02671a 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -11,6 +11,7 @@ import Search from './Components/Search'; import Events from './Components/Events'; import HostedEvents from './Components/HostedEvents'; import EditEvent from './Components/Event/Edit'; +import CreateEvent from './Components/Event/Create'; class App extends Component { constructor(props) { @@ -44,6 +45,7 @@ class App extends Component { + From 7347d472bd9b58a725ec0a65712992d715047a90 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 06:38:56 +0100 Subject: [PATCH 18/33] Adding a new mutation for updating event status --- .../src/schema/mutations/ChangeEventStatus.js | 39 +++++++++++++++++++ server/src/schema/mutations/index.js | 2 + 2 files changed, 41 insertions(+) create mode 100644 server/src/schema/mutations/ChangeEventStatus.js diff --git a/server/src/schema/mutations/ChangeEventStatus.js b/server/src/schema/mutations/ChangeEventStatus.js new file mode 100644 index 000000000..8e95007b0 --- /dev/null +++ b/server/src/schema/mutations/ChangeEventStatus.js @@ -0,0 +1,39 @@ +import { + GraphQLNonNull, + GraphQLID, +} from 'graphql'; +import { AuthentificationError } from '../../errors'; +import { EventType } from '../types'; +import { Event } from '../../models'; +import EventStatusEnum from '../types/enum/EventStatus'; + +const args = { + eventId: { type: new GraphQLNonNull(GraphQLID) }, + status: { type: EventStatusEnum }, +}; + +const resolve = (parent, { eventId: _id, status }, { userId: hostId }) => { + if (!hostId) { + throw new AuthentificationError(); + } + + return new Promise((res, rej) => { + Event.findOneAndUpdate({ _id, hostId }, { status }, { new: true }, (err, modifiedEvent) => { + if (err) { + rej(err); + return; + } + res(modifiedEvent); + }); + }); +}; + +const mutation = { + changeEventStatus: { + type: EventType, + args, + resolve, + }, +}; + +export default mutation; diff --git a/server/src/schema/mutations/index.js b/server/src/schema/mutations/index.js index 1f621f13e..5aa9b2354 100644 --- a/server/src/schema/mutations/index.js +++ b/server/src/schema/mutations/index.js @@ -8,6 +8,7 @@ import RegisterToEventMutation from './RegisterToEvent'; import EditParticipantMutation from './EditParticipant'; import CreateFormulaMutation from './CreateFormula'; import CreatePlotterMutation from './CreatePlotter'; +import ChangeEventStatusMutation from './ChangeEventStatus'; const Mutation = new GraphQLObjectType({ name: 'Mutation', @@ -18,6 +19,7 @@ const Mutation = new GraphQLObjectType({ EditParticipantMutation, CreateFormulaMutation, CreatePlotterMutation, + ChangeEventStatusMutation, ), }); From 793b52e1d7380fe6ba51f036091a8ecf48814d9e Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 06:43:38 +0100 Subject: [PATCH 19/33] Renaming from status to state --- client/src/GraphQL/Fragments/event.js | 4 ++-- .../enums/{EventStatus.js => EventState.js} | 4 ++-- server/src/models/event.js | 8 ++++---- ...angeEventStatus.js => ChangeEventState.js} | 10 +++++----- server/src/schema/mutations/index.js | 4 ++-- server/src/schema/queries/Events.js | 4 ++-- server/src/schema/queries/EventsByHost.js | 4 ++-- server/src/schema/queries/EventsByTeam.js | 4 ++-- server/src/schema/types/Event.js | 4 ++-- server/src/schema/types/enum/EventState.js | 19 +++++++++++++++++++ server/src/schema/types/enum/EventStatus.js | 19 ------------------- 11 files changed, 42 insertions(+), 42 deletions(-) rename server/src/enums/{EventStatus.js => EventState.js} (84%) rename server/src/schema/mutations/{ChangeEventStatus.js => ChangeEventState.js} (65%) create mode 100644 server/src/schema/types/enum/EventState.js delete mode 100644 server/src/schema/types/enum/EventStatus.js diff --git a/client/src/GraphQL/Fragments/event.js b/client/src/GraphQL/Fragments/event.js index cd72463a7..96be79f08 100644 --- a/client/src/GraphQL/Fragments/event.js +++ b/client/src/GraphQL/Fragments/event.js @@ -3,7 +3,7 @@ import gql from 'graphql-tag'; export const eventMinimalInfo = gql` fragment EventMinimalInfo on events_Event { id - status + state name startDatetime finishDatetime @@ -19,7 +19,7 @@ export const eventMinimalInfo = gql` export const eventFullInfo = gql` fragment EventFullInfo on events_Event { id - status + state name host{ alias diff --git a/server/src/enums/EventStatus.js b/server/src/enums/EventState.js similarity index 84% rename from server/src/enums/EventStatus.js rename to server/src/enums/EventState.js index 025c28fca..4541a47ef 100644 --- a/server/src/enums/EventStatus.js +++ b/server/src/enums/EventState.js @@ -6,7 +6,7 @@ export const INTERRUPTED = 'INTERRUPTED'; export const FINISHED = 'FINISHED'; export const ARCHIVED = 'ARCHIVED'; -export const EventStatusEnum = [ +export const EventStateEnum = [ UNPUBLISHED, PUBLISHED, CANCELLED, @@ -16,4 +16,4 @@ export const EventStatusEnum = [ ARCHIVED, ]; -export default EventStatusEnum; +export default EventStateEnum; diff --git a/server/src/models/event.js b/server/src/models/event.js index 87d495ccd..c95ef5744 100644 --- a/server/src/models/event.js +++ b/server/src/models/event.js @@ -3,15 +3,15 @@ import Plotter from './plotter'; import Formula from './formula'; import { UNPUBLISHED, - EventStatusEnum, -} from '../enums/EventStatus'; + EventStateEnum, +} from '../enums/EventState'; const { ObjectId } = Schema.Types; const eventSchema = new Schema({ - status: { + state: { type: String, - enum: EventStatusEnum, + enum: EventStateEnum, default: UNPUBLISHED, }, name: { diff --git a/server/src/schema/mutations/ChangeEventStatus.js b/server/src/schema/mutations/ChangeEventState.js similarity index 65% rename from server/src/schema/mutations/ChangeEventStatus.js rename to server/src/schema/mutations/ChangeEventState.js index 8e95007b0..ada9367b8 100644 --- a/server/src/schema/mutations/ChangeEventStatus.js +++ b/server/src/schema/mutations/ChangeEventState.js @@ -5,20 +5,20 @@ import { import { AuthentificationError } from '../../errors'; import { EventType } from '../types'; import { Event } from '../../models'; -import EventStatusEnum from '../types/enum/EventStatus'; +import EventStateEnum from '../types/enum/EventState'; const args = { eventId: { type: new GraphQLNonNull(GraphQLID) }, - status: { type: EventStatusEnum }, + state: { type: EventStateEnum }, }; -const resolve = (parent, { eventId: _id, status }, { userId: hostId }) => { +const resolve = (parent, { eventId: _id, state }, { userId: hostId }) => { if (!hostId) { throw new AuthentificationError(); } return new Promise((res, rej) => { - Event.findOneAndUpdate({ _id, hostId }, { status }, { new: true }, (err, modifiedEvent) => { + Event.findOneAndUpdate({ _id, hostId }, { state }, { new: true }, (err, modifiedEvent) => { if (err) { rej(err); return; @@ -29,7 +29,7 @@ const resolve = (parent, { eventId: _id, status }, { userId: hostId }) => { }; const mutation = { - changeEventStatus: { + changeEventState: { type: EventType, args, resolve, diff --git a/server/src/schema/mutations/index.js b/server/src/schema/mutations/index.js index 5aa9b2354..2bd29dc34 100644 --- a/server/src/schema/mutations/index.js +++ b/server/src/schema/mutations/index.js @@ -8,7 +8,7 @@ import RegisterToEventMutation from './RegisterToEvent'; import EditParticipantMutation from './EditParticipant'; import CreateFormulaMutation from './CreateFormula'; import CreatePlotterMutation from './CreatePlotter'; -import ChangeEventStatusMutation from './ChangeEventStatus'; +import ChangeEventStateMutation from './ChangeEventState'; const Mutation = new GraphQLObjectType({ name: 'Mutation', @@ -19,7 +19,7 @@ const Mutation = new GraphQLObjectType({ EditParticipantMutation, CreateFormulaMutation, CreatePlotterMutation, - ChangeEventStatusMutation, + ChangeEventStateMutation, ), }); diff --git a/server/src/schema/queries/Events.js b/server/src/schema/queries/Events.js index e8d0bcfef..fae289a5b 100644 --- a/server/src/schema/queries/Events.js +++ b/server/src/schema/queries/Events.js @@ -4,7 +4,7 @@ import { } from 'graphql'; import { EventType } from '../types'; import { Event } from '../../models'; -import { UNPUBLISHED, ARCHIVED } from '../../enums/EventStatus'; +import { UNPUBLISHED, ARCHIVED } from '../../enums/EventState'; const args = { minDate: { type: GraphQLInt }, @@ -13,7 +13,7 @@ const args = { const resolve = (parent, { minDate, maxDate }) => Event.find( Object.assign( - { status: { $nin: [UNPUBLISHED, ARCHIVED] } }, + { state: { $nin: [UNPUBLISHED, ARCHIVED] } }, minDate || maxDate ? { startDatetime: diff --git a/server/src/schema/queries/EventsByHost.js b/server/src/schema/queries/EventsByHost.js index 449314cb1..6941570d4 100644 --- a/server/src/schema/queries/EventsByHost.js +++ b/server/src/schema/queries/EventsByHost.js @@ -5,7 +5,7 @@ import { } from 'graphql'; import { EventType } from '../types'; import { Event } from '../../models'; -import { UNPUBLISHED, ARCHIVED } from '../../enums/EventStatus'; +import { UNPUBLISHED, ARCHIVED } from '../../enums/EventState'; const args = { hostId: { type: GraphQLString }, @@ -15,7 +15,7 @@ const args = { const resolve = (parent, { hostId, minDate, maxDate }, context) => Event.find( Object.assign( - hostId ? { hostId, status: { $nin: [UNPUBLISHED, ARCHIVED] } } : { hostId: context.userId }, + hostId ? { hostId, state: { $nin: [UNPUBLISHED, ARCHIVED] } } : { hostId: context.userId }, minDate || maxDate ? { startDatetime: diff --git a/server/src/schema/queries/EventsByTeam.js b/server/src/schema/queries/EventsByTeam.js index 7816ff347..e9147e9b9 100644 --- a/server/src/schema/queries/EventsByTeam.js +++ b/server/src/schema/queries/EventsByTeam.js @@ -6,7 +6,7 @@ import { } from 'graphql'; import { EventType } from '../types'; import { Event } from '../../models'; -import { UNPUBLISHED, ARCHIVED } from '../../enums/EventStatus'; +import { UNPUBLISHED, ARCHIVED } from '../../enums/EventState'; const args = { teamId: { type: new GraphQLNonNull(GraphQLString) }, @@ -18,7 +18,7 @@ const resolve = (parent, { teamId, minDate, maxDate }) => Event.find( Object.assign( { participants: { $elemMatch: { teamId } }, - status: { $nin: [UNPUBLISHED, ARCHIVED] }, + state: { $nin: [UNPUBLISHED, ARCHIVED] }, }, minDate || maxDate diff --git a/server/src/schema/types/Event.js b/server/src/schema/types/Event.js index a53041cb4..e4582e346 100644 --- a/server/src/schema/types/Event.js +++ b/server/src/schema/types/Event.js @@ -12,14 +12,14 @@ import { ParticipantType, PrizeType, } from './index'; -import EventStatusEnumType from './enum/EventStatus'; +import EventStateEnumType from './enum/EventState'; const EventType = new GraphQLObjectType({ name: 'Event', description: 'Everything you need to know about an event', fields: () => ({ id: { type: GraphQLID }, - status: { type: EventStatusEnumType }, + state: { type: EventStateEnumType }, name: { type: GraphQLString }, hostId: { type: GraphQLString }, description: { type: GraphQLString }, diff --git a/server/src/schema/types/enum/EventState.js b/server/src/schema/types/enum/EventState.js new file mode 100644 index 000000000..d4ef1304f --- /dev/null +++ b/server/src/schema/types/enum/EventState.js @@ -0,0 +1,19 @@ +import { + GraphQLEnumType, +} from 'graphql'; + +import { EventStateEnum } from '../../../enums/EventState'; + +const values = {}; +EventStateEnum.forEach((EventState) => { + values[EventState] = { value: EventState }; +}); + +const EventStateEnumType = new GraphQLEnumType({ + name: 'EventStateEnum', + values, +}); + +export { + EventStateEnumType as default, +}; diff --git a/server/src/schema/types/enum/EventStatus.js b/server/src/schema/types/enum/EventStatus.js deleted file mode 100644 index 372abd92f..000000000 --- a/server/src/schema/types/enum/EventStatus.js +++ /dev/null @@ -1,19 +0,0 @@ -import { - GraphQLEnumType, -} from 'graphql'; - -import { EventStatusEnum } from '../../../enums/EventStatus'; - -const values = {}; -EventStatusEnum.forEach((EventStatus) => { - values[EventStatus] = { value: EventStatus }; -}); - -const EventStatusEnumType = new GraphQLEnumType({ - name: 'EventStatusEnum', - values, -}); - -export { - EventStatusEnumType as default, -}; From f3da7110ae74d4f4d7cd5da48843b40dbed80ff3 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 08:53:51 +0100 Subject: [PATCH 20/33] Config and apply more linting --- client/.eslintrc.js | 2 ++ client/src/Components/HostedEvents/index.js | 2 +- client/src/Components/Search/Tabs/Future.js | 2 +- client/src/Components/Search/Tabs/Incoming.js | 4 ++-- client/src/Components/Search/Tabs/Past.js | 2 +- server/.eslintrc.js | 1 + 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/client/.eslintrc.js b/client/.eslintrc.js index 250847da1..bdd833da9 100644 --- a/client/.eslintrc.js +++ b/client/.eslintrc.js @@ -5,9 +5,11 @@ module.exports = { 'plugin:react/recommended', ], rules: { + 'max-len': ['error', 140, 2], 'no-underscore-dangle': 'off', 'no-param-reassign': 'off', 'react/prop-types': 0, + 'react/jsx-indent': ['error', 2], }, settings: { 'react': { diff --git a/client/src/Components/HostedEvents/index.js b/client/src/Components/HostedEvents/index.js index 20b531949..32989e655 100644 --- a/client/src/Components/HostedEvents/index.js +++ b/client/src/Components/HostedEvents/index.js @@ -14,7 +14,7 @@ const HostedEvent = () => ( if (loading) return 'Loading...'; if (error) return `Error! ${error.message}`; const list = data.events_EventsByHost.map((event, index) => ( - + )); return ( diff --git a/client/src/Components/Search/Tabs/Future.js b/client/src/Components/Search/Tabs/Future.js index 6a83bf3c9..d5dbfc089 100644 --- a/client/src/Components/Search/Tabs/Future.js +++ b/client/src/Components/Search/Tabs/Future.js @@ -12,7 +12,7 @@ class Future extends React.Component { const { FutureEvents } = this.props; const futureEvents = FutureEvents.map((event, index) => ( - + )); return ( diff --git a/client/src/Components/Search/Tabs/Incoming.js b/client/src/Components/Search/Tabs/Incoming.js index 94fe6b93b..ab6b070dc 100644 --- a/client/src/Components/Search/Tabs/Incoming.js +++ b/client/src/Components/Search/Tabs/Incoming.js @@ -12,10 +12,10 @@ class Incoming extends React.Component { const { IncomingEvents, OngoingEvents } = this.props; const incomingEvents = IncomingEvents.map((event, index) => ( - + )); const ongoingEvents = OngoingEvents.map((event, index) => ( - + )); return ( diff --git a/client/src/Components/Search/Tabs/Past.js b/client/src/Components/Search/Tabs/Past.js index 5ca060c67..b01cb0684 100644 --- a/client/src/Components/Search/Tabs/Past.js +++ b/client/src/Components/Search/Tabs/Past.js @@ -12,7 +12,7 @@ class Past extends React.Component { const { PastEvents } = this.props; const pastEvents = PastEvents.map((event, index) => ( - + )); return ( diff --git a/server/.eslintrc.js b/server/.eslintrc.js index 800621670..c06bffbce 100644 --- a/server/.eslintrc.js +++ b/server/.eslintrc.js @@ -2,6 +2,7 @@ module.exports = { parser: 'babel-eslint', extends: 'airbnb-base', rules: { + 'max-len': ['error', 140, 2], 'no-underscore-dangle': 'off', 'no-param-reassign': 'off', } From 461248f5e46a3e37712b5519a252a8abd90fadcd Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 14:07:23 +0100 Subject: [PATCH 21/33] First draft of the first page of the form --- client/src/Components/Event/Create/index.js | 144 ++++++++++++++----- client/src/Components/Event/Create/styles.js | 37 ++++- 2 files changed, 147 insertions(+), 34 deletions(-) diff --git a/client/src/Components/Event/Create/index.js b/client/src/Components/Event/Create/index.js index 599d10f0e..69c200d2c 100644 --- a/client/src/Components/Event/Create/index.js +++ b/client/src/Components/Event/Create/index.js @@ -3,8 +3,18 @@ import { Mutation } from 'react-apollo'; import { DateTime } from 'luxon'; import { - Button, TextField, + FormControl, + InputLabel, + Input, + Button, + MenuItem, + FormGroup, + Select, + FormHelperText, + Paper, + Grid, + Typography, } from '@material-ui/core'; import { ChevronLeft, ChevronRight } from '@material-ui/icons'; import { DateTimePicker } from 'material-ui-pickers'; @@ -28,6 +38,7 @@ class Create extends React.Component { const { name, description, startDatetime, finishDatetime, } = this.state; + const { classes } = this.props; return ( { @@ -36,7 +47,11 @@ class Create extends React.Component { } > {hostEvent => ( -
+ + + + Create a new event + { e.preventDefault(); @@ -52,47 +67,110 @@ class Create extends React.Component { }); }} > + + These are the basic information you need to input in order to create an event. + There might be some heavy changes in the near future as the application is still at a very early stage. + + + + this.setState({ name: e.target.value })} - fullWidth + className={classes.inputField} /> this.setState({ description: e.target.value })} - fullWidth + className={classes.inputField} /> - } - rightArrowIcon={} - value={startDatetime} - onChange={date => this.setState({ startDatetime: date })} - helperText='Competition start date' - /> - } - rightArrowIcon={} - value={finishDatetime} - onChange={date => this.setState({ finishDatetime: date })} - helperText='Competition finishing date' - /> - + + + The dates are purely indicative, as it is important for you to make sure everything is + ready before manually triggering the beginning and end of the event. + If you are confident use the scheduler to start it for you(incoming). + + + + + + } + rightArrowIcon={} + value={startDatetime} + helperText='Competition start date' + /> + + + } + rightArrowIcon={} + value={finishDatetime} + helperText='Competition finishing date' + /> + + + + + + + Select the formula + + + For new formula, select {'"'}create new{'"'} + + + + Select the Plotter + + + For new plotter, select {'"'}create new{'"'} + + + + + + -
this.clearTempStates()} /> -
+
)} ); diff --git a/client/src/Components/Event/Create/styles.js b/client/src/Components/Event/Create/styles.js index 12fd82051..44ef163a0 100644 --- a/client/src/Components/Event/Create/styles.js +++ b/client/src/Components/Event/Create/styles.js @@ -1,4 +1,39 @@ -const styles = () => ({ +const styles = theme => ({ + root: { + width: '50%', + flexGrow: 1, + padding: 10, + marginLeft: '25%', + marginTop: '2%', + }, + inputField: { + width: '80%', + marginLeft: '10%', + marginTop: 25, + }, + typography: { + width: '80%', + marginLeft: '10%', + marginTop: 40, + }, + checkbox: { + width: 150, + marginLeft: '0%', + marginTop: 20, + }, + selectEmpty: { + marginTop: theme.spacing.unit * 2, + }, + button: { + margin: theme.spacing.unit, + marginTop: theme.spacing.unit * 3, + }, + img: { + display: 'block', + marginTop: 20, + maxWidth: 120, + maxHeight: 24, + }, }); export default styles; From a4d7e6ebfafd59284e0023a006c8be39701687d4 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 14:24:14 +0100 Subject: [PATCH 22/33] cleaning unused styles --- client/src/Components/TopBar/styles.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/client/src/Components/TopBar/styles.js b/client/src/Components/TopBar/styles.js index 6202592d6..675c55cab 100644 --- a/client/src/Components/TopBar/styles.js +++ b/client/src/Components/TopBar/styles.js @@ -6,10 +6,6 @@ const styles = theme => ({ flexGrow: 1, marginLeft: 30, }, - menuButton: { - marginLeft: -12, - marginRight: 20, - }, cssRoot: { color: '#FFFFFF', backgroundColor: theme.palette.secondary, @@ -20,15 +16,9 @@ const styles = theme => ({ paddingRight: 2 * theme.spacing.unit, paddingLeft: 2 * theme.spacing.unit, }, - button: { - margin: theme.spacing.unit, - }, leftIcon: { marginRight: theme.spacing.unit, }, - rightIcon: { - marginLeft: theme.spacing.unit, - }, iconSmall: { fontSize: 20, }, From 94d99ea92c92efdc898be5bd04f2d1612549ecab Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 15:05:37 +0100 Subject: [PATCH 23/33] Minimal refactoring before sending everything down a step --- .../src/Components/Event/Create/Tabs/Basic.js | 27 +++ .../Event/Create/Tabs/PresentationPage.js | 27 +++ .../Event/Create/Tabs/TeamsServer.js | 27 +++ .../Components/Event/Create/Tabs/Technical.js | 27 +++ .../src/Components/Event/Create/Tabs/index.js | 11 + client/src/Components/Event/Create/index.js | 202 ++++++++++++------ client/src/Components/Event/Create/styles.js | 46 ++-- 7 files changed, 288 insertions(+), 79 deletions(-) create mode 100644 client/src/Components/Event/Create/Tabs/Basic.js create mode 100644 client/src/Components/Event/Create/Tabs/PresentationPage.js create mode 100644 client/src/Components/Event/Create/Tabs/TeamsServer.js create mode 100644 client/src/Components/Event/Create/Tabs/Technical.js create mode 100644 client/src/Components/Event/Create/Tabs/index.js diff --git a/client/src/Components/Event/Create/Tabs/Basic.js b/client/src/Components/Event/Create/Tabs/Basic.js new file mode 100644 index 000000000..87760d33a --- /dev/null +++ b/client/src/Components/Event/Create/Tabs/Basic.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { Typography } from '@material-ui/core'; + +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; + + +class Basic extends React.Component { + render() { + const { classes } = this.props; + return ( + + + Basic + + + ); + } +} + +export default withStyles(styles)(Basic); diff --git a/client/src/Components/Event/Create/Tabs/PresentationPage.js b/client/src/Components/Event/Create/Tabs/PresentationPage.js new file mode 100644 index 000000000..1c674ddcc --- /dev/null +++ b/client/src/Components/Event/Create/Tabs/PresentationPage.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { Typography } from '@material-ui/core'; + +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; + + +class PresentationPage extends React.Component { + render() { + const { classes } = this.props; + return ( + + + PresentationPage + + + ); + } +} + +export default withStyles(styles)(PresentationPage); diff --git a/client/src/Components/Event/Create/Tabs/TeamsServer.js b/client/src/Components/Event/Create/Tabs/TeamsServer.js new file mode 100644 index 000000000..874c72d6f --- /dev/null +++ b/client/src/Components/Event/Create/Tabs/TeamsServer.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { Typography } from '@material-ui/core'; + +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; + + +class TeamsServer extends React.Component { + render() { + const { classes } = this.props; + return ( + + + TeamsServer + + + ); + } +} + +export default withStyles(styles)(TeamsServer); diff --git a/client/src/Components/Event/Create/Tabs/Technical.js b/client/src/Components/Event/Create/Tabs/Technical.js new file mode 100644 index 000000000..f091e6bd2 --- /dev/null +++ b/client/src/Components/Event/Create/Tabs/Technical.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { Typography } from '@material-ui/core'; + +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; + + +class Technical extends React.Component { + render() { + const { classes } = this.props; + return ( + + + Technical + + + ); + } +} + +export default withStyles(styles)(Technical); diff --git a/client/src/Components/Event/Create/Tabs/index.js b/client/src/Components/Event/Create/Tabs/index.js new file mode 100644 index 000000000..feecaaf55 --- /dev/null +++ b/client/src/Components/Event/Create/Tabs/index.js @@ -0,0 +1,11 @@ +import Basic from './Basic'; +import PresentationPage from './PresentationPage'; +import TeamsServer from './TeamsServer'; +import Technical from './Technical'; + +export { + Basic, + PresentationPage, + TeamsServer, + Technical, +}; diff --git a/client/src/Components/Event/Create/index.js b/client/src/Components/Event/Create/index.js index 69c200d2c..cfbd9686e 100644 --- a/client/src/Components/Event/Create/index.js +++ b/client/src/Components/Event/Create/index.js @@ -15,18 +15,44 @@ import { Paper, Grid, Typography, + AppBar, + Tabs, + Tab, } from '@material-ui/core'; -import { ChevronLeft, ChevronRight } from '@material-ui/icons'; +import { + ChevronLeft, + ChevronRight, + Face as BasicIcon, + Alarm as TechnicalIcon, + Group as TeamAndServerIcon, + PresentToAll as PresentationIcon, +} from '@material-ui/icons'; import { DateTimePicker } from 'material-ui-pickers'; import { withStyles } from '@material-ui/core/styles'; import styles from './styles'; +import { + Basic, + PresentationPage, + TeamsServer, + Technical, +} from './Tabs'; + import { hostedEventsCalls } from '../../../GraphQL/Calls'; +function TabContainer(props) { + return ( + + {props.children} + + ); +} + class Create extends React.Component { constructor(props) { super(props); this.state = { + value: 0, name: '', description: '', startDatetime: DateTime.local().plus({ days: 1 }).startOf('day'), @@ -34,9 +60,13 @@ class Create extends React.Component { }; } + handleChange = (event, value) => { + this.setState({ value }); + } + render() { const { - name, description, startDatetime, finishDatetime, + name, description, startDatetime, finishDatetime, value, } = this.state; const { classes } = this.props; return ( @@ -47,60 +77,94 @@ class Create extends React.Component { } > {hostEvent => ( - - - - Create a new event - -
{ - e.preventDefault(); - hostEvent({ - variables: { - event: { - name, - description, - startDatetime: startDatetime.valueOf() / 1000, - finishDatetime: startDatetime.valueOf() / 1000, - }, - }, - }); - }} +
+ + - + } + /> + } + /> + } + disabled + /> + } + disabled + /> + + + + + Create a new event + + { + e.preventDefault(); + hostEvent({ + variables: { + event: { + name, + description, + startDatetime: startDatetime.valueOf() / 1000, + finishDatetime: startDatetime.valueOf() / 1000, + }, + }, + }); + }} + > + {value === 0 && + These are the basic information you need to input in order to create an event. There might be some heavy changes in the near future as the application is still at a very early stage. - + - - - - + The dates are purely indicative, as it is important for you to make sure everything is ready before manually triggering the beginning and end of the event. If you are confident use the scheduler to start it for you(incoming). - + - - - - + + + - - - + + - - - + + + - - + + Select the formula - - } @@ -140,17 +204,17 @@ class Create extends React.Component { name='select' className={classes.selectEmpty} > - moi - toi - nous - - For new formula, select {'"'}create new{'"'} - - - + moi + toi + nous + + For new formula, select {'"'}create new{'"'} + + + Select the Plotter - - } @@ -158,19 +222,27 @@ class Create extends React.Component { name='select' className={classes.selectEmpty} > - moi - toi - nous - - For new plotter, select {'"'}create new{'"'} - - - - - - - - + moi + toi + nous + + For new plotter, select {'"'}create new{'"'} + + + + + + + + } + {value === 1 && } + {value === 2 && } + {value === 3 && } + + +
)} ); diff --git a/client/src/Components/Event/Create/styles.js b/client/src/Components/Event/Create/styles.js index 44ef163a0..150cf362d 100644 --- a/client/src/Components/Event/Create/styles.js +++ b/client/src/Components/Event/Create/styles.js @@ -1,5 +1,34 @@ const styles = theme => ({ root: { + flexGrow: 1, + width: '100%', + backgroundColor: theme.palette.background.paper, + padding: 0, + margin: 0, + }, + tabTitle: { + width: '25%', + maxWidth: 'none', + }, + card: { + flexGrow: 1, + padding: 20, + marginTop: 20, + marginBottom: 20, + marginLeft: 400, + marginRight: 400, + }, + buttonList: { + margin: theme.spacing.unit, + float: 'right', + }, + buttonGrid: { + marginTop: -20, + }, + title: { + marginTop: 20, + }, + paperRoot: { width: '50%', flexGrow: 1, padding: 10, @@ -16,23 +45,12 @@ const styles = theme => ({ marginLeft: '10%', marginTop: 40, }, - checkbox: { - width: 150, - marginLeft: '0%', - marginTop: 20, - }, selectEmpty: { marginTop: theme.spacing.unit * 2, }, - button: { - margin: theme.spacing.unit, - marginTop: theme.spacing.unit * 3, - }, - img: { - display: 'block', - marginTop: 20, - maxWidth: 120, - maxHeight: 24, + bottomButton: { + padding: 15, + margin: 20, }, }); From cb4a1155960ba7cc3ab222822af19c8278c85a37 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 15:37:00 +0100 Subject: [PATCH 24/33] Making the whole state system and all for creating the input form --- .../src/Components/Event/Create/Tabs/Basic.js | 137 +++++++++++++++-- client/src/Components/Event/Create/index.js | 145 +++--------------- 2 files changed, 149 insertions(+), 133 deletions(-) diff --git a/client/src/Components/Event/Create/Tabs/Basic.js b/client/src/Components/Event/Create/Tabs/Basic.js index 87760d33a..8c7797557 100644 --- a/client/src/Components/Event/Create/Tabs/Basic.js +++ b/client/src/Components/Event/Create/Tabs/Basic.js @@ -1,5 +1,23 @@ import React from 'react'; -import { Typography } from '@material-ui/core'; +import { + TextField, + FormControl, + InputLabel, + Input, + Button, + MenuItem, + FormGroup, + Select, + FormHelperText, + Typography, + Grid, +} from '@material-ui/core'; +import { + ChevronLeft, + ChevronRight, +} from '@material-ui/icons'; +import { DateTimePicker } from 'material-ui-pickers'; + import { withStyles } from '@material-ui/core/styles'; import styles from '../styles'; @@ -7,18 +25,117 @@ import styles from '../styles'; class Basic extends React.Component { render() { - const { classes } = this.props; + const { classes, event, edit } = this.props; return ( - - Basic + + These are the basic information you need to input in order to create an event. + There might be some heavy changes in the near future as the application is still at a very early stage. + + + + edit('name', newVal.target.value)} + /> + edit('description', newVal.target.value)} + /> + + + The dates are purely indicative, as it is important for you to make sure everything is + ready before manually triggering the beginning and end of the event. + If you are confident use the scheduler to start it for you(incoming). + + + + + + } + rightArrowIcon={} + value={event.startDatetime} + helperText='Competition start date' + onChange={newVal => edit('startDatetime', newVal)} + /> + + + } + rightArrowIcon={} + value={event.finishDatetime} + helperText='Competition finishing date' + onChange={newVal => edit('finishDatetime', newVal)} + /> + + + + + + + Select the formula + + + For new formula, select {'"'}create new{'"'} + + + + Select the Plotter + + + For new plotter, select {'"'}create new{'"'} + + + + + + ); } diff --git a/client/src/Components/Event/Create/index.js b/client/src/Components/Event/Create/index.js index cfbd9686e..9def0ded7 100644 --- a/client/src/Components/Event/Create/index.js +++ b/client/src/Components/Event/Create/index.js @@ -3,31 +3,18 @@ import { Mutation } from 'react-apollo'; import { DateTime } from 'luxon'; import { - TextField, - FormControl, - InputLabel, - Input, - Button, - MenuItem, - FormGroup, - Select, - FormHelperText, Paper, - Grid, Typography, AppBar, Tabs, Tab, } from '@material-ui/core'; import { - ChevronLeft, - ChevronRight, Face as BasicIcon, Alarm as TechnicalIcon, Group as TeamAndServerIcon, PresentToAll as PresentationIcon, } from '@material-ui/icons'; -import { DateTimePicker } from 'material-ui-pickers'; import { withStyles } from '@material-ui/core/styles'; import styles from './styles'; @@ -60,13 +47,21 @@ class Create extends React.Component { }; } - handleChange = (event, value) => { + handleTabChange = (event, value) => { this.setState({ value }); } + handleEventChange = (newType, newVal) => { + this.setState({ [newType]: newVal }); + } + render() { const { - name, description, startDatetime, finishDatetime, value, + name, + description, + startDatetime, + finishDatetime, + value, } = this.state; const { classes } = this.props; return ( @@ -81,7 +76,7 @@ class Create extends React.Component { {value === 0 && - - These are the basic information you need to input in order to create an event. - There might be some heavy changes in the near future as the application is still at a very early stage. - - - - - - - - - The dates are purely indicative, as it is important for you to make sure everything is - ready before manually triggering the beginning and end of the event. - If you are confident use the scheduler to start it for you(incoming). - - - - - - } - rightArrowIcon={} - value={startDatetime} - helperText='Competition start date' - /> - - - } - rightArrowIcon={} - value={finishDatetime} - helperText='Competition finishing date' - /> - - - - - - - Select the formula - - - For new formula, select {'"'}create new{'"'} - - - - Select the Plotter - - - For new plotter, select {'"'}create new{'"'} - - - - - - - - } + this.handleEventChange(newType, newVal)} + /> + } {value === 1 && } {value === 2 && } {value === 3 && } From 402632c1268a99d0970a10172cb42c5f19d30350 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 15:44:17 +0100 Subject: [PATCH 25/33] Putting select placeholder in second tab --- .../src/Components/Event/Create/Tabs/Basic.js | 53 +++--------------- .../Components/Event/Create/Tabs/Technical.js | 56 ++++++++++++++++--- client/src/Components/Event/Create/index.js | 14 ++++- 3 files changed, 69 insertions(+), 54 deletions(-) diff --git a/client/src/Components/Event/Create/Tabs/Basic.js b/client/src/Components/Event/Create/Tabs/Basic.js index 8c7797557..b5e6e4353 100644 --- a/client/src/Components/Event/Create/Tabs/Basic.js +++ b/client/src/Components/Event/Create/Tabs/Basic.js @@ -1,14 +1,8 @@ import React from 'react'; import { TextField, - FormControl, - InputLabel, - Input, Button, - MenuItem, FormGroup, - Select, - FormHelperText, Typography, Grid, } from '@material-ui/core'; @@ -92,47 +86,18 @@ class Basic extends React.Component { - - - - Select the formula - - - For new formula, select {'"'}create new{'"'} - - - - Select the Plotter - - - For new plotter, select {'"'}create new{'"'} - + diff --git a/client/src/Components/Event/Create/Tabs/Technical.js b/client/src/Components/Event/Create/Tabs/Technical.js index f091e6bd2..389c237e7 100644 --- a/client/src/Components/Event/Create/Tabs/Technical.js +++ b/client/src/Components/Event/Create/Tabs/Technical.js @@ -1,5 +1,13 @@ import React from 'react'; -import { Typography } from '@material-ui/core'; +import { + Typography, + FormControl, + InputLabel, + Input, + Select, + FormHelperText, + MenuItem, +} from '@material-ui/core'; import { withStyles } from '@material-ui/core/styles'; import styles from '../styles'; @@ -10,15 +18,45 @@ class Technical extends React.Component { const { classes } = this.props; return ( - - Technical + + Select the formula and the plotter you want to use, you can also create your own with the corresponding button. + + + Select the formula + + + For new formula, select {'"'}create new{'"'} + + + + Select the Plotter + + + For new plotter, select {'"'}create new{'"'} + ); } diff --git a/client/src/Components/Event/Create/index.js b/client/src/Components/Event/Create/index.js index 9def0ded7..ee979cb1d 100644 --- a/client/src/Components/Event/Create/index.js +++ b/client/src/Components/Event/Create/index.js @@ -44,6 +44,8 @@ class Create extends React.Component { description: '', startDatetime: DateTime.local().plus({ days: 1 }).startOf('day'), finishDatetime: DateTime.local().plus({ days: 8 }).startOf('day'), + formulaId: '', + plotterId: '', }; } @@ -62,6 +64,8 @@ class Create extends React.Component { startDatetime, finishDatetime, value, + formulaId, + plotterId, } = this.state; const { classes } = this.props; return ( @@ -136,7 +140,15 @@ class Create extends React.Component { edit={(newType, newVal) => this.handleEventChange(newType, newVal)} /> } - {value === 1 && } + {value === 1 && + this.handleEventChange(newType, newVal)} + /> + } {value === 2 && } {value === 3 && } From 3921e32534890fbaa74ae8e45b16141dd1959d09 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 15:55:14 +0100 Subject: [PATCH 26/33] Connecting selects with state --- .../Components/Event/Create/Tabs/Technical.js | 22 +++++++++---------- client/src/Components/Event/Create/styles.js | 3 +++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/client/src/Components/Event/Create/Tabs/Technical.js b/client/src/Components/Event/Create/Tabs/Technical.js index 389c237e7..a463b151d 100644 --- a/client/src/Components/Event/Create/Tabs/Technical.js +++ b/client/src/Components/Event/Create/Tabs/Technical.js @@ -15,7 +15,7 @@ import styles from '../styles'; class Technical extends React.Component { render() { - const { classes } = this.props; + const { classes, event, edit } = this.props; return ( @@ -26,36 +26,36 @@ class Technical extends React.Component { Select the formula } displayEmpty - name='select' className={classes.selectEmpty} + onChange={newVal => edit('formulaId', newVal.target.value)} > moi toi nous - For new formula, select {'"'}create new{'"'} + console.log('Comming soon in a modaal')}> + To create a new formula, click here + Select the Plotter } displayEmpty - name='select' className={classes.selectEmpty} + onChange={newVal => edit('plotterId', newVal.target.value)} > moi toi nous - For new plotter, select {'"'}create new{'"'} + To create a new plotter, click here ); diff --git a/client/src/Components/Event/Create/styles.js b/client/src/Components/Event/Create/styles.js index 150cf362d..9d5460326 100644 --- a/client/src/Components/Event/Create/styles.js +++ b/client/src/Components/Event/Create/styles.js @@ -10,6 +10,9 @@ const styles = theme => ({ width: '25%', maxWidth: 'none', }, + clickable: { + cursor: 'pointer', + }, card: { flexGrow: 1, padding: 20, From 881a4754a02b11761fc146ecae9aa85885418c0d Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 16:28:05 +0100 Subject: [PATCH 27/33] populating selects from graphql queries --- .../Components/Event/Create/Tabs/Technical.js | 91 ++++++++++++++----- client/src/GraphQL/Calls/getOptions.js | 31 +++++++ client/src/GraphQL/Calls/index.js | 2 + 3 files changed, 101 insertions(+), 23 deletions(-) create mode 100644 client/src/GraphQL/Calls/getOptions.js diff --git a/client/src/Components/Event/Create/Tabs/Technical.js b/client/src/Components/Event/Create/Tabs/Technical.js index a463b151d..56bdf46f9 100644 --- a/client/src/Components/Event/Create/Tabs/Technical.js +++ b/client/src/Components/Event/Create/Tabs/Technical.js @@ -1,4 +1,6 @@ import React from 'react'; +import { Query } from 'react-apollo'; + import { Typography, FormControl, @@ -8,10 +10,11 @@ import { FormHelperText, MenuItem, } from '@material-ui/core'; - import { withStyles } from '@material-ui/core/styles'; import styles from '../styles'; +import { getOptionsCalls } from '../../../../GraphQL/Calls/index'; + class Technical extends React.Component { render() { @@ -25,17 +28,38 @@ class Technical extends React.Component { Select the formula - + + {({ loading, error, data }) => { + if (loading) { + return ( + + ); + } + if (error) return `Error! ${error.message}`; + const selects = data.events_Formulas.map((formula, index) => ( + {formula.name} + )); + return ( + + ); + }} + console.log('Comming soon in a modaal')}> To create a new formula, click here @@ -44,17 +68,38 @@ class Technical extends React.Component { Select the Plotter - + + {({ loading, error, data }) => { + if (loading) { + return ( + + ); + } + if (error) return `Error! ${error.message}`; + const selects = data.events_Plotters.map((plotter, index) => ( + {plotter.name} + )); + return ( + + ); + }} + To create a new plotter, click here diff --git a/client/src/GraphQL/Calls/getOptions.js b/client/src/GraphQL/Calls/getOptions.js new file mode 100644 index 000000000..f7bd3edf0 --- /dev/null +++ b/client/src/GraphQL/Calls/getOptions.js @@ -0,0 +1,31 @@ +import gql from 'graphql-tag'; + +const EVENTS_FORMULAS = gql` + query Events_Formulas{ + events_Formulas { + id + ownerId + isTemplate + name + } + } +`; + +const EVENTS_PLOTTERS = gql` + query Events_Plotters{ + events_Plotters { + id + ownerId + isTemplate + name + host + repo + moduleName + } + } +`; + +export default { + EVENTS_PLOTTERS, + EVENTS_FORMULAS, +}; diff --git a/client/src/GraphQL/Calls/index.js b/client/src/GraphQL/Calls/index.js index 334af1c78..b8225b64b 100644 --- a/client/src/GraphQL/Calls/index.js +++ b/client/src/GraphQL/Calls/index.js @@ -1,9 +1,11 @@ import hostedEventsCalls from './hostedEvents'; import listEventsCalls from './listEvents'; import showEventCalls from './showEvent'; +import getOptionsCalls from './getOptions'; export { hostedEventsCalls, listEventsCalls, showEventCalls, + getOptionsCalls, }; From 6d83c37bf19db714a54a13e827326ef658bde2b8 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 16:40:23 +0100 Subject: [PATCH 28/33] creating migrations and setting up fragments --- client/src/GraphQL/Calls/getOptions.js | 36 +++++++++++++++++-------- client/src/GraphQL/Fragments/index.js | 6 +++++ client/src/GraphQL/Fragments/options.js | 22 +++++++++++++++ 3 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 client/src/GraphQL/Fragments/options.js diff --git a/client/src/GraphQL/Calls/getOptions.js b/client/src/GraphQL/Calls/getOptions.js index f7bd3edf0..cb9dfa700 100644 --- a/client/src/GraphQL/Calls/getOptions.js +++ b/client/src/GraphQL/Calls/getOptions.js @@ -1,31 +1,45 @@ import gql from 'graphql-tag'; +import { formulaInfo, plotterInfo } from '../Fragments'; const EVENTS_FORMULAS = gql` query Events_Formulas{ events_Formulas { - id - ownerId - isTemplate - name + ...FormulaInfo } } + ${formulaInfo} `; const EVENTS_PLOTTERS = gql` query Events_Plotters{ events_Plotters { - id - ownerId - isTemplate - name - host - repo - moduleName + ...PlotterInfo } } + ${plotterInfo} +`; + +const EVENTS_CREATEFORMULA = gql` + mutation Events_CreateEvent($event:events_EventInput!) { + events_CreateEvent(event: $event) { + ...FormulaInfo + } + } + ${formulaInfo} +`; + +const EVENTS_CREATEPLOTTER = gql` + mutation Events_CreatePlotter($plotter:events_PlotterInput!) { + events_CreatePlotter(plotter: $plotter) { + ...PlotterInfo + } + } + ${plotterInfo} `; export default { EVENTS_PLOTTERS, EVENTS_FORMULAS, + EVENTS_CREATEFORMULA, + EVENTS_CREATEPLOTTER, }; diff --git a/client/src/GraphQL/Fragments/index.js b/client/src/GraphQL/Fragments/index.js index cb2ce691c..a28f9ce7c 100644 --- a/client/src/GraphQL/Fragments/index.js +++ b/client/src/GraphQL/Fragments/index.js @@ -2,8 +2,14 @@ import { eventMinimalInfo, eventFullInfo, } from './event'; +import { + formulaInfo, + plotterInfo, +} from './options'; export { eventMinimalInfo, eventFullInfo, + formulaInfo, + plotterInfo, }; diff --git a/client/src/GraphQL/Fragments/options.js b/client/src/GraphQL/Fragments/options.js new file mode 100644 index 000000000..c25a82d08 --- /dev/null +++ b/client/src/GraphQL/Fragments/options.js @@ -0,0 +1,22 @@ +import gql from 'graphql-tag'; + +export const plotterInfo = gql` + fragment PlotterInfo on events_Plotter { + id + ownerId + isTemplate + name + host + repo + moduleName + } +`; + +export const formulaInfo = gql` + fragment FormulaInfo on events_Formula { + id + ownerId + isTemplate + name + } +`; From b890bfc4729c8a361cb2d1744851ae42884c193d Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Wed, 7 Nov 2018 13:53:12 +0100 Subject: [PATCH 29/33] Removing the internal BrowserRouter --- client/src/Components/Event/Create/index.js | 2 +- client/src/Components/HostedEvents/Event.js | 4 ++-- client/src/Components/Search/Event.js | 2 +- client/src/Components/TopBar/data.js | 8 +++---- client/src/index.js | 24 +++++++++------------ 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/client/src/Components/Event/Create/index.js b/client/src/Components/Event/Create/index.js index ee979cb1d..add8dd232 100644 --- a/client/src/Components/Event/Create/index.js +++ b/client/src/Components/Event/Create/index.js @@ -71,7 +71,7 @@ class Create extends React.Component { return ( { - this.props.history.push(`/edit/${data.events_CreateEvent.id}`); + this.props.history.push(`/events/edit/${data.events_CreateEvent.id}`); } } > diff --git a/client/src/Components/HostedEvents/Event.js b/client/src/Components/HostedEvents/Event.js index 4ba395132..bab987a59 100644 --- a/client/src/Components/HostedEvents/Event.js +++ b/client/src/Components/HostedEvents/Event.js @@ -50,7 +50,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={`/edit/${id}`} + to={`/events/edit/${id}`} > Edit @@ -60,7 +60,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={`/show/${id}`} + to={`/events/show/${id}`} > Show diff --git a/client/src/Components/Search/Event.js b/client/src/Components/Search/Event.js index 43c72f0ec..1736098ee 100644 --- a/client/src/Components/Search/Event.js +++ b/client/src/Components/Search/Event.js @@ -50,7 +50,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={`/show/${id}`} + to={`/events/show/${id}`} > Show diff --git a/client/src/Components/TopBar/data.js b/client/src/Components/TopBar/data.js index 5077584e1..89c775f60 100644 --- a/client/src/Components/TopBar/data.js +++ b/client/src/Components/TopBar/data.js @@ -7,16 +7,16 @@ import { const data = [ { - title: 'Look for an event', to: '/', icon: Search, text: '', + title: 'Look for an event', to: '/events/', icon: Search, text: '', }, { - title: 'Events you are enrolled in', to: '/my', icon: GamepadRounded, text: '', + title: 'Events you are enrolled in', to: '/events/my', icon: GamepadRounded, text: '', }, { - title: 'Your hosted competition', to: '/host', icon: AccessibilityNew, text: '', + title: 'Your hosted competition', to: '/events/host', icon: AccessibilityNew, text: '', }, { - title: 'Host a new competition', to: '/create', icon: LibraryAdd, text: '', + title: 'Host a new competition', to: '/events/create', icon: LibraryAdd, text: '', }, ]; diff --git a/client/src/index.js b/client/src/index.js index 63d02671a..778b76313 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { Route, BrowserRouter, Switch } from 'react-router-dom'; +import { Route, Switch } from 'react-router-dom'; import { MuiPickersUtilsProvider } from 'material-ui-pickers'; import LuxonUtils from 'material-ui-pickers/utils/luxon-utils'; @@ -39,19 +39,15 @@ class App extends Component { } return ( - -
- {loggedIn} - - - - - - - - -
-
+ {loggedIn} + + + + + + + +
); } From 847f5bc76ec7a2c08c87580e49b17ebd94c6bd8b Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Wed, 7 Nov 2018 14:06:44 +0100 Subject: [PATCH 30/33] Adding a create button on the second tab --- client/src/Components/Event/Create/Tabs/Technical.js | 9 +++++++++ client/src/Components/Event/Create/index.js | 2 ++ 2 files changed, 11 insertions(+) diff --git a/client/src/Components/Event/Create/Tabs/Technical.js b/client/src/Components/Event/Create/Tabs/Technical.js index 56bdf46f9..29607dd42 100644 --- a/client/src/Components/Event/Create/Tabs/Technical.js +++ b/client/src/Components/Event/Create/Tabs/Technical.js @@ -9,6 +9,8 @@ import { Select, FormHelperText, MenuItem, + Grid, + Button, } from '@material-ui/core'; import { withStyles } from '@material-ui/core/styles'; import styles from '../styles'; @@ -102,6 +104,13 @@ class Technical extends React.Component { To create a new plotter, click here + + + + + ); } diff --git a/client/src/Components/Event/Create/index.js b/client/src/Components/Event/Create/index.js index add8dd232..f281854c0 100644 --- a/client/src/Components/Event/Create/index.js +++ b/client/src/Components/Event/Create/index.js @@ -124,6 +124,8 @@ class Create extends React.Component { description, startDatetime: startDatetime.valueOf() / 1000, finishDatetime: finishDatetime.valueOf() / 1000, + formulaId, + plotterId, }, }, }); From a703a5cc4554a4f20d06ab18d056d289eab04b80 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Wed, 7 Nov 2018 16:05:34 +0100 Subject: [PATCH 31/33] updating mutations --- client/src/GraphQL/Calls/getOptions.js | 6 +++--- client/src/GraphQL/Calls/hostedEvents.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/GraphQL/Calls/getOptions.js b/client/src/GraphQL/Calls/getOptions.js index cb9dfa700..979ab6d2b 100644 --- a/client/src/GraphQL/Calls/getOptions.js +++ b/client/src/GraphQL/Calls/getOptions.js @@ -20,8 +20,8 @@ const EVENTS_PLOTTERS = gql` `; const EVENTS_CREATEFORMULA = gql` - mutation Events_CreateEvent($event:events_EventInput!) { - events_CreateEvent(event: $event) { + mutation Events_CreateFormula($formula: events_FormulaInput!) { + events_CreateFormula(formula: $formula) { ...FormulaInfo } } @@ -29,7 +29,7 @@ const EVENTS_CREATEFORMULA = gql` `; const EVENTS_CREATEPLOTTER = gql` - mutation Events_CreatePlotter($plotter:events_PlotterInput!) { + mutation Events_CreatePlotter($plotter: events_PlotterInput!) { events_CreatePlotter(plotter: $plotter) { ...PlotterInfo } diff --git a/client/src/GraphQL/Calls/hostedEvents.js b/client/src/GraphQL/Calls/hostedEvents.js index 2fe4460be..563a9db2b 100644 --- a/client/src/GraphQL/Calls/hostedEvents.js +++ b/client/src/GraphQL/Calls/hostedEvents.js @@ -2,7 +2,7 @@ import gql from 'graphql-tag'; import { eventMinimalInfo } from '../Fragments'; const EVENTS_CREATEEVENT = gql` - mutation Events_CreateEvent($event:events_EventInput!) { + mutation Events_CreateEvent($event: events_EventInput!) { events_CreateEvent(event: $event) { ...EventMinimalInfo } From f3ee4745816b38bba4124f6ab6992ea8e49ae3ea Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Wed, 7 Nov 2018 16:45:33 +0100 Subject: [PATCH 32/33] Implementing mutation to create new plotter and formula --- .../Event/Create/Tabs/Technical/NewFormula.js | 80 +++++++++++++ .../Event/Create/Tabs/Technical/NewPlotter.js | 110 ++++++++++++++++++ .../Tabs/{Technical.js => Technical/index.js} | 67 +++++++---- 3 files changed, 235 insertions(+), 22 deletions(-) create mode 100644 client/src/Components/Event/Create/Tabs/Technical/NewFormula.js create mode 100644 client/src/Components/Event/Create/Tabs/Technical/NewPlotter.js rename client/src/Components/Event/Create/Tabs/{Technical.js => Technical/index.js} (64%) diff --git a/client/src/Components/Event/Create/Tabs/Technical/NewFormula.js b/client/src/Components/Event/Create/Tabs/Technical/NewFormula.js new file mode 100644 index 000000000..11ef9356b --- /dev/null +++ b/client/src/Components/Event/Create/Tabs/Technical/NewFormula.js @@ -0,0 +1,80 @@ +import React from 'react'; +import { + Dialog, + DialogTitle, + DialogContent, + DialogContentText, + Button, + TextField, +} from '@material-ui/core'; + +import { Mutation } from 'react-apollo'; +import { getOptionsCalls } from '../../../../../GraphQL/Calls/index'; + +class NewFormula extends React.Component { + constructor() { + super(); + this.state = { name: '' }; + } + + render() { + const { name } = this.state; + return ( + this.props.closeDialogs()} + aria-labelledby='createFormula-dialog-title' + > + + Create a new formula + + + + At least for now, all the formulas are publically available, creating it here will let you select it in the select element. + + + { + const { events_Formulas: formulas } = store.readQuery({ + query: getOptionsCalls.EVENTS_FORMULAS, + }); + store.writeQuery({ + query: getOptionsCalls.EVENTS_FORMULAS, + data: { events_Formulas: formulas.concat([data.events_CreateFormula]) }, + }); + this.props.closeDialogs(); + } + } + > + {createFormula => ( +
+
{ + e.preventDefault(); + createFormula({ + variables: { + formula: { name }, + }, + }); + }} + > + this.setState({ name: e.target.value })} + fullWidth + /> + + +
+ )} +
+ + +
+
+ ); + } +} + +export default NewFormula; diff --git a/client/src/Components/Event/Create/Tabs/Technical/NewPlotter.js b/client/src/Components/Event/Create/Tabs/Technical/NewPlotter.js new file mode 100644 index 000000000..2aeeb50b5 --- /dev/null +++ b/client/src/Components/Event/Create/Tabs/Technical/NewPlotter.js @@ -0,0 +1,110 @@ +import React from 'react'; +import { + Dialog, + DialogTitle, + DialogContent, + DialogContentText, + Button, + TextField, +} from '@material-ui/core'; + +import { Mutation } from 'react-apollo'; +import { getOptionsCalls } from '../../../../../GraphQL/Calls/index'; + +class NewPlotter extends React.Component { + constructor() { + super(); + this.state = { + name: '', + host: '', + repo: '', + moduleName: '', + }; + } + + render() { + const { + name, host, repo, moduleName, + } = this.state; + return ( + this.props.closeDialogs()} + aria-labelledby='createPlotter-dialog-title' + > + + Create a new plotter + + + + At least for now, all the plotters are publically available, creating it here will let you select it in the select element. + + + { + const { events_Plotters: plotters } = store.readQuery({ + query: getOptionsCalls.EVENTS_PLOTTERS, + }); + store.writeQuery({ + query: getOptionsCalls.EVENTS_PLOTTERS, + data: { events_Plotters: plotters.concat([data.events_CreatePlotter]) }, + }); + this.props.closeDialogs(); + } + } + > + {createPlotter => ( +
+
{ + e.preventDefault(); + createPlotter({ + variables: { + plotter: { + name, + host, + repo, + moduleName, + }, + }, + }); + }} + > + this.setState({ name: e.target.value })} + fullWidth + /> + this.setState({ host: e.target.value })} + fullWidth + /> + this.setState({ repo: e.target.value })} + fullWidth + /> + this.setState({ moduleName: e.target.value })} + fullWidth + /> + + +
+ )} +
+ + +
+
+ ); + } +} + +export default NewPlotter; diff --git a/client/src/Components/Event/Create/Tabs/Technical.js b/client/src/Components/Event/Create/Tabs/Technical/index.js similarity index 64% rename from client/src/Components/Event/Create/Tabs/Technical.js rename to client/src/Components/Event/Create/Tabs/Technical/index.js index 29607dd42..438ad27f9 100644 --- a/client/src/Components/Event/Create/Tabs/Technical.js +++ b/client/src/Components/Event/Create/Tabs/Technical/index.js @@ -13,14 +13,29 @@ import { Button, } from '@material-ui/core'; import { withStyles } from '@material-ui/core/styles'; -import styles from '../styles'; +import styles from '../../styles'; -import { getOptionsCalls } from '../../../../GraphQL/Calls/index'; +import { getOptionsCalls } from '../../../../../GraphQL/Calls/index'; +import NewPlotter from './NewPlotter'; +import NewFormula from './NewFormula'; class Technical extends React.Component { + constructor(props) { + super(props); + this.state = { + isNewFormulaOpen: false, + isNewPlotterOpen: false, + }; + } + + closeDialogs = () => { + this.setState({ isNewFormulaOpen: false, isNewPlotterOpen: false }); + } + render() { const { classes, event, edit } = this.props; + const { isNewPlotterOpen, isNewFormulaOpen } = this.state; return ( @@ -50,19 +65,22 @@ class Technical extends React.Component { {formula.name} )); return ( - + + + { isNewFormulaOpen ? this.closeDialogs()} /> : ''} + ); }} - console.log('Comming soon in a modaal')}> + { this.setState({ isNewFormulaOpen: true }); }}> To create a new formula, click here @@ -90,19 +108,24 @@ class Technical extends React.Component { {plotter.name} )); return ( - + + + { isNewPlotterOpen ? this.closeDialogs()} /> : ''} + ); }} - To create a new plotter, click here + { this.setState({ isNewPlotterOpen: true }); }} > + To create a new plotter, click here + From 2a8aa2e095536f859391c0ac601f9b16563dbb06 Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Wed, 7 Nov 2018 16:56:55 +0100 Subject: [PATCH 33/33] Adding sortable-hoc package to dependency --- client/package-lock.json | 31 +++++++++++++++++++++++++++++++ client/package.json | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/client/package-lock.json b/client/package-lock.json index 839c3b060..a0e36fd6a 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -443,6 +443,27 @@ "eslint-visitor-keys": "^1.0.0" } }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -2251,6 +2272,16 @@ "warning": "^4.0.1" } }, + "react-sortable-hoc": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/react-sortable-hoc/-/react-sortable-hoc-0.8.3.tgz", + "integrity": "sha512-vt2qQ9DnPLjGZ9osM2jBULdi7WfFXtYVuHvjHX8o2em7Rcla9FXIG60aWFbvvpFC1iXyATw5PWZX0B57EUOYfQ==", + "requires": { + "babel-runtime": "^6.11.6", + "invariant": "^2.2.1", + "prop-types": "^15.5.7" + } + }, "react-text-mask": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/react-text-mask/-/react-text-mask-5.4.1.tgz", diff --git a/client/package.json b/client/package.json index c02059c10..2f3803efb 100644 --- a/client/package.json +++ b/client/package.json @@ -32,6 +32,7 @@ "react": "^16.5.2", "react-apollo": "^2.2.4", "react-dom": "^16.6.0", - "react-router-dom": "^4.3.1" + "react-router-dom": "^4.3.1", + "react-sortable-hoc": "^0.8.3" } }