From 0268a4cc865ccab21ae85e8717b8a38655a8f345 Mon Sep 17 00:00:00 2001 From: leonnicolas Date: Fri, 4 Dec 2020 11:12:11 +0100 Subject: [PATCH 1/3] .dockeringore + package-lock --- .gitignore | 3 +- package-lock.json | 163 ---------------------------------------------- 2 files changed, 2 insertions(+), 164 deletions(-) diff --git a/.gitignore b/.gitignore index e59baa1..88b8525 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules dist .env .idea -.nyc_output \ No newline at end of file +.nyc_output +.dockerignore diff --git a/package-lock.json b/package-lock.json index bbd8fbf..c0ef573 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1237,169 +1237,6 @@ "zen-observable-ts": "^0.8.21" } }, - "apollo-reporting-protobuf": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/apollo-reporting-protobuf/-/apollo-reporting-protobuf-0.6.1.tgz", - "integrity": "sha512-qr4DheFP154PGZsd93SSIS9RkqHnR5b6vT+eCloWjy3UIpY+yZ3cVLlttlIjYvOG4xTJ25XEwcHiAExatQo/7g==", - "requires": { - "@apollo/protobufjs": "^1.0.3" - } - }, - "apollo-server": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/apollo-server/-/apollo-server-2.19.0.tgz", - "integrity": "sha512-CchLtSwgm6NxQPvOXcMaxp8ckQT2ryLqdWIxjs2e+lCZ15tDsbqyPE+jVmqQKs9rsQNKnTwkMRdqmXqTciFJ8Q==", - "requires": { - "apollo-server-core": "^2.19.0", - "apollo-server-express": "^2.19.0", - "express": "^4.0.0", - "graphql-subscriptions": "^1.0.0", - "graphql-tools": "^4.0.0" - }, - "dependencies": { - "@types/cors": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.8.tgz", - "integrity": "sha512-fO3gf3DxU2Trcbr75O7obVndW/X5k8rJNZkLXlQWStTHhP71PkRqjwPIEI0yMnJdg9R9OasjU+Bsr+Hr1xy/0w==", - "requires": { - "@types/express": "*" - } - }, - "@types/express": { - "version": "4.17.7", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.7.tgz", - "integrity": "sha512-dCOT5lcmV/uC2J9k0rPafATeeyz+99xTt54ReX11/LObZgfzJqZNcW27zGhYyX+9iSEGXGt5qLPwRSvBZcLvtQ==", - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "*", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.13.tgz", - "integrity": "sha512-RgDi5a4nuzam073lRGKTUIaL3eF2+H7LJvJ8eUnCI0wA6SNjXc44DCmWNiTLs/AZ7QlsFWZiw/gTG3nSQGL0fA==", - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, - "apollo-cache-control": { - "version": "0.11.4", - "resolved": "https://registry.npmjs.org/apollo-cache-control/-/apollo-cache-control-0.11.4.tgz", - "integrity": "sha512-FUKE8ASr8GxVq5rmky/tY8bsf++cleGT591lfLiqnPsP1fo3kAfgRfWA2QRHTCKFNlQxzUhVOEDv+PaysqiOjw==", - "requires": { - "apollo-server-env": "^2.4.5", - "apollo-server-plugin-base": "^0.10.2" - } - }, - "apollo-graphql": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/apollo-graphql/-/apollo-graphql-0.6.0.tgz", - "integrity": "sha512-BxTf5LOQe649e9BNTPdyCGItVv4Ll8wZ2BKnmiYpRAocYEXAVrQPWuSr3dO4iipqAU8X0gvle/Xu9mSqg5b7Qg==", - "requires": { - "apollo-env": "^0.6.5", - "lodash.sortby": "^4.7.0" - } - }, - "apollo-server-core": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-2.19.0.tgz", - "integrity": "sha512-2aMKUVPyNbomJQaG2tkpfqvp1Tfgxgkdr7nX5zHudYNSzsPrHw+CcYlCbIVFFI/mTZsjoK9czNq1qerFRxZbJw==", - "requires": { - "@apollographql/apollo-tools": "^0.4.3", - "@apollographql/graphql-playground-html": "1.6.26", - "@types/graphql-upload": "^8.0.0", - "@types/ws": "^7.0.0", - "apollo-cache-control": "^0.11.4", - "apollo-datasource": "^0.7.2", - "apollo-graphql": "^0.6.0", - "apollo-reporting-protobuf": "^0.6.1", - "apollo-server-caching": "^0.5.2", - "apollo-server-env": "^2.4.5", - "apollo-server-errors": "^2.4.2", - "apollo-server-plugin-base": "^0.10.2", - "apollo-server-types": "^0.6.1", - "apollo-tracing": "^0.12.0", - "async-retry": "^1.2.1", - "fast-json-stable-stringify": "^2.0.0", - "graphql-extensions": "^0.12.6", - "graphql-tag": "^2.9.2", - "graphql-tools": "^4.0.0", - "graphql-upload": "^8.0.2", - "loglevel": "^1.6.7", - "lru-cache": "^5.0.0", - "sha.js": "^2.4.11", - "subscriptions-transport-ws": "^0.9.11", - "uuid": "^8.0.0", - "ws": "^6.0.0" - } - }, - "apollo-server-express": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-2.19.0.tgz", - "integrity": "sha512-3rgSrTme1SlLoecAYtSa8ThH6vYvz29QecgZCigq5Vdc6bFP2SZrCk0ls6BAdD8OZbVKUtizzRxd0yd/uREPAw==", - "requires": { - "@apollographql/graphql-playground-html": "1.6.26", - "@types/accepts": "^1.3.5", - "@types/body-parser": "1.19.0", - "@types/cors": "2.8.8", - "@types/express": "4.17.7", - "@types/express-serve-static-core": "4.17.13", - "accepts": "^1.3.5", - "apollo-server-core": "^2.19.0", - "apollo-server-types": "^0.6.1", - "body-parser": "^1.18.3", - "cors": "^2.8.4", - "express": "^4.17.1", - "graphql-subscriptions": "^1.0.0", - "graphql-tools": "^4.0.0", - "parseurl": "^1.3.2", - "subscriptions-transport-ws": "^0.9.16", - "type-is": "^1.6.16" - } - }, - "apollo-server-plugin-base": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/apollo-server-plugin-base/-/apollo-server-plugin-base-0.10.2.tgz", - "integrity": "sha512-uM5uL1lOxbXdgvt/aEIbgs40fV9xA45Y3Mmh0VtQ/ddqq0MXR5aG92nnf8rM+URarBCUfxKJKaYzJJ/CXAnEdA==", - "requires": { - "apollo-server-types": "^0.6.1" - } - }, - "apollo-server-types": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/apollo-server-types/-/apollo-server-types-0.6.1.tgz", - "integrity": "sha512-IEQ37aYvMLiTUzsySVLOSuvvhxuyYdhI05f3cnH6u2aN1HgGp7vX6bg+U3Ue8wbHfdcifcGIk5UEU+Q+QO6InA==", - "requires": { - "apollo-reporting-protobuf": "^0.6.1", - "apollo-server-caching": "^0.5.2", - "apollo-server-env": "^2.4.5" - } - }, - "apollo-tracing": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/apollo-tracing/-/apollo-tracing-0.12.0.tgz", - "integrity": "sha512-cMUYGE6mOEwb9HDqhf4fiPEo2JMhjPIqEprAQEC57El76avRpRig5NM0bnqMZcYJZR5QmLlNcttNccOwf9WrNg==", - "requires": { - "apollo-server-env": "^2.4.5", - "apollo-server-plugin-base": "^0.10.2" - } - }, - "graphql-extensions": { - "version": "0.12.6", - "resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.12.6.tgz", - "integrity": "sha512-EUNw+OIRXYTPxToSoJjhJvS5aGa94KkdkZnL1I9DCZT64/+rzQNeLeGj+goj2RYuYvoQe1Bmcx0CNZ1GqwBhng==", - "requires": { - "@apollographql/apollo-tools": "^0.4.3", - "apollo-server-env": "^2.4.5", - "apollo-server-types": "^0.6.1" - } - } - } - }, "apollo-server-caching": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/apollo-server-caching/-/apollo-server-caching-0.5.2.tgz", From 8121599fcd905878ce31817454d478f5ad610884 Mon Sep 17 00:00:00 2001 From: leonnicolas Date: Fri, 4 Dec 2020 11:56:10 +0100 Subject: [PATCH 2/3] README + src/app.ts: change env vars also set default parameters for databese and driver --- README.md | 2 +- src/app.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 682dd5f..cd25810 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,6 @@ POSTGRES_CONNECTION_URL=postgres://username:password@host:port/database_name ``` - __RPC_HOST__ is used for the connection with the [flotte-user-management server](https://github.com/fLotte-meets-HWR-DB/flotte-user-management). - __NODE_ENV__ will not check authentication if set to development -- __POSTGRES_CONNECTION_URL__ for connection with the postgres database +- __DATABASE_URL__ for connection with the postgres database If the API server cannot connect to the [flotte-user-management server](https://github.com/fLotte-meets-HWR-DB/flotte-user-management) or the postgres data base. It will try to reconnect in an endless loop. diff --git a/src/app.ts b/src/app.ts index 4eaceb4..9e5d13f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -62,9 +62,8 @@ require('dotenv').config(); export const userAPI = new UserServerAPI(process.env.RPC_HOST); export function getConnectionOptions (): ConnectionOptions { - return { - // @ts-ignore - type: process.env.DATABASE_TYPE, + const ret = { + type: (!process.env.DATABASE_TYPE) ? 'postgres' : process.env.DATABASE_TYPE, url: process.env.DATABASE_URL, database: process.env.DATABASE_NAME, entities: [ @@ -89,6 +88,11 @@ export function getConnectionOptions (): ConnectionOptions { synchronize: true, logging: false }; + if (ret.database === undefined) { + delete ret.database; + } + // @ts-ignore + return ret; } export async function getApp (connOptions: ConnectionOptions) { From 6cd60e33de77f9fd669a7ece46af6c347defd035 Mon Sep 17 00:00:00 2001 From: leonnicolas Date: Fri, 4 Dec 2020 13:13:08 +0100 Subject: [PATCH 3/3] src/schema: remove fields remove otherData from organisation --- src/schema/type-defs.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/schema/type-defs.ts b/src/schema/type-defs.ts index b55e6a8..7f6747f 100644 --- a/src/schema/type-defs.ts +++ b/src/schema/type-defs.ts @@ -828,7 +828,6 @@ export default gql` registeredAt: String provider: Provider contactInformation: ContactInformation - otherData: String isLocked: Boolean! isLockedByMe: Boolean! "null if not locked by other user" @@ -844,7 +843,6 @@ export default gql` "If Club, at what court registered" registeredAt: String contactInformationId: ID - otherData: String } input OrganisationUpdateInput { @@ -856,7 +854,6 @@ export default gql` "If Club, at what court registered" registeredAt: String contactInformationId: ID - otherData: String keepLock: Boolean }