From 43f2bbceeeeff7db7dc31aed7e8fd1a6f33ff9ce Mon Sep 17 00:00:00 2001 From: Barry Low Date: Wed, 12 Sep 2018 21:41:38 -0700 Subject: [PATCH] Server: Update resolver to use auth context --- api/.graphqlconfig.yml | 2 +- api/Dockerfile | 2 +- api/database/datamodel.graphql | 3 +- api/docker-compose.api.yml | 19 + api/docker-compose.yml | 19 - api/package-lock.json | 120 +- api/package.json | 2 +- api/src/auth/authDirectives.js | 44 +- api/src/auth/validateIdToken.js | 4 +- api/src/generated/prisma.graphql | 2327 +++++++++++++++++++ api/src/index.js | 84 +- api/src/{schema.graphqls => schema.graphql} | 35 +- client/src/views/index.js | 3 +- client/src/views/teams/index.js | 53 + docs/CodeStyle.md | 5 + 15 files changed, 2577 insertions(+), 145 deletions(-) create mode 100644 api/docker-compose.api.yml create mode 100644 api/src/generated/prisma.graphql rename api/src/{schema.graphqls => schema.graphql} (69%) create mode 100644 client/src/views/teams/index.js create mode 100644 docs/CodeStyle.md diff --git a/api/.graphqlconfig.yml b/api/.graphqlconfig.yml index a35fd2e44..d65be026a 100644 --- a/api/.graphqlconfig.yml +++ b/api/.graphqlconfig.yml @@ -4,7 +4,7 @@ projects: extensions: endpoints: dev1: - url: http://0.0.0.0:4000/graphql + url: http://localhost:4001/graphql database: schemaPath: src/generated/prisma.graphql diff --git a/api/Dockerfile b/api/Dockerfile index 0506ccdef..32704198c 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,6 +1,6 @@ FROM mhart/alpine-node:8 -ENV PORT=4000 +ENV PORT=4001 RUN mkdir -p /var/www/app && \ mkdir -p /var/www/app/node_modules diff --git a/api/database/datamodel.graphql b/api/database/datamodel.graphql index 0ba5945e1..7a55f466d 100644 --- a/api/database/datamodel.graphql +++ b/api/database/datamodel.graphql @@ -30,6 +30,7 @@ type Team { slug: String! @unique profile: TeamProfile members: [TeamMembers!]! @relation (name: "TeamMembers", onDelete: SET_NULL) + owner: String! wallet: Wallet fb: [FinancialBeings!]! @relation (name: "TeamFinancialBeing", onDelete: SET_NULL) status: [TeamStatus!]! @@ -59,7 +60,7 @@ type TeamMembers { type Member { id: ID! @unique - nickname: String + alias: String team: TeamMembers @relation (name: "MemberOnTeam", onDelete: SET_NULL) authId: String! @unique visible: Boolean! @default(value: true) diff --git a/api/docker-compose.api.yml b/api/docker-compose.api.yml new file mode 100644 index 000000000..689c37fa6 --- /dev/null +++ b/api/docker-compose.api.yml @@ -0,0 +1,19 @@ +version: '3' +services: + api: + image: aateamapi-dev:v1 + build: + context: . + dockerfile: ./Dockerfile + env_file: ./.env + container_name: aateamapi + tty: true + stdin_open: true + volumes: + - ./:/var/www/app + - /var/www/app/node_modules + working_dir: /var/www/app + restart: always + command: node -r dotenv/config src/index.js + ports: + - "4001:4001" diff --git a/api/docker-compose.yml b/api/docker-compose.yml index 37a6ee436..57dc62ef6 100644 --- a/api/docker-compose.yml +++ b/api/docker-compose.yml @@ -27,24 +27,5 @@ services: POSTGRES_PASSWORD: prisma volumes: - postgres:/var/lib/postgresql/data - node: - image: aateamapi-dev:v1 - build: - context: . - dockerfile: ./Dockerfile - depends_on: - - prisma - env_file: ./.env - container_name: aateamapi - tty: true - stdin_open: true - volumes: - - ./:/var/www/app - - /var/www/app/node_modules - working_dir: /var/www/app - restart: always - command: node -r dotenv/config src/index.js - ports: - - "4000:4000" volumes: postgres: diff --git a/api/package-lock.json b/api/package-lock.json index f49d52a1e..d43af47d4 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -568,7 +568,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -614,7 +614,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -923,7 +923,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1462,7 +1462,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -1492,9 +1492,9 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "config-chain": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.11.tgz", - "integrity": "sha1-q6CXR9++TD5w52am5BWG4YWfxvI=", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", "dev": true, "requires": { "ini": "^1.3.4", @@ -1640,7 +1640,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -4997,7 +4997,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -5366,7 +5366,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -6371,14 +6371,14 @@ "dev": true }, "prisma": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-1.15.3.tgz", - "integrity": "sha512-95s0Kk8PtptrVhp4ajXPd7A7QrbWdCEyZ/nnvcz0Sz9nzufYYZfBjxgibUyoaNs/XL0KXtiibQIdZhpWIJgOhw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-1.16.0.tgz", + "integrity": "sha512-8jZYCrkd1xjy+JJbQi81f8PBOLe8LLWwSu0fK0cqekm3FeafBd8xk5b0RWcIsHyVd6ypKCQt3tnZEMVzmbKrdQ==", "dev": true, "requires": { "fs-extra": "^5.0.0", - "prisma-cli-core": "1.0.75", - "prisma-cli-engine": "1.0.78", + "prisma-cli-core": "1.0.76", + "prisma-cli-engine": "1.0.79", "semver": "^5.4.1", "source-map-support": "^0.4.18" }, @@ -6497,9 +6497,9 @@ } }, "prisma-cli-core": { - "version": "1.0.75", - "resolved": "https://registry.npmjs.org/prisma-cli-core/-/prisma-cli-core-1.0.75.tgz", - "integrity": "sha512-DiH686w2u9aiz4RoNX3T0XgGzeai8IrXX/Qsocam+lKtBB63aupqCxbj6kp16sNoiXhDPzI2Zx/Hwm0GG9sUhw==", + "version": "1.0.76", + "resolved": "https://registry.npmjs.org/prisma-cli-core/-/prisma-cli-core-1.0.76.tgz", + "integrity": "sha512-HtHn/RM2GlJi23KoIXHoboP97aC54SYDqr7B4uT/80JP6A6nQp5HLt4sJgNfKapaHFZVzXYM7M3LEfGq3tgQbw==", "dev": true, "requires": { "adm-zip": "^0.4.7", @@ -6533,9 +6533,9 @@ "opn": "^5.1.0", "pause": "^0.1.0", "portfinder": "^1.0.13", - "prisma-db-introspection": "0.0.45", + "prisma-db-introspection": "0.0.46", "prisma-json-schema": "0.0.4", - "prisma-yml": "1.0.90", + "prisma-yml": "1.0.96", "scuid": "^1.0.2", "semver": "^5.4.1", "sillyname": "^0.1.0", @@ -6599,12 +6599,12 @@ } }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", + "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "dotenv": { @@ -6693,7 +6693,7 @@ }, "graphql-import": { "version": "0.4.5", - "resolved": "https://registry.npmjs.org/graphql-import/-/graphql-import-0.4.5.tgz", + "resolved": "http://registry.npmjs.org/graphql-import/-/graphql-import-0.4.5.tgz", "integrity": "sha512-G/+I08Qp6/QGTb9qapknCm3yPHV0ZL7wbaalWFpxsfR8ZhZoTBe//LsbsCKlbALQpcMegchpJhpTSKiJjhaVqQ==", "dev": true, "requires": { @@ -6766,12 +6766,6 @@ "regex-cache": "^0.4.2" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "prisma-json-schema": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/prisma-json-schema/-/prisma-json-schema-0.0.4.tgz", @@ -6779,9 +6773,9 @@ "dev": true }, "prisma-yml": { - "version": "1.0.90", - "resolved": "https://registry.npmjs.org/prisma-yml/-/prisma-yml-1.0.90.tgz", - "integrity": "sha512-i5qMN/p1YvLV931YgfJtUAaHO7nOL07oW/EqQ1AixBGRi9nB21TpZGy9b50TwunaMt8LfVYB5ER82338qrJA5g==", + "version": "1.0.96", + "resolved": "https://registry.npmjs.org/prisma-yml/-/prisma-yml-1.0.96.tgz", + "integrity": "sha512-w3XGzJHUq5pwBoFy/amkGOcTDj4XoHh8UFUUUZcHo5fSyoF8AWeRTu1yWINaPVGxbcmpwKNetntAW4ijiq7M5g==", "dev": true, "requires": { "ajv": "5", @@ -6828,9 +6822,9 @@ } }, "prisma-cli-engine": { - "version": "1.0.78", - "resolved": "https://registry.npmjs.org/prisma-cli-engine/-/prisma-cli-engine-1.0.78.tgz", - "integrity": "sha512-chtmecxBgXPQUzvDS0U/R+pHZ/nzV1ksO+OiKr98kT7dBR9QJQbRG0v/j+zoIW4vdR9eyIaXy5i+dW8HU8XnDg==", + "version": "1.0.79", + "resolved": "https://registry.npmjs.org/prisma-cli-engine/-/prisma-cli-engine-1.0.79.tgz", + "integrity": "sha512-CdEIJs4ld1IiQQt2CFFPmeDypN4Ct4sTgmFODVjJix790mpEtxMagzCcA+mhfnRL65P6xiHn76Gdxbz60GyYBA==", "dev": true, "requires": { "@heroku/linewrap": "^1.0.0", @@ -6873,7 +6867,7 @@ "memfs": "^2.5.3", "opn": "^5.1.0", "prisma-json-schema": "0.0.4", - "prisma-yml": "1.0.90", + "prisma-yml": "1.0.96", "raven": "2.3.0", "replaceall": "^0.1.6", "rwlockfile": "^1.4.8", @@ -6890,12 +6884,12 @@ }, "dependencies": { "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", + "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "dotenv": { @@ -6931,12 +6925,6 @@ "through": "^2.3.6" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "prisma-json-schema": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/prisma-json-schema/-/prisma-json-schema-0.0.4.tgz", @@ -6944,9 +6932,9 @@ "dev": true }, "prisma-yml": { - "version": "1.0.90", - "resolved": "https://registry.npmjs.org/prisma-yml/-/prisma-yml-1.0.90.tgz", - "integrity": "sha512-i5qMN/p1YvLV931YgfJtUAaHO7nOL07oW/EqQ1AixBGRi9nB21TpZGy9b50TwunaMt8LfVYB5ER82338qrJA5g==", + "version": "1.0.96", + "resolved": "https://registry.npmjs.org/prisma-yml/-/prisma-yml-1.0.96.tgz", + "integrity": "sha512-w3XGzJHUq5pwBoFy/amkGOcTDj4XoHh8UFUUUZcHo5fSyoF8AWeRTu1yWINaPVGxbcmpwKNetntAW4ijiq7M5g==", "dev": true, "requires": { "ajv": "5", @@ -7002,9 +6990,9 @@ } }, "prisma-db-introspection": { - "version": "0.0.45", - "resolved": "https://registry.npmjs.org/prisma-db-introspection/-/prisma-db-introspection-0.0.45.tgz", - "integrity": "sha512-tOdv4mBFZLVds1Wst92l2iarmzlxwFo/EFHs4kW1P0rR2My7BoxRgV0HSZy9xvo9gbU3P8e5JEZofMNrS+5v+g==", + "version": "0.0.46", + "resolved": "https://registry.npmjs.org/prisma-db-introspection/-/prisma-db-introspection-0.0.46.tgz", + "integrity": "sha512-/b7evS9b5xKS7UrcOERkCmV+IWC6OAgFtInFsvdwn4MeLEaVbkOfzRakdOo+t2gb+N7Yy8Eey9eKYgB5jiJAbA==", "dev": true, "requires": { "ajv": "5", @@ -7029,12 +7017,12 @@ }, "dependencies": { "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", + "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "dotenv": { @@ -7043,12 +7031,6 @@ "integrity": "sha1-hk7xN5rO1Vzm+V3r7NzhefegzR0=", "dev": true }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "prisma-json-schema": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/prisma-json-schema/-/prisma-json-schema-0.0.1.tgz", @@ -7608,7 +7590,7 @@ "dependencies": { "commander": { "version": "2.8.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.8.1.tgz", "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", "dev": true, "requires": { @@ -8196,7 +8178,7 @@ }, "table": { "version": "4.0.3", - "resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz", + "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", "dev": true, "requires": { @@ -8257,7 +8239,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -8522,7 +8504,7 @@ }, "buffer": { "version": "3.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-3.6.0.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-3.6.0.tgz", "integrity": "sha1-pyyTb3e5a/UvX357RnGAYoVR3vs=", "dev": true, "requires": { @@ -9105,7 +9087,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { diff --git a/api/package.json b/api/package.json index 9df8a2bf9..8bc857126 100644 --- a/api/package.json +++ b/api/package.json @@ -22,6 +22,6 @@ "devDependencies": { "graphql-cli": "^2.16.5", "npm-run-all": "4.1.3", - "prisma": "^1.14.0" + "prisma": "^1.16.0" } } diff --git a/api/src/auth/authDirectives.js b/api/src/auth/authDirectives.js index 56720ff10..f098fa4ec 100644 --- a/api/src/auth/authDirectives.js +++ b/api/src/auth/authDirectives.js @@ -1,6 +1,5 @@ const _get = require('lodash.get') -const validateAndParseIdToken = require('./helpers/validateAndParseIdToken') -const createMember = require('./index') +const { validateIdToken } = require('./validateIdToken') const memberLocationOnContext = 'request.member' const bearerAccessToken = 'request.headers.authorization' @@ -8,11 +7,29 @@ const bearerAccessToken = 'request.headers.authorization' const ctxMember = ctx => _get(ctx, memberLocationOnContext) const ctxToken = ctx => _get(ctx, bearerAccessToken) +const createMember = async (ctx, idToken, info) => { + console.log('createMember', idToken) + const member = await ctx.db.mutation.upsertMember({ + where: { + authId: idToken.sub, + }, + create: { + authId: idToken.sub, + alias: idToken.nickname + }, + update: { + authId: idToken.sub, + alias: idToken.nickname + } + }, info) + return member +} + const isLoggedIn = async ctx => { let member = ctxMember(ctx, memberLocationOnContext) let token = ctxToken(ctx, bearerAccessToken) let memberToken - + console.log('isLoggedIn: ', member, token) if (!member && token) { let scheme, credentials const tokenParts = token.split(' ') @@ -24,21 +41,28 @@ const isLoggedIn = async ctx => { if (/^Bearer$/i.test(scheme)) { token = credentials //verify token + console.log('isLoggedIn2 : ', token) try { - memberToken = await validateAndParseIdToken(token) - const auth0id = memberToken.sub + memberToken = await validateIdToken(token) + const authId = memberToken.sub + console.log('isLoggedIn3 : ', await authId, ctx.db.query.member) + exists = await ctx.db.query.member({ where: { authId: authId } }) + console.log('isLoggedIn4 : ', await exists, createMember ) + if (!member && exists === null) { + member = await createMember(ctx, memberToken).then(res => { + console.log('isLoggedIn5 : ', res) + return res + }) - member = await ctx.db.query.member({ where: { auth0id } }) - - if (!member) { - member = await createMember(ctx, memberToken) + return member } + return member } catch (err) { memberToken = false } } } - + console.log('isLoggedIn5 : ', await member) if (!member) { throw new Error(`Not logged in`) } diff --git a/api/src/auth/validateIdToken.js b/api/src/auth/validateIdToken.js index 25434c85f..dd0b794b3 100644 --- a/api/src/auth/validateIdToken.js +++ b/api/src/auth/validateIdToken.js @@ -7,7 +7,7 @@ const jwks = jwksClient({ jwksUri: `https://${process.env.AUTH0_DOMAIN}/.well-known/jwks.json` }) -const validateParseIdToken = idToken => +const validateIdToken = idToken => new Promise((resolve, reject) => { const { header, payload } = jwt.decode(idToken, { complete: true }) if (!header || !header.kid || !payload) reject(new Error('Invalid Token')) @@ -25,4 +25,4 @@ const validateParseIdToken = idToken => }) }) -module.exports = validateParseIdToken +module.exports = { validateIdToken } diff --git a/api/src/generated/prisma.graphql b/api/src/generated/prisma.graphql new file mode 100644 index 000000000..6d118e29a --- /dev/null +++ b/api/src/generated/prisma.graphql @@ -0,0 +1,2327 @@ +# source: http://localhost:4466 +# timestamp: Wed Sep 12 2018 08:41:57 GMT-0700 (Pacific Daylight Time) + +type AggregateFBStatus { + count: Int! +} + +type AggregateFinancialBeings { + count: Int! +} + +type AggregateMember { + count: Int! +} + +type AggregateMemberStatus { + count: Int! +} + +type AggregateTeam { + count: Int! +} + +type AggregateTeamMembers { + count: Int! +} + +type AggregateTeamProfile { + count: Int! +} + +type AggregateTeamStatus { + count: Int! +} + +type AggregateWallet { + count: Int! +} + +type BatchPayload { + """The number of nodes that have been affected by the Batch operation.""" + count: Long! +} + +scalar DateTime + +enum FBKind { + TRADER + INDICATOR + EXTRACTOR + PLOTTER +} + +type FBStatus { + status: Status + reason: String + createdAt: DateTime! +} + +"""A connection to a list of items.""" +type FBStatusConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [FBStatusEdge]! + aggregate: AggregateFBStatus! +} + +input FBStatusCreateInput { + status: Status + reason: String +} + +input FBStatusCreateManyInput { + create: [FBStatusCreateInput!] +} + +"""An edge in a connection.""" +type FBStatusEdge { + """The item at the end of the edge.""" + node: FBStatus! + + """A cursor for use in pagination.""" + cursor: String! +} + +enum FBStatusOrderByInput { + status_ASC + status_DESC + reason_ASC + reason_DESC + createdAt_ASC + createdAt_DESC + id_ASC + id_DESC + updatedAt_ASC + updatedAt_DESC +} + +type FBStatusPreviousValues { + status: Status + reason: String + createdAt: DateTime! +} + +type FBStatusSubscriptionPayload { + mutation: MutationType! + node: FBStatus + updatedFields: [String!] + previousValues: FBStatusPreviousValues +} + +input FBStatusSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [FBStatusSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [FBStatusSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [FBStatusSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: FBStatusWhereInput +} + +input FBStatusUpdateInput { + status: Status + reason: String +} + +input FBStatusUpdateManyInput { + create: [FBStatusCreateInput!] +} + +input FBStatusWhereInput { + """Logical AND on all given filters.""" + AND: [FBStatusWhereInput!] + + """Logical OR on all given filters.""" + OR: [FBStatusWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [FBStatusWhereInput!] + status: Status + + """All values that are not equal to given value.""" + status_not: Status + + """All values that are contained in given list.""" + status_in: [Status!] + + """All values that are not contained in given list.""" + status_not_in: [Status!] + reason: String + + """All values that are not equal to given value.""" + reason_not: String + + """All values that are contained in given list.""" + reason_in: [String!] + + """All values that are not contained in given list.""" + reason_not_in: [String!] + + """All values less than the given value.""" + reason_lt: String + + """All values less than or equal the given value.""" + reason_lte: String + + """All values greater than the given value.""" + reason_gt: String + + """All values greater than or equal the given value.""" + reason_gte: String + + """All values containing the given string.""" + reason_contains: String + + """All values not containing the given string.""" + reason_not_contains: String + + """All values starting with the given string.""" + reason_starts_with: String + + """All values not starting with the given string.""" + reason_not_starts_with: String + + """All values ending with the given string.""" + reason_ends_with: String + + """All values not ending with the given string.""" + reason_not_ends_with: String + createdAt: DateTime + + """All values that are not equal to given value.""" + createdAt_not: DateTime + + """All values that are contained in given list.""" + createdAt_in: [DateTime!] + + """All values that are not contained in given list.""" + createdAt_not_in: [DateTime!] + + """All values less than the given value.""" + createdAt_lt: DateTime + + """All values less than or equal the given value.""" + createdAt_lte: DateTime + + """All values greater than the given value.""" + createdAt_gt: DateTime + + """All values greater than or equal the given value.""" + createdAt_gte: DateTime +} + +enum FBType { + BOT + NET + ADVANCED +} + +type FinancialBeings implements Node { + id: ID! + type: FBType + kind: FBKind + team(where: TeamWhereInput): Team + status(where: FBStatusWhereInput, orderBy: FBStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [FBStatus!] + updatedAt: DateTime! + createdAt: DateTime! +} + +"""A connection to a list of items.""" +type FinancialBeingsConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [FinancialBeingsEdge]! + aggregate: AggregateFinancialBeings! +} + +input FinancialBeingsCreateInput { + type: FBType + kind: FBKind + team: TeamCreateOneWithoutFbInput + status: FBStatusCreateManyInput +} + +input FinancialBeingsCreateManyWithoutTeamInput { + create: [FinancialBeingsCreateWithoutTeamInput!] + connect: [FinancialBeingsWhereUniqueInput!] +} + +input FinancialBeingsCreateWithoutTeamInput { + type: FBType + kind: FBKind + status: FBStatusCreateManyInput +} + +"""An edge in a connection.""" +type FinancialBeingsEdge { + """The item at the end of the edge.""" + node: FinancialBeings! + + """A cursor for use in pagination.""" + cursor: String! +} + +enum FinancialBeingsOrderByInput { + id_ASC + id_DESC + type_ASC + type_DESC + kind_ASC + kind_DESC + updatedAt_ASC + updatedAt_DESC + createdAt_ASC + createdAt_DESC +} + +type FinancialBeingsPreviousValues { + id: ID! + type: FBType + kind: FBKind + updatedAt: DateTime! + createdAt: DateTime! +} + +type FinancialBeingsSubscriptionPayload { + mutation: MutationType! + node: FinancialBeings + updatedFields: [String!] + previousValues: FinancialBeingsPreviousValues +} + +input FinancialBeingsSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [FinancialBeingsSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [FinancialBeingsSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [FinancialBeingsSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: FinancialBeingsWhereInput +} + +input FinancialBeingsUpdateInput { + type: FBType + kind: FBKind + team: TeamUpdateOneWithoutFbInput + status: FBStatusUpdateManyInput +} + +input FinancialBeingsUpdateManyWithoutTeamInput { + create: [FinancialBeingsCreateWithoutTeamInput!] + connect: [FinancialBeingsWhereUniqueInput!] + disconnect: [FinancialBeingsWhereUniqueInput!] + delete: [FinancialBeingsWhereUniqueInput!] + update: [FinancialBeingsUpdateWithWhereUniqueWithoutTeamInput!] + upsert: [FinancialBeingsUpsertWithWhereUniqueWithoutTeamInput!] +} + +input FinancialBeingsUpdateWithoutTeamDataInput { + type: FBType + kind: FBKind + status: FBStatusUpdateManyInput +} + +input FinancialBeingsUpdateWithWhereUniqueWithoutTeamInput { + where: FinancialBeingsWhereUniqueInput! + data: FinancialBeingsUpdateWithoutTeamDataInput! +} + +input FinancialBeingsUpsertWithWhereUniqueWithoutTeamInput { + where: FinancialBeingsWhereUniqueInput! + update: FinancialBeingsUpdateWithoutTeamDataInput! + create: FinancialBeingsCreateWithoutTeamInput! +} + +input FinancialBeingsWhereInput { + """Logical AND on all given filters.""" + AND: [FinancialBeingsWhereInput!] + + """Logical OR on all given filters.""" + OR: [FinancialBeingsWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [FinancialBeingsWhereInput!] + id: ID + + """All values that are not equal to given value.""" + id_not: ID + + """All values that are contained in given list.""" + id_in: [ID!] + + """All values that are not contained in given list.""" + id_not_in: [ID!] + + """All values less than the given value.""" + id_lt: ID + + """All values less than or equal the given value.""" + id_lte: ID + + """All values greater than the given value.""" + id_gt: ID + + """All values greater than or equal the given value.""" + id_gte: ID + + """All values containing the given string.""" + id_contains: ID + + """All values not containing the given string.""" + id_not_contains: ID + + """All values starting with the given string.""" + id_starts_with: ID + + """All values not starting with the given string.""" + id_not_starts_with: ID + + """All values ending with the given string.""" + id_ends_with: ID + + """All values not ending with the given string.""" + id_not_ends_with: ID + type: FBType + + """All values that are not equal to given value.""" + type_not: FBType + + """All values that are contained in given list.""" + type_in: [FBType!] + + """All values that are not contained in given list.""" + type_not_in: [FBType!] + kind: FBKind + + """All values that are not equal to given value.""" + kind_not: FBKind + + """All values that are contained in given list.""" + kind_in: [FBKind!] + + """All values that are not contained in given list.""" + kind_not_in: [FBKind!] + updatedAt: DateTime + + """All values that are not equal to given value.""" + updatedAt_not: DateTime + + """All values that are contained in given list.""" + updatedAt_in: [DateTime!] + + """All values that are not contained in given list.""" + updatedAt_not_in: [DateTime!] + + """All values less than the given value.""" + updatedAt_lt: DateTime + + """All values less than or equal the given value.""" + updatedAt_lte: DateTime + + """All values greater than the given value.""" + updatedAt_gt: DateTime + + """All values greater than or equal the given value.""" + updatedAt_gte: DateTime + createdAt: DateTime + + """All values that are not equal to given value.""" + createdAt_not: DateTime + + """All values that are contained in given list.""" + createdAt_in: [DateTime!] + + """All values that are not contained in given list.""" + createdAt_not_in: [DateTime!] + + """All values less than the given value.""" + createdAt_lt: DateTime + + """All values less than or equal the given value.""" + createdAt_lte: DateTime + + """All values greater than the given value.""" + createdAt_gt: DateTime + + """All values greater than or equal the given value.""" + createdAt_gte: DateTime + team: TeamWhereInput + status_every: FBStatusWhereInput + status_some: FBStatusWhereInput + status_none: FBStatusWhereInput +} + +input FinancialBeingsWhereUniqueInput { + id: ID +} + +""" +The `Long` scalar type represents non-fractional signed whole numeric values. +Long can represent values between -(2^63) and 2^63 - 1. +""" +scalar Long + +type Member implements Node { + id: ID! + alias: String + team(where: TeamMembersWhereInput): TeamMembers + authId: String! + visible: Boolean! + createdAt: DateTime! +} + +"""A connection to a list of items.""" +type MemberConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [MemberEdge]! + aggregate: AggregateMember! +} + +input MemberCreateInput { + alias: String + authId: String! + visible: Boolean + team: TeamMembersCreateOneWithoutMemberInput +} + +input MemberCreateOneWithoutTeamInput { + create: MemberCreateWithoutTeamInput + connect: MemberWhereUniqueInput +} + +input MemberCreateWithoutTeamInput { + alias: String + authId: String! + visible: Boolean +} + +"""An edge in a connection.""" +type MemberEdge { + """The item at the end of the edge.""" + node: Member! + + """A cursor for use in pagination.""" + cursor: String! +} + +enum MemberOrderByInput { + id_ASC + id_DESC + alias_ASC + alias_DESC + authId_ASC + authId_DESC + visible_ASC + visible_DESC + createdAt_ASC + createdAt_DESC + updatedAt_ASC + updatedAt_DESC +} + +type MemberPreviousValues { + id: ID! + alias: String + authId: String! + visible: Boolean! + createdAt: DateTime! +} + +type MemberStatus { + status: Status + reason: String + createdAt: DateTime! +} + +"""A connection to a list of items.""" +type MemberStatusConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [MemberStatusEdge]! + aggregate: AggregateMemberStatus! +} + +input MemberStatusCreateInput { + status: Status + reason: String +} + +input MemberStatusCreateManyInput { + create: [MemberStatusCreateInput!] +} + +"""An edge in a connection.""" +type MemberStatusEdge { + """The item at the end of the edge.""" + node: MemberStatus! + + """A cursor for use in pagination.""" + cursor: String! +} + +enum MemberStatusOrderByInput { + status_ASC + status_DESC + reason_ASC + reason_DESC + createdAt_ASC + createdAt_DESC + id_ASC + id_DESC + updatedAt_ASC + updatedAt_DESC +} + +type MemberStatusPreviousValues { + status: Status + reason: String + createdAt: DateTime! +} + +type MemberStatusSubscriptionPayload { + mutation: MutationType! + node: MemberStatus + updatedFields: [String!] + previousValues: MemberStatusPreviousValues +} + +input MemberStatusSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [MemberStatusSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [MemberStatusSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [MemberStatusSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: MemberStatusWhereInput +} + +input MemberStatusUpdateInput { + status: Status + reason: String +} + +input MemberStatusUpdateManyInput { + create: [MemberStatusCreateInput!] +} + +input MemberStatusWhereInput { + """Logical AND on all given filters.""" + AND: [MemberStatusWhereInput!] + + """Logical OR on all given filters.""" + OR: [MemberStatusWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [MemberStatusWhereInput!] + status: Status + + """All values that are not equal to given value.""" + status_not: Status + + """All values that are contained in given list.""" + status_in: [Status!] + + """All values that are not contained in given list.""" + status_not_in: [Status!] + reason: String + + """All values that are not equal to given value.""" + reason_not: String + + """All values that are contained in given list.""" + reason_in: [String!] + + """All values that are not contained in given list.""" + reason_not_in: [String!] + + """All values less than the given value.""" + reason_lt: String + + """All values less than or equal the given value.""" + reason_lte: String + + """All values greater than the given value.""" + reason_gt: String + + """All values greater than or equal the given value.""" + reason_gte: String + + """All values containing the given string.""" + reason_contains: String + + """All values not containing the given string.""" + reason_not_contains: String + + """All values starting with the given string.""" + reason_starts_with: String + + """All values not starting with the given string.""" + reason_not_starts_with: String + + """All values ending with the given string.""" + reason_ends_with: String + + """All values not ending with the given string.""" + reason_not_ends_with: String + createdAt: DateTime + + """All values that are not equal to given value.""" + createdAt_not: DateTime + + """All values that are contained in given list.""" + createdAt_in: [DateTime!] + + """All values that are not contained in given list.""" + createdAt_not_in: [DateTime!] + + """All values less than the given value.""" + createdAt_lt: DateTime + + """All values less than or equal the given value.""" + createdAt_lte: DateTime + + """All values greater than the given value.""" + createdAt_gt: DateTime + + """All values greater than or equal the given value.""" + createdAt_gte: DateTime +} + +type MemberSubscriptionPayload { + mutation: MutationType! + node: Member + updatedFields: [String!] + previousValues: MemberPreviousValues +} + +input MemberSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [MemberSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [MemberSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [MemberSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: MemberWhereInput +} + +input MemberUpdateInput { + alias: String + authId: String + visible: Boolean + team: TeamMembersUpdateOneWithoutMemberInput +} + +input MemberUpdateOneWithoutTeamInput { + create: MemberCreateWithoutTeamInput + connect: MemberWhereUniqueInput + disconnect: Boolean + delete: Boolean + update: MemberUpdateWithoutTeamDataInput + upsert: MemberUpsertWithoutTeamInput +} + +input MemberUpdateWithoutTeamDataInput { + alias: String + authId: String + visible: Boolean +} + +input MemberUpsertWithoutTeamInput { + update: MemberUpdateWithoutTeamDataInput! + create: MemberCreateWithoutTeamInput! +} + +input MemberWhereInput { + """Logical AND on all given filters.""" + AND: [MemberWhereInput!] + + """Logical OR on all given filters.""" + OR: [MemberWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [MemberWhereInput!] + id: ID + + """All values that are not equal to given value.""" + id_not: ID + + """All values that are contained in given list.""" + id_in: [ID!] + + """All values that are not contained in given list.""" + id_not_in: [ID!] + + """All values less than the given value.""" + id_lt: ID + + """All values less than or equal the given value.""" + id_lte: ID + + """All values greater than the given value.""" + id_gt: ID + + """All values greater than or equal the given value.""" + id_gte: ID + + """All values containing the given string.""" + id_contains: ID + + """All values not containing the given string.""" + id_not_contains: ID + + """All values starting with the given string.""" + id_starts_with: ID + + """All values not starting with the given string.""" + id_not_starts_with: ID + + """All values ending with the given string.""" + id_ends_with: ID + + """All values not ending with the given string.""" + id_not_ends_with: ID + alias: String + + """All values that are not equal to given value.""" + alias_not: String + + """All values that are contained in given list.""" + alias_in: [String!] + + """All values that are not contained in given list.""" + alias_not_in: [String!] + + """All values less than the given value.""" + alias_lt: String + + """All values less than or equal the given value.""" + alias_lte: String + + """All values greater than the given value.""" + alias_gt: String + + """All values greater than or equal the given value.""" + alias_gte: String + + """All values containing the given string.""" + alias_contains: String + + """All values not containing the given string.""" + alias_not_contains: String + + """All values starting with the given string.""" + alias_starts_with: String + + """All values not starting with the given string.""" + alias_not_starts_with: String + + """All values ending with the given string.""" + alias_ends_with: String + + """All values not ending with the given string.""" + alias_not_ends_with: String + authId: String + + """All values that are not equal to given value.""" + authId_not: String + + """All values that are contained in given list.""" + authId_in: [String!] + + """All values that are not contained in given list.""" + authId_not_in: [String!] + + """All values less than the given value.""" + authId_lt: String + + """All values less than or equal the given value.""" + authId_lte: String + + """All values greater than the given value.""" + authId_gt: String + + """All values greater than or equal the given value.""" + authId_gte: String + + """All values containing the given string.""" + authId_contains: String + + """All values not containing the given string.""" + authId_not_contains: String + + """All values starting with the given string.""" + authId_starts_with: String + + """All values not starting with the given string.""" + authId_not_starts_with: String + + """All values ending with the given string.""" + authId_ends_with: String + + """All values not ending with the given string.""" + authId_not_ends_with: String + visible: Boolean + + """All values that are not equal to given value.""" + visible_not: Boolean + createdAt: DateTime + + """All values that are not equal to given value.""" + createdAt_not: DateTime + + """All values that are contained in given list.""" + createdAt_in: [DateTime!] + + """All values that are not contained in given list.""" + createdAt_not_in: [DateTime!] + + """All values less than the given value.""" + createdAt_lt: DateTime + + """All values less than or equal the given value.""" + createdAt_lte: DateTime + + """All values greater than the given value.""" + createdAt_gt: DateTime + + """All values greater than or equal the given value.""" + createdAt_gte: DateTime + team: TeamMembersWhereInput +} + +input MemberWhereUniqueInput { + id: ID + authId: String +} + +type Mutation { + createTeam(data: TeamCreateInput!): Team! + createTeamMembers(data: TeamMembersCreateInput!): TeamMembers! + createMember(data: MemberCreateInput!): Member! + createFinancialBeings(data: FinancialBeingsCreateInput!): FinancialBeings! + createTeamProfile(data: TeamProfileCreateInput!): TeamProfile! + createWallet(data: WalletCreateInput!): Wallet! + createFBStatus(data: FBStatusCreateInput!): FBStatus! + createTeamStatus(data: TeamStatusCreateInput!): TeamStatus! + createMemberStatus(data: MemberStatusCreateInput!): MemberStatus! + updateTeam(data: TeamUpdateInput!, where: TeamWhereUniqueInput!): Team + updateMember(data: MemberUpdateInput!, where: MemberWhereUniqueInput!): Member + updateFinancialBeings(data: FinancialBeingsUpdateInput!, where: FinancialBeingsWhereUniqueInput!): FinancialBeings + deleteTeam(where: TeamWhereUniqueInput!): Team + deleteMember(where: MemberWhereUniqueInput!): Member + deleteFinancialBeings(where: FinancialBeingsWhereUniqueInput!): FinancialBeings + upsertTeam(where: TeamWhereUniqueInput!, create: TeamCreateInput!, update: TeamUpdateInput!): Team! + upsertMember(where: MemberWhereUniqueInput!, create: MemberCreateInput!, update: MemberUpdateInput!): Member! + upsertFinancialBeings(where: FinancialBeingsWhereUniqueInput!, create: FinancialBeingsCreateInput!, update: FinancialBeingsUpdateInput!): FinancialBeings! + updateManyTeams(data: TeamUpdateInput!, where: TeamWhereInput): BatchPayload! + updateManyTeamMemberses(data: TeamMembersUpdateInput!, where: TeamMembersWhereInput): BatchPayload! + updateManyMembers(data: MemberUpdateInput!, where: MemberWhereInput): BatchPayload! + updateManyFinancialBeingses(data: FinancialBeingsUpdateInput!, where: FinancialBeingsWhereInput): BatchPayload! + updateManyTeamProfiles(data: TeamProfileUpdateInput!, where: TeamProfileWhereInput): BatchPayload! + updateManyWallets(data: WalletUpdateInput!, where: WalletWhereInput): BatchPayload! + updateManyFBStatuses(data: FBStatusUpdateInput!, where: FBStatusWhereInput): BatchPayload! + updateManyTeamStatuses(data: TeamStatusUpdateInput!, where: TeamStatusWhereInput): BatchPayload! + updateManyMemberStatuses(data: MemberStatusUpdateInput!, where: MemberStatusWhereInput): BatchPayload! + deleteManyTeams(where: TeamWhereInput): BatchPayload! + deleteManyTeamMemberses(where: TeamMembersWhereInput): BatchPayload! + deleteManyMembers(where: MemberWhereInput): BatchPayload! + deleteManyFinancialBeingses(where: FinancialBeingsWhereInput): BatchPayload! + deleteManyTeamProfiles(where: TeamProfileWhereInput): BatchPayload! + deleteManyWallets(where: WalletWhereInput): BatchPayload! + deleteManyFBStatuses(where: FBStatusWhereInput): BatchPayload! + deleteManyTeamStatuses(where: TeamStatusWhereInput): BatchPayload! + deleteManyMemberStatuses(where: MemberStatusWhereInput): BatchPayload! +} + +enum MutationType { + CREATED + UPDATED + DELETED +} + +"""An object with an ID""" +interface Node { + """The id of the object.""" + id: ID! +} + +"""Information about pagination in a connection.""" +type PageInfo { + """When paginating forwards, are there more items?""" + hasNextPage: Boolean! + + """When paginating backwards, are there more items?""" + hasPreviousPage: Boolean! + + """When paginating backwards, the cursor to continue.""" + startCursor: String + + """When paginating forwards, the cursor to continue.""" + endCursor: String +} + +type Query { + teams(where: TeamWhereInput, orderBy: TeamOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Team]! + teamMemberses(where: TeamMembersWhereInput, orderBy: TeamMembersOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [TeamMembers]! + members(where: MemberWhereInput, orderBy: MemberOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Member]! + financialBeingses(where: FinancialBeingsWhereInput, orderBy: FinancialBeingsOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [FinancialBeings]! + teamProfiles(where: TeamProfileWhereInput, orderBy: TeamProfileOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [TeamProfile]! + wallets(where: WalletWhereInput, orderBy: WalletOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Wallet]! + fBStatuses(where: FBStatusWhereInput, orderBy: FBStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [FBStatus]! + teamStatuses(where: TeamStatusWhereInput, orderBy: TeamStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [TeamStatus]! + memberStatuses(where: MemberStatusWhereInput, orderBy: MemberStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [MemberStatus]! + team(where: TeamWhereUniqueInput!): Team + member(where: MemberWhereUniqueInput!): Member + financialBeings(where: FinancialBeingsWhereUniqueInput!): FinancialBeings + teamsConnection(where: TeamWhereInput, orderBy: TeamOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): TeamConnection! + teamMembersesConnection(where: TeamMembersWhereInput, orderBy: TeamMembersOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): TeamMembersConnection! + membersConnection(where: MemberWhereInput, orderBy: MemberOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): MemberConnection! + financialBeingsesConnection(where: FinancialBeingsWhereInput, orderBy: FinancialBeingsOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): FinancialBeingsConnection! + teamProfilesConnection(where: TeamProfileWhereInput, orderBy: TeamProfileOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): TeamProfileConnection! + walletsConnection(where: WalletWhereInput, orderBy: WalletOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): WalletConnection! + fBStatusesConnection(where: FBStatusWhereInput, orderBy: FBStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): FBStatusConnection! + teamStatusesConnection(where: TeamStatusWhereInput, orderBy: TeamStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): TeamStatusConnection! + memberStatusesConnection(where: MemberStatusWhereInput, orderBy: MemberStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): MemberStatusConnection! + + """Fetches an object given its ID""" + node( + """The ID of an object""" + id: ID! + ): Node +} + +enum Role { + OWNER + ADMIN + MEMBER +} + +enum Status { + ACTIVE + INACTIVE + APPLY + INVITE +} + +type Subscription { + team(where: TeamSubscriptionWhereInput): TeamSubscriptionPayload + teamMembers(where: TeamMembersSubscriptionWhereInput): TeamMembersSubscriptionPayload + member(where: MemberSubscriptionWhereInput): MemberSubscriptionPayload + financialBeings(where: FinancialBeingsSubscriptionWhereInput): FinancialBeingsSubscriptionPayload + teamProfile(where: TeamProfileSubscriptionWhereInput): TeamProfileSubscriptionPayload + wallet(where: WalletSubscriptionWhereInput): WalletSubscriptionPayload + fBStatus(where: FBStatusSubscriptionWhereInput): FBStatusSubscriptionPayload + teamStatus(where: TeamStatusSubscriptionWhereInput): TeamStatusSubscriptionPayload + memberStatus(where: MemberStatusSubscriptionWhereInput): MemberStatusSubscriptionPayload +} + +type Team implements Node { + id: ID! + name: String! + slug: String! + profile(where: TeamProfileWhereInput): TeamProfile + members(where: TeamMembersWhereInput, orderBy: TeamMembersOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [TeamMembers!] + owner: String! + wallet(where: WalletWhereInput): Wallet + fb(where: FinancialBeingsWhereInput, orderBy: FinancialBeingsOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [FinancialBeings!] + status(where: TeamStatusWhereInput, orderBy: TeamStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [TeamStatus!] + createdAt: DateTime! +} + +"""A connection to a list of items.""" +type TeamConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [TeamEdge]! + aggregate: AggregateTeam! +} + +input TeamCreateInput { + name: String! + slug: String! + owner: String! + profile: TeamProfileCreateOneInput + members: TeamMembersCreateManyWithoutTeamInput + wallet: WalletCreateOneInput + fb: FinancialBeingsCreateManyWithoutTeamInput + status: TeamStatusCreateManyInput +} + +input TeamCreateOneWithoutFbInput { + create: TeamCreateWithoutFbInput + connect: TeamWhereUniqueInput +} + +input TeamCreateOneWithoutMembersInput { + create: TeamCreateWithoutMembersInput + connect: TeamWhereUniqueInput +} + +input TeamCreateWithoutFbInput { + name: String! + slug: String! + owner: String! + profile: TeamProfileCreateOneInput + members: TeamMembersCreateManyWithoutTeamInput + wallet: WalletCreateOneInput + status: TeamStatusCreateManyInput +} + +input TeamCreateWithoutMembersInput { + name: String! + slug: String! + owner: String! + profile: TeamProfileCreateOneInput + wallet: WalletCreateOneInput + fb: FinancialBeingsCreateManyWithoutTeamInput + status: TeamStatusCreateManyInput +} + +"""An edge in a connection.""" +type TeamEdge { + """The item at the end of the edge.""" + node: Team! + + """A cursor for use in pagination.""" + cursor: String! +} + +type TeamMembers { + member(where: MemberWhereInput): Member + team(where: TeamWhereInput): Team + role: Role + status(where: MemberStatusWhereInput, orderBy: MemberStatusOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [MemberStatus!] + updatedAt: DateTime! +} + +"""A connection to a list of items.""" +type TeamMembersConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [TeamMembersEdge]! + aggregate: AggregateTeamMembers! +} + +input TeamMembersCreateInput { + role: Role + member: MemberCreateOneWithoutTeamInput + team: TeamCreateOneWithoutMembersInput + status: MemberStatusCreateManyInput +} + +input TeamMembersCreateManyWithoutTeamInput { + create: [TeamMembersCreateWithoutTeamInput!] +} + +input TeamMembersCreateOneWithoutMemberInput { + create: TeamMembersCreateWithoutMemberInput +} + +input TeamMembersCreateWithoutMemberInput { + role: Role + team: TeamCreateOneWithoutMembersInput + status: MemberStatusCreateManyInput +} + +input TeamMembersCreateWithoutTeamInput { + role: Role + member: MemberCreateOneWithoutTeamInput + status: MemberStatusCreateManyInput +} + +"""An edge in a connection.""" +type TeamMembersEdge { + """The item at the end of the edge.""" + node: TeamMembers! + + """A cursor for use in pagination.""" + cursor: String! +} + +enum TeamMembersOrderByInput { + role_ASC + role_DESC + updatedAt_ASC + updatedAt_DESC + id_ASC + id_DESC + createdAt_ASC + createdAt_DESC +} + +type TeamMembersPreviousValues { + role: Role + updatedAt: DateTime! +} + +type TeamMembersSubscriptionPayload { + mutation: MutationType! + node: TeamMembers + updatedFields: [String!] + previousValues: TeamMembersPreviousValues +} + +input TeamMembersSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [TeamMembersSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [TeamMembersSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [TeamMembersSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: TeamMembersWhereInput +} + +input TeamMembersUpdateInput { + role: Role + member: MemberUpdateOneWithoutTeamInput + team: TeamUpdateOneWithoutMembersInput + status: MemberStatusUpdateManyInput +} + +input TeamMembersUpdateManyWithoutTeamInput { + create: [TeamMembersCreateWithoutTeamInput!] +} + +input TeamMembersUpdateOneWithoutMemberInput { + create: TeamMembersCreateWithoutMemberInput + disconnect: Boolean + delete: Boolean + update: TeamMembersUpdateWithoutMemberDataInput + upsert: TeamMembersUpsertWithoutMemberInput +} + +input TeamMembersUpdateWithoutMemberDataInput { + role: Role + team: TeamUpdateOneWithoutMembersInput + status: MemberStatusUpdateManyInput +} + +input TeamMembersUpsertWithoutMemberInput { + update: TeamMembersUpdateWithoutMemberDataInput! + create: TeamMembersCreateWithoutMemberInput! +} + +input TeamMembersWhereInput { + """Logical AND on all given filters.""" + AND: [TeamMembersWhereInput!] + + """Logical OR on all given filters.""" + OR: [TeamMembersWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [TeamMembersWhereInput!] + role: Role + + """All values that are not equal to given value.""" + role_not: Role + + """All values that are contained in given list.""" + role_in: [Role!] + + """All values that are not contained in given list.""" + role_not_in: [Role!] + updatedAt: DateTime + + """All values that are not equal to given value.""" + updatedAt_not: DateTime + + """All values that are contained in given list.""" + updatedAt_in: [DateTime!] + + """All values that are not contained in given list.""" + updatedAt_not_in: [DateTime!] + + """All values less than the given value.""" + updatedAt_lt: DateTime + + """All values less than or equal the given value.""" + updatedAt_lte: DateTime + + """All values greater than the given value.""" + updatedAt_gt: DateTime + + """All values greater than or equal the given value.""" + updatedAt_gte: DateTime + member: MemberWhereInput + team: TeamWhereInput + status_every: MemberStatusWhereInput + status_some: MemberStatusWhereInput + status_none: MemberStatusWhereInput +} + +enum TeamOrderByInput { + id_ASC + id_DESC + name_ASC + name_DESC + slug_ASC + slug_DESC + owner_ASC + owner_DESC + createdAt_ASC + createdAt_DESC + updatedAt_ASC + updatedAt_DESC +} + +type TeamPreviousValues { + id: ID! + name: String! + slug: String! + owner: String! + createdAt: DateTime! +} + +type TeamProfile { + description: String + motto: String + avatar: String + updatedAt: DateTime! +} + +"""A connection to a list of items.""" +type TeamProfileConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [TeamProfileEdge]! + aggregate: AggregateTeamProfile! +} + +input TeamProfileCreateInput { + description: String + motto: String + avatar: String +} + +input TeamProfileCreateOneInput { + create: TeamProfileCreateInput +} + +"""An edge in a connection.""" +type TeamProfileEdge { + """The item at the end of the edge.""" + node: TeamProfile! + + """A cursor for use in pagination.""" + cursor: String! +} + +enum TeamProfileOrderByInput { + description_ASC + description_DESC + motto_ASC + motto_DESC + avatar_ASC + avatar_DESC + updatedAt_ASC + updatedAt_DESC + id_ASC + id_DESC + createdAt_ASC + createdAt_DESC +} + +type TeamProfilePreviousValues { + description: String + motto: String + avatar: String + updatedAt: DateTime! +} + +type TeamProfileSubscriptionPayload { + mutation: MutationType! + node: TeamProfile + updatedFields: [String!] + previousValues: TeamProfilePreviousValues +} + +input TeamProfileSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [TeamProfileSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [TeamProfileSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [TeamProfileSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: TeamProfileWhereInput +} + +input TeamProfileUpdateDataInput { + description: String + motto: String + avatar: String +} + +input TeamProfileUpdateInput { + description: String + motto: String + avatar: String +} + +input TeamProfileUpdateOneInput { + create: TeamProfileCreateInput + disconnect: Boolean + delete: Boolean + update: TeamProfileUpdateDataInput + upsert: TeamProfileUpsertNestedInput +} + +input TeamProfileUpsertNestedInput { + update: TeamProfileUpdateDataInput! + create: TeamProfileCreateInput! +} + +input TeamProfileWhereInput { + """Logical AND on all given filters.""" + AND: [TeamProfileWhereInput!] + + """Logical OR on all given filters.""" + OR: [TeamProfileWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [TeamProfileWhereInput!] + description: String + + """All values that are not equal to given value.""" + description_not: String + + """All values that are contained in given list.""" + description_in: [String!] + + """All values that are not contained in given list.""" + description_not_in: [String!] + + """All values less than the given value.""" + description_lt: String + + """All values less than or equal the given value.""" + description_lte: String + + """All values greater than the given value.""" + description_gt: String + + """All values greater than or equal the given value.""" + description_gte: String + + """All values containing the given string.""" + description_contains: String + + """All values not containing the given string.""" + description_not_contains: String + + """All values starting with the given string.""" + description_starts_with: String + + """All values not starting with the given string.""" + description_not_starts_with: String + + """All values ending with the given string.""" + description_ends_with: String + + """All values not ending with the given string.""" + description_not_ends_with: String + motto: String + + """All values that are not equal to given value.""" + motto_not: String + + """All values that are contained in given list.""" + motto_in: [String!] + + """All values that are not contained in given list.""" + motto_not_in: [String!] + + """All values less than the given value.""" + motto_lt: String + + """All values less than or equal the given value.""" + motto_lte: String + + """All values greater than the given value.""" + motto_gt: String + + """All values greater than or equal the given value.""" + motto_gte: String + + """All values containing the given string.""" + motto_contains: String + + """All values not containing the given string.""" + motto_not_contains: String + + """All values starting with the given string.""" + motto_starts_with: String + + """All values not starting with the given string.""" + motto_not_starts_with: String + + """All values ending with the given string.""" + motto_ends_with: String + + """All values not ending with the given string.""" + motto_not_ends_with: String + avatar: String + + """All values that are not equal to given value.""" + avatar_not: String + + """All values that are contained in given list.""" + avatar_in: [String!] + + """All values that are not contained in given list.""" + avatar_not_in: [String!] + + """All values less than the given value.""" + avatar_lt: String + + """All values less than or equal the given value.""" + avatar_lte: String + + """All values greater than the given value.""" + avatar_gt: String + + """All values greater than or equal the given value.""" + avatar_gte: String + + """All values containing the given string.""" + avatar_contains: String + + """All values not containing the given string.""" + avatar_not_contains: String + + """All values starting with the given string.""" + avatar_starts_with: String + + """All values not starting with the given string.""" + avatar_not_starts_with: String + + """All values ending with the given string.""" + avatar_ends_with: String + + """All values not ending with the given string.""" + avatar_not_ends_with: String + updatedAt: DateTime + + """All values that are not equal to given value.""" + updatedAt_not: DateTime + + """All values that are contained in given list.""" + updatedAt_in: [DateTime!] + + """All values that are not contained in given list.""" + updatedAt_not_in: [DateTime!] + + """All values less than the given value.""" + updatedAt_lt: DateTime + + """All values less than or equal the given value.""" + updatedAt_lte: DateTime + + """All values greater than the given value.""" + updatedAt_gt: DateTime + + """All values greater than or equal the given value.""" + updatedAt_gte: DateTime +} + +type TeamStatus { + status: Status + reason: String + createdAt: DateTime! +} + +"""A connection to a list of items.""" +type TeamStatusConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [TeamStatusEdge]! + aggregate: AggregateTeamStatus! +} + +input TeamStatusCreateInput { + status: Status + reason: String +} + +input TeamStatusCreateManyInput { + create: [TeamStatusCreateInput!] +} + +"""An edge in a connection.""" +type TeamStatusEdge { + """The item at the end of the edge.""" + node: TeamStatus! + + """A cursor for use in pagination.""" + cursor: String! +} + +enum TeamStatusOrderByInput { + status_ASC + status_DESC + reason_ASC + reason_DESC + createdAt_ASC + createdAt_DESC + id_ASC + id_DESC + updatedAt_ASC + updatedAt_DESC +} + +type TeamStatusPreviousValues { + status: Status + reason: String + createdAt: DateTime! +} + +type TeamStatusSubscriptionPayload { + mutation: MutationType! + node: TeamStatus + updatedFields: [String!] + previousValues: TeamStatusPreviousValues +} + +input TeamStatusSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [TeamStatusSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [TeamStatusSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [TeamStatusSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: TeamStatusWhereInput +} + +input TeamStatusUpdateInput { + status: Status + reason: String +} + +input TeamStatusUpdateManyInput { + create: [TeamStatusCreateInput!] +} + +input TeamStatusWhereInput { + """Logical AND on all given filters.""" + AND: [TeamStatusWhereInput!] + + """Logical OR on all given filters.""" + OR: [TeamStatusWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [TeamStatusWhereInput!] + status: Status + + """All values that are not equal to given value.""" + status_not: Status + + """All values that are contained in given list.""" + status_in: [Status!] + + """All values that are not contained in given list.""" + status_not_in: [Status!] + reason: String + + """All values that are not equal to given value.""" + reason_not: String + + """All values that are contained in given list.""" + reason_in: [String!] + + """All values that are not contained in given list.""" + reason_not_in: [String!] + + """All values less than the given value.""" + reason_lt: String + + """All values less than or equal the given value.""" + reason_lte: String + + """All values greater than the given value.""" + reason_gt: String + + """All values greater than or equal the given value.""" + reason_gte: String + + """All values containing the given string.""" + reason_contains: String + + """All values not containing the given string.""" + reason_not_contains: String + + """All values starting with the given string.""" + reason_starts_with: String + + """All values not starting with the given string.""" + reason_not_starts_with: String + + """All values ending with the given string.""" + reason_ends_with: String + + """All values not ending with the given string.""" + reason_not_ends_with: String + createdAt: DateTime + + """All values that are not equal to given value.""" + createdAt_not: DateTime + + """All values that are contained in given list.""" + createdAt_in: [DateTime!] + + """All values that are not contained in given list.""" + createdAt_not_in: [DateTime!] + + """All values less than the given value.""" + createdAt_lt: DateTime + + """All values less than or equal the given value.""" + createdAt_lte: DateTime + + """All values greater than the given value.""" + createdAt_gt: DateTime + + """All values greater than or equal the given value.""" + createdAt_gte: DateTime +} + +type TeamSubscriptionPayload { + mutation: MutationType! + node: Team + updatedFields: [String!] + previousValues: TeamPreviousValues +} + +input TeamSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [TeamSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [TeamSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [TeamSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: TeamWhereInput +} + +input TeamUpdateInput { + name: String + slug: String + owner: String + profile: TeamProfileUpdateOneInput + members: TeamMembersUpdateManyWithoutTeamInput + wallet: WalletUpdateOneInput + fb: FinancialBeingsUpdateManyWithoutTeamInput + status: TeamStatusUpdateManyInput +} + +input TeamUpdateOneWithoutFbInput { + create: TeamCreateWithoutFbInput + connect: TeamWhereUniqueInput + disconnect: Boolean + delete: Boolean + update: TeamUpdateWithoutFbDataInput + upsert: TeamUpsertWithoutFbInput +} + +input TeamUpdateOneWithoutMembersInput { + create: TeamCreateWithoutMembersInput + connect: TeamWhereUniqueInput + disconnect: Boolean + delete: Boolean + update: TeamUpdateWithoutMembersDataInput + upsert: TeamUpsertWithoutMembersInput +} + +input TeamUpdateWithoutFbDataInput { + name: String + slug: String + owner: String + profile: TeamProfileUpdateOneInput + members: TeamMembersUpdateManyWithoutTeamInput + wallet: WalletUpdateOneInput + status: TeamStatusUpdateManyInput +} + +input TeamUpdateWithoutMembersDataInput { + name: String + slug: String + owner: String + profile: TeamProfileUpdateOneInput + wallet: WalletUpdateOneInput + fb: FinancialBeingsUpdateManyWithoutTeamInput + status: TeamStatusUpdateManyInput +} + +input TeamUpsertWithoutFbInput { + update: TeamUpdateWithoutFbDataInput! + create: TeamCreateWithoutFbInput! +} + +input TeamUpsertWithoutMembersInput { + update: TeamUpdateWithoutMembersDataInput! + create: TeamCreateWithoutMembersInput! +} + +input TeamWhereInput { + """Logical AND on all given filters.""" + AND: [TeamWhereInput!] + + """Logical OR on all given filters.""" + OR: [TeamWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [TeamWhereInput!] + id: ID + + """All values that are not equal to given value.""" + id_not: ID + + """All values that are contained in given list.""" + id_in: [ID!] + + """All values that are not contained in given list.""" + id_not_in: [ID!] + + """All values less than the given value.""" + id_lt: ID + + """All values less than or equal the given value.""" + id_lte: ID + + """All values greater than the given value.""" + id_gt: ID + + """All values greater than or equal the given value.""" + id_gte: ID + + """All values containing the given string.""" + id_contains: ID + + """All values not containing the given string.""" + id_not_contains: ID + + """All values starting with the given string.""" + id_starts_with: ID + + """All values not starting with the given string.""" + id_not_starts_with: ID + + """All values ending with the given string.""" + id_ends_with: ID + + """All values not ending with the given string.""" + id_not_ends_with: ID + name: String + + """All values that are not equal to given value.""" + name_not: String + + """All values that are contained in given list.""" + name_in: [String!] + + """All values that are not contained in given list.""" + name_not_in: [String!] + + """All values less than the given value.""" + name_lt: String + + """All values less than or equal the given value.""" + name_lte: String + + """All values greater than the given value.""" + name_gt: String + + """All values greater than or equal the given value.""" + name_gte: String + + """All values containing the given string.""" + name_contains: String + + """All values not containing the given string.""" + name_not_contains: String + + """All values starting with the given string.""" + name_starts_with: String + + """All values not starting with the given string.""" + name_not_starts_with: String + + """All values ending with the given string.""" + name_ends_with: String + + """All values not ending with the given string.""" + name_not_ends_with: String + slug: String + + """All values that are not equal to given value.""" + slug_not: String + + """All values that are contained in given list.""" + slug_in: [String!] + + """All values that are not contained in given list.""" + slug_not_in: [String!] + + """All values less than the given value.""" + slug_lt: String + + """All values less than or equal the given value.""" + slug_lte: String + + """All values greater than the given value.""" + slug_gt: String + + """All values greater than or equal the given value.""" + slug_gte: String + + """All values containing the given string.""" + slug_contains: String + + """All values not containing the given string.""" + slug_not_contains: String + + """All values starting with the given string.""" + slug_starts_with: String + + """All values not starting with the given string.""" + slug_not_starts_with: String + + """All values ending with the given string.""" + slug_ends_with: String + + """All values not ending with the given string.""" + slug_not_ends_with: String + owner: String + + """All values that are not equal to given value.""" + owner_not: String + + """All values that are contained in given list.""" + owner_in: [String!] + + """All values that are not contained in given list.""" + owner_not_in: [String!] + + """All values less than the given value.""" + owner_lt: String + + """All values less than or equal the given value.""" + owner_lte: String + + """All values greater than the given value.""" + owner_gt: String + + """All values greater than or equal the given value.""" + owner_gte: String + + """All values containing the given string.""" + owner_contains: String + + """All values not containing the given string.""" + owner_not_contains: String + + """All values starting with the given string.""" + owner_starts_with: String + + """All values not starting with the given string.""" + owner_not_starts_with: String + + """All values ending with the given string.""" + owner_ends_with: String + + """All values not ending with the given string.""" + owner_not_ends_with: String + createdAt: DateTime + + """All values that are not equal to given value.""" + createdAt_not: DateTime + + """All values that are contained in given list.""" + createdAt_in: [DateTime!] + + """All values that are not contained in given list.""" + createdAt_not_in: [DateTime!] + + """All values less than the given value.""" + createdAt_lt: DateTime + + """All values less than or equal the given value.""" + createdAt_lte: DateTime + + """All values greater than the given value.""" + createdAt_gt: DateTime + + """All values greater than or equal the given value.""" + createdAt_gte: DateTime + profile: TeamProfileWhereInput + members_every: TeamMembersWhereInput + members_some: TeamMembersWhereInput + members_none: TeamMembersWhereInput + wallet: WalletWhereInput + fb_every: FinancialBeingsWhereInput + fb_some: FinancialBeingsWhereInput + fb_none: FinancialBeingsWhereInput + status_every: TeamStatusWhereInput + status_some: TeamStatusWhereInput + status_none: TeamStatusWhereInput +} + +input TeamWhereUniqueInput { + id: ID + name: String + slug: String +} + +type Wallet { + balance: Float + updatedAt: DateTime! +} + +"""A connection to a list of items.""" +type WalletConnection { + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """A list of edges.""" + edges: [WalletEdge]! + aggregate: AggregateWallet! +} + +input WalletCreateInput { + balance: Float +} + +input WalletCreateOneInput { + create: WalletCreateInput +} + +"""An edge in a connection.""" +type WalletEdge { + """The item at the end of the edge.""" + node: Wallet! + + """A cursor for use in pagination.""" + cursor: String! +} + +enum WalletOrderByInput { + balance_ASC + balance_DESC + updatedAt_ASC + updatedAt_DESC + id_ASC + id_DESC + createdAt_ASC + createdAt_DESC +} + +type WalletPreviousValues { + balance: Float + updatedAt: DateTime! +} + +type WalletSubscriptionPayload { + mutation: MutationType! + node: Wallet + updatedFields: [String!] + previousValues: WalletPreviousValues +} + +input WalletSubscriptionWhereInput { + """Logical AND on all given filters.""" + AND: [WalletSubscriptionWhereInput!] + + """Logical OR on all given filters.""" + OR: [WalletSubscriptionWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [WalletSubscriptionWhereInput!] + + """ + The subscription event gets dispatched when it's listed in mutation_in + """ + mutation_in: [MutationType!] + + """ + The subscription event gets only dispatched when one of the updated fields names is included in this list + """ + updatedFields_contains: String + + """ + The subscription event gets only dispatched when all of the field names included in this list have been updated + """ + updatedFields_contains_every: [String!] + + """ + The subscription event gets only dispatched when some of the field names included in this list have been updated + """ + updatedFields_contains_some: [String!] + node: WalletWhereInput +} + +input WalletUpdateDataInput { + balance: Float +} + +input WalletUpdateInput { + balance: Float +} + +input WalletUpdateOneInput { + create: WalletCreateInput + disconnect: Boolean + delete: Boolean + update: WalletUpdateDataInput + upsert: WalletUpsertNestedInput +} + +input WalletUpsertNestedInput { + update: WalletUpdateDataInput! + create: WalletCreateInput! +} + +input WalletWhereInput { + """Logical AND on all given filters.""" + AND: [WalletWhereInput!] + + """Logical OR on all given filters.""" + OR: [WalletWhereInput!] + + """Logical NOT on all given filters combined by AND.""" + NOT: [WalletWhereInput!] + balance: Float + + """All values that are not equal to given value.""" + balance_not: Float + + """All values that are contained in given list.""" + balance_in: [Float!] + + """All values that are not contained in given list.""" + balance_not_in: [Float!] + + """All values less than the given value.""" + balance_lt: Float + + """All values less than or equal the given value.""" + balance_lte: Float + + """All values greater than the given value.""" + balance_gt: Float + + """All values greater than or equal the given value.""" + balance_gte: Float + updatedAt: DateTime + + """All values that are not equal to given value.""" + updatedAt_not: DateTime + + """All values that are contained in given list.""" + updatedAt_in: [DateTime!] + + """All values that are not contained in given list.""" + updatedAt_not_in: [DateTime!] + + """All values less than the given value.""" + updatedAt_lt: DateTime + + """All values less than or equal the given value.""" + updatedAt_lte: DateTime + + """All values greater than the given value.""" + updatedAt_gt: DateTime + + """All values greater than or equal the given value.""" + updatedAt_gte: DateTime +} diff --git a/api/src/index.js b/api/src/index.js index 33439b574..be92331cd 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -1,3 +1,4 @@ +require('dotenv').config(); const { GraphQLServer } = require('graphql-yoga') const { Prisma, @@ -8,15 +9,39 @@ const { makeExecutableSchema } = require('graphql-tools') const { importSchema } = require('graphql-import') const { checkJwt } = require('./auth/middleware/jwt') const { getMember } = require('./auth/middleware/getMember') -const validateParseIdToken = require('./auth/helpers/validate-parse-id-token') -const { directiveResolvers } = require('./auth-directives') +const { validateIdToken } = require('./auth/validateIdToken') +const { directiveResolvers } = require('./auth/authDirectives') + +const createMember = async function (ctx, info, idToken) { + console.log('createMember', idToken) + const member = await ctx.db.mutation.upsertMember({ + where: { + authId: idToken.sub, + }, + create: { + authId: idToken.sub, + alias: idToken.nickname + }, + update: { + authId: idToken.sub, + alias: idToken.nickname + } + }, info) + return member +} const ctxMember = ctx => ctx.request.member const resolvers = { Query: { - async member(parent, { auth0id }, ctx, info) { - return ctx.db.query.member({ where: { auth0id } }, info) + async member(parent, arg, ctx, info) { + console.log('member: ', parent, arg) + return ctx.db.query.member({ where: { authId: arg.authId } }, info) + }, + async currentMember(parent, args, ctx, info) { + console.log('currentMember: ', ctx.request.res.req.user) + const authId = ctx.request.res.req.user.sub + return ctx.db.query.member({ where: { authId } }, info) }, teams(parent, args, ctx, info) { return ctx.db.query.teamsConnection({}, @@ -59,7 +84,7 @@ const resolvers = { return ctx.db.query.team({ where: { name: name } }, `{ name }`) }, async teamByOwner(parent, { ownerId }, ctx, info) { - return ctx.db.query.teamsConnection({where: { owner: { auth0id: ownerId }}}, + return ctx.db.query.teamsConnection({where: { owner: { authId: ownerId }}}, `{ edges { node { @@ -72,7 +97,7 @@ const resolvers = { motto } owner { - auth0id + authId nickname visible profile { @@ -95,28 +120,27 @@ const resolvers = { }, async owner(parent, args, ctx, info) { console.log('resolver.query.owner ctx: ', ctxMember(ctx)) - return ctx.db.query.member({ where: { id: ctxMember(ctx).auth0id } }, info) + return ctx.db.query.member({ where: { id: ctxMember(ctx).authId } }, info) .catch((res) => { console.log('createTeam error: ', res) const errors = res.graphQLErrors.map((error) => { return error.message }) }) - }, - members: forwardTo('db') + } }, Mutation: { async authenticate(parent, { idToken }, ctx, info) { let memberToken = null try { - memberToken = await validateAndParseIdToken(idToken) + memberToken = await validateIdToken(idToken) console.log('authenticate.memberToken: ', await memberToken) } catch (err) { - console.log('authenticat.validateAndParseIdToken err: ', err) + console.log('authenticat.validateIdToken err: ', err) throw new Error(err.message) } - const auth0id = memberToken.sub - let member = await ctx.db.query.member({ where: { auth0id } }, info) + const authId = memberToken.sub + let member = await ctx.db.query.member({ where: { authId } }, info) if (!member) { try { @@ -124,7 +148,6 @@ const resolvers = { } catch (error) { throw new Error(error.message) } - } } return member }, @@ -133,15 +156,12 @@ const resolvers = { data: { name: name, slug: slug, - owner: {connect:{auth0id: owner}}, - members: {create: {role: 'OWNER', member: {connect: {auth0id: owner}}}} + owner: owner } }, info) - .catch((res) => { - console.log('createTeam error: ', res) - const errors = res.graphQLErrors.map((error) => { - return error.message - }) + .catch((err) => { + console.log('createTeam error: ', err) + return err }) }, async deleteTeam(parent, { id }, ctx, info) { @@ -176,25 +196,30 @@ const server = new GraphQLServer({ context: req => ({ ...req, db - }) + }), }) -server.express.post( +server.express.use( server.options.endpoint, checkJwt, (err, req, res, next) => { + console.log('checkJwt: ', err, req.user) if (err) return res.status(401).send(err.message) next() } ) -server.express.post(server.options.endpoint, (req, res, done) => +server.express.post(server.options.endpoint, (err, req, res, done) => { + console.log('getMember: ', err, req.user) getMember(req, res, done, db) -) +}) const whitelist = [ - 'http://localhost:1337', - 'http://0.0.0.0:5000' + 'http://localhost:3000', + 'http://localhost:3001', + 'http://localhost:3002', + 'http://localhost:4000', + 'http://localhost:4002' ] const corsOptionsDelegate = (req, callback) => { var corsOptions @@ -207,12 +232,13 @@ const corsOptionsDelegate = (req, callback) => { } const options = { + port: 4001, cors: corsOptionsDelegate, endpoint: '/graphql', subscriptions: '/graphql', playground: '/playground' } -server.start(options, () => console.log(`Server is running on http://localhost:4000${server.options.endpoint}`)) +server.start(options, () => console.log(`Server is running on http://localhost:4001${server.options.endpoint}`)) -module.exports= { createPrismaMember: createPrismaMember } +module.exports= { createMember } diff --git a/api/src/schema.graphqls b/api/src/schema.graphql similarity index 69% rename from api/src/schema.graphqls rename to api/src/schema.graphql index b61df8546..82bae531d 100644 --- a/api/src/schema.graphqls +++ b/api/src/schema.graphql @@ -12,24 +12,37 @@ type Query { teamById(teamId: String!): Team teamByOwner(ownerId: String!): TeamConnection owner: Member @isAuthenticated - member(auth0id: String!): Member @isAuthenticated + currentMember: Member @isAuthenticated + member(authId: String!): Member @isAuthenticated } type Mutation { authenticate(idToken: String!): Member createTeam(name: String!, slug: String, owner: String): Team @isAuthenticated deleteTeam(id: ID!): Team @isAuthenticated @isOwner(type: "Team") - updateProfile(data: MemberProfileInput): Member @isAuthenticated } input MemberProfileInput { - auth0id: String! - nickname: String! - anonymous: Boolean - visible: Boolean - avatar: String - email: String - repo: String - bio: String - status: String + authId: String! + alias: String! +} + +fragment MemberInfo on Member { + id + authId + alias + isActive + profile { + ...MemberProfileInfo + } +} + +fragment MemberProfileInfo on MemberProfile { + firstName + lastName + email + avatar + role { + name + } } diff --git a/client/src/views/index.js b/client/src/views/index.js index a1e5c1f8a..6759b33df 100644 --- a/client/src/views/index.js +++ b/client/src/views/index.js @@ -3,7 +3,8 @@ import Footer from './footer' import Callback from './callback' import Home from './home' import Dashboard from './dashboard' +import Teams from './teams' import { theme, globalStyles } from './theme' -export { NavBar, Footer, Callback, Home, Dashboard, theme, globalStyles } +export { NavBar, Footer, Callback, Home, Dashboard, Teams, theme, globalStyles } diff --git a/client/src/views/teams/index.js b/client/src/views/teams/index.js new file mode 100644 index 000000000..69dbd99aa --- /dev/null +++ b/client/src/views/teams/index.js @@ -0,0 +1,53 @@ +import React from 'react' +import PropTypes from 'prop-types' + +import CssBaseline from '@material-ui/core/CssBaseline' +import Typography from '@material-ui/core/Typography' +import { withStyles } from '@material-ui/core/styles' + +const styles = theme => ({ + '@global': { + body: { + backgroundColor: theme.palette.common.white + } + }, + layout: { + width: 'auto', + marginLeft: theme.spacing.unit * 3, + marginRight: theme.spacing.unit * 3, + [theme.breakpoints.up(900 + theme.spacing.unit * 3 * 2)]: { + width: 900, + marginLeft: 'auto', + marginRight: 'auto' + } + }, + heroContent: { + maxWidth: 600, + margin: '0 auto', + padding: `${theme.spacing.unit * 8}px 0 ${theme.spacing.unit * 6}px` + } +}) + +const Home = ({ classes }) => ( + + +
+
+ + Teams + +
+
+
+) + +Home.propTypes = { + classes: PropTypes.object.isRequired +} + +export default withStyles(styles)(Home) diff --git a/docs/CodeStyle.md b/docs/CodeStyle.md new file mode 100644 index 000000000..483afda50 --- /dev/null +++ b/docs/CodeStyle.md @@ -0,0 +1,5 @@ +# Code Styling and Formatting + +``` +npm install --save-dev eslint-config-standard eslint-config-standard-react eslint-plugin-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-node eslint-plugin-react +```