From de71feaddec9289d972b161e6eca117db54ff827 Mon Sep 17 00:00:00 2001 From: Hammad Jutt Date: Fri, 9 Oct 2020 22:16:15 -0600 Subject: [PATCH] Update backend to use enum tables + fix migration trigger (#141) * Setup prettier-ignore and add more instructions on running backend * Dont throw error when updating verified accounts * Migrate account-type to use tables instead of native enum * Migrate enneagram_type to use table instead of native enum * Update schema and front end for new enum tables * Fix type errors --- .prettierignore | 35 + README.md | 8 + hasura/metadata/tables.yaml | 408 +++++----- .../1602297882653_account-type-table/down.sql | 6 + .../1602297882653_account-type-table/up.sql | 16 + .../down.sql | 6 + .../1602298657385_enneagram-type-table/up.sql | 21 + package.json | 4 +- .../migrateSourceCredAccounts/handler.ts | 16 +- .../updateVerifiedAccounts.ts | 23 +- .../backend/src/handlers/graphql/mutations.ts | 5 +- packages/codegen/schema.graphql | 704 +++++++++++++++++- packages/web/graphql/fragments.ts | 2 +- yarn.lock | 2 +- 14 files changed, 996 insertions(+), 260 deletions(-) create mode 100644 .prettierignore create mode 100644 hasura/migrations/1602297882653_account-type-table/down.sql create mode 100644 hasura/migrations/1602297882653_account-type-table/up.sql create mode 100644 hasura/migrations/1602298657385_enneagram-type-table/down.sql create mode 100644 hasura/migrations/1602298657385_enneagram-type-table/up.sql diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..fc6cb727 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,35 @@ +**/node_modules +**/dist +storybook-static +node_modules/ + +# No npm allowed +package-lock.json + +# IDE +.idea + +# next.js +.next/ + +# Hasura config +hasura/** + +# build files +build +autogen +dist +out/ + +# Coverage directory used by testing tools +**/coverage +**/jest-coverage +**/reports + +# misc +.DS_Store +.env +.env.local +.env.development.local +.env.test.local +.env.production.local diff --git a/README.md b/README.md index 7e87d7a4..2aea164a 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,14 @@ yarn docker:start - Runs docker containers for backend, Hasura Engine, and PostGres database - will auto-restart on any changes to `packages/backend` and `packages/utils` +If you are running for the first time on an empty database, once the services +are running you can run the following command to populate the database with +the initial dataset: + +```shell script +curl -X POST http://localhost:4000/actions/migrateSourceCredAccounts +``` + **Stop backend services** ```shell script diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index e73647b3..7da51028 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -2,162 +2,170 @@ schema: public name: Account object_relationships: - - name: Player - using: - foreign_key_constraint_on: player_id + - name: Player + using: + foreign_key_constraint_on: player_id select_permissions: - - role: player - permission: - columns: - - player_id - - identifier - - type - filter: {} - - role: public - permission: - columns: - - player_id - - identifier - - type - filter: {} + - role: player + permission: + columns: + - player_id + - identifier + - type + filter: {} + - role: public + permission: + columns: + - player_id + - identifier + - type + filter: {} +- table: + schema: public + name: AccountType + is_enum: true +- table: + schema: public + name: EnneagramType + is_enum: true - table: schema: public name: Guild object_relationships: - - name: GuildType - using: - foreign_key_constraint_on: type + - name: GuildType + using: + foreign_key_constraint_on: type select_permissions: - - role: player - permission: - columns: - - id - - type - - identifier - - name - - logo - filter: {} - - role: public - permission: - columns: - - id - - type - - identifier - - name - - logo - filter: {} + - role: player + permission: + columns: + - id + - type + - identifier + - name + - logo + filter: {} + - role: public + permission: + columns: + - id + - type + - identifier + - name + - logo + filter: {} - table: schema: public name: GuildType is_enum: true array_relationships: - - name: Guilds - using: - foreign_key_constraint_on: - column: type - table: - schema: public - name: Guild + - name: Guilds + using: + foreign_key_constraint_on: + column: type + table: + schema: public + name: Guild select_permissions: - - role: player - permission: - columns: - - name - filter: {} - - role: public - permission: - columns: - - name - filter: {} + - role: player + permission: + columns: + - name + filter: {} + - role: public + permission: + columns: + - name + filter: {} - table: schema: public name: Player array_relationships: - - name: Accounts - using: - foreign_key_constraint_on: - column: player_id - table: - schema: public - name: Account - - name: Player_Skills - using: - foreign_key_constraint_on: - column: player_id - table: - schema: public - name: Player_Skill + - name: Accounts + using: + foreign_key_constraint_on: + column: player_id + table: + schema: public + name: Account + - name: Player_Skills + using: + foreign_key_constraint_on: + column: player_id + table: + schema: public + name: Player_Skill remote_relationships: - - definition: - remote_field: - getBoxProfile: - arguments: - address: $ethereum_address - hasura_fields: - - ethereum_address - remote_schema: backend - name: box_profile - - definition: - remote_field: - getDaoHausMemberships: - arguments: - memberAddress: $ethereum_address - hasura_fields: - - ethereum_address - remote_schema: backend - name: daohausMemberships + - definition: + remote_field: + getBoxProfile: + arguments: + address: $ethereum_address + hasura_fields: + - ethereum_address + remote_schema: backend + name: box_profile + - definition: + remote_field: + getDaoHausMemberships: + arguments: + memberAddress: $ethereum_address + hasura_fields: + - ethereum_address + remote_schema: backend + name: daohausMemberships select_permissions: - - role: player - permission: - columns: - - id - - username - - ethereum_address - - totalXp - - role - - timezone - - enneagram - - scIdentityId - - rank - filter: {} - - role: public - permission: - columns: - - enneagram - - ethereum_address - - id - - rank - - role - - timezone - - totalXp - - username - filter: {} + - role: player + permission: + columns: + - id + - username + - ethereum_address + - totalXp + - role + - timezone + - enneagram + - scIdentityId + - rank + filter: {} + - role: public + permission: + columns: + - enneagram + - ethereum_address + - id + - rank + - role + - timezone + - totalXp + - username + filter: {} update_permissions: - - role: player - permission: - columns: - - enneagram - - role - - timezone - - username - filter: - id: - _eq: X-Hasura-User-Id - check: {} + - role: player + permission: + columns: + - enneagram + - role + - timezone + - username + filter: + id: + _eq: X-Hasura-User-Id + check: {} event_triggers: - - name: fetchBoxVerifiedAccounts - definition: - enable_manual: true - insert: - columns: '*' - update: - columns: - - ethereum_address - retry_conf: - num_retries: 0 - interval_sec: 10 - timeout_sec: 60 - webhook_from_env: TRIGGERS_ENDPOINT + - name: fetchBoxVerifiedAccounts + definition: + enable_manual: true + insert: + columns: '*' + update: + columns: + - ethereum_address + retry_conf: + num_retries: 0 + interval_sec: 10 + timeout_sec: 60 + webhook_from_env: TRIGGERS_ENDPOINT - table: schema: public name: Player_Rank @@ -166,79 +174,79 @@ schema: public name: Player_Skill object_relationships: - - name: Player - using: - foreign_key_constraint_on: player_id - - name: Skill - using: - foreign_key_constraint_on: skill_id + - name: Player + using: + foreign_key_constraint_on: player_id + - name: Skill + using: + foreign_key_constraint_on: skill_id insert_permissions: - - role: player - permission: - check: - player_id: - _eq: X-Hasura-User-Id - set: - player_id: x-hasura-User-Id - columns: - - skill_id - backend_only: false + - role: player + permission: + check: + player_id: + _eq: X-Hasura-User-Id + set: + player_id: x-hasura-User-Id + columns: + - skill_id + backend_only: false select_permissions: - - role: player - permission: - columns: - - player_id - - skill_id - filter: {} - allow_aggregations: true - - role: public - permission: - columns: - - player_id - - skill_id - filter: {} - allow_aggregations: true + - role: player + permission: + columns: + - player_id + - skill_id + filter: {} + allow_aggregations: true + - role: public + permission: + columns: + - player_id + - skill_id + filter: {} + allow_aggregations: true delete_permissions: - - role: player - permission: - filter: - player_id: - _eq: X-Hasura-User-Id + - role: player + permission: + filter: + player_id: + _eq: X-Hasura-User-Id - table: schema: public name: Skill array_relationships: - - name: Player_Skills - using: - foreign_key_constraint_on: - column: skill_id - table: - schema: public - name: Player_Skill + - name: Player_Skills + using: + foreign_key_constraint_on: + column: skill_id + table: + schema: public + name: Player_Skill insert_permissions: - - role: player - permission: - check: {} - columns: - - name - backend_only: false + - role: player + permission: + check: {} + columns: + - name + backend_only: false select_permissions: - - role: player - permission: - columns: - - category - - id - - name - filter: {} - allow_aggregations: true - - role: public - permission: - columns: - - category - - name - - id - filter: {} - allow_aggregations: true + - role: player + permission: + columns: + - category + - id + - name + filter: {} + allow_aggregations: true + - role: public + permission: + columns: + - category + - name + - id + filter: {} + allow_aggregations: true - table: schema: public name: SkillCategory diff --git a/hasura/migrations/1602297882653_account-type-table/down.sql b/hasura/migrations/1602297882653_account-type-table/down.sql new file mode 100644 index 00000000..85ae1633 --- /dev/null +++ b/hasura/migrations/1602297882653_account-type-table/down.sql @@ -0,0 +1,6 @@ + +alter table "public"."Account" drop constraint "Account_type_fkey"; + +ALTER TABLE "public"."Account" ALTER COLUMN "type" TYPE USER-DEFINED; + +DROP TABLE "public"."AccountType"; diff --git a/hasura/migrations/1602297882653_account-type-table/up.sql b/hasura/migrations/1602297882653_account-type-table/up.sql new file mode 100644 index 00000000..b96fbba5 --- /dev/null +++ b/hasura/migrations/1602297882653_account-type-table/up.sql @@ -0,0 +1,16 @@ + +CREATE TABLE "public"."AccountType"("type" text NOT NULL, PRIMARY KEY ("type") ); +INSERT INTO "AccountType" (type) VALUES + ('ETHEREUM'), + ('DISCORD'), + ('GITHUB'), + ('TWITTER'), + ('DISCOURSE'); + +ALTER TABLE "public"."Account" ALTER COLUMN "type" TYPE text; + +alter table "public"."Account" + add constraint "Account_type_fkey" + foreign key ("type") + references "public"."AccountType" + ("type") on update restrict on delete restrict; diff --git a/hasura/migrations/1602298657385_enneagram-type-table/down.sql b/hasura/migrations/1602298657385_enneagram-type-table/down.sql new file mode 100644 index 00000000..5796683e --- /dev/null +++ b/hasura/migrations/1602298657385_enneagram-type-table/down.sql @@ -0,0 +1,6 @@ + +alter table "public"."Player" drop constraint "Player_enneagram_fkey"; + +ALTER TABLE "public"."Player" ALTER COLUMN "enneagram" TYPE USER-DEFINED; + +DROP TABLE "public"."EnneagramType"; diff --git a/hasura/migrations/1602298657385_enneagram-type-table/up.sql b/hasura/migrations/1602298657385_enneagram-type-table/up.sql new file mode 100644 index 00000000..6e2177af --- /dev/null +++ b/hasura/migrations/1602298657385_enneagram-type-table/up.sql @@ -0,0 +1,21 @@ + +CREATE TABLE "public"."EnneagramType"("name" text NOT NULL, "description" text NOT NULL, PRIMARY KEY ("name") ); + +INSERT INTO "EnneagramType" (name, description) VALUES + ('REFORMER', 'Principled, Purposeful, Self-Controlled, and Perfectionistic'), + ('HELPER', 'Demonstrative, Generous, People-Pleasing, and Possessive'), + ('ACHIEVER', 'Adaptive, Excelling, Driven, and Image-Conscious'), + ('INDIVIDUALIST', 'Expressive, Dramatic, Self-Absorbed, and Temperamental'), + ('INVESTIGATOR', 'Perceptive, Innovative, Secretive, and Isolated'), + ('LOYALIST', 'Engaging, Responsible, Anxious, and Suspicious'), + ('ENTHUSIAST', 'Spontaneous, Versatile, Distractible, and Scattered'), + ('CHALLENGER', 'Self-Confident, Decisive, Willful, and Confrontational'), + ('PEACEMAKER', 'Receptive, Reassuring, Agreeable, and Complacent'); + +ALTER TABLE "public"."Player" ALTER COLUMN "enneagram" TYPE text; + +alter table "public"."Player" + add constraint "Player_enneagram_fkey" + foreign key ("enneagram") + references "public"."EnneagramType" + ("name") on update restrict on delete restrict; diff --git a/package.json b/package.json index 03f864c6..4dc331c3 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "generate": "lerna run generate --parallel --", "test:full": "yarn lint && yarn typecheck && yarn test", "clean": "lerna clean", - "format": "prettier --ignore-path .gitignore --write \"{*,**/*}.{ts,tsx,js,jsx,json,yml,yaml,md}\"", + "format": "prettier --write \"{*,**/*}.{ts,tsx,js,jsx,json,yml,yaml,md}\"", "lint": "eslint --ignore-path .gitignore \"./packages/**/*.{ts,tsx,js,jsx}\"", "typecheck": "lerna run typecheck", "prepare": "lerna run prepare", @@ -55,7 +55,7 @@ "@typescript-eslint/eslint-plugin": "3.9.1", "@typescript-eslint/parser": "3.6.0", "eslint": "6.8.0", - "eslint-config-airbnb-typescript": "9.0", + "eslint-config-airbnb-typescript": "9.0.0", "eslint-config-prettier": "6.11.0", "eslint-import-resolver-typescript": "2.2.1", "eslint-plugin-import": "2.22.0", diff --git a/packages/backend/src/handlers/actions/migrateSourceCredAccounts/handler.ts b/packages/backend/src/handlers/actions/migrateSourceCredAccounts/handler.ts index ac5ba30c..9f645994 100644 --- a/packages/backend/src/handlers/actions/migrateSourceCredAccounts/handler.ts +++ b/packages/backend/src/handlers/actions/migrateSourceCredAccounts/handler.ts @@ -6,10 +6,10 @@ import api from 'sourcecred'; import { Account_Constraint, + AccountType_Enum, Player_Constraint, Player_Rank_Enum, Player_Update_Column, - Scalars, } from '../../../lib/autogen/hasura-sdk'; import { client } from '../../../lib/hasuraClient'; import { AddressBookEntry, SCAccountsData, SCAlias } from './types'; @@ -19,18 +19,18 @@ const ACCOUNTS_FILE = const ADDRESS_BOOK_FILE = 'https://raw.githubusercontent.com/MetaFam/TheSource/master/addressbook.json'; -const VALID_ACCOUNT_TYPES: Array = [ - 'ETHEREUM', - 'DISCORD', - 'DISCOURSE', - 'GITHUB', - 'TWITTER', +const VALID_ACCOUNT_TYPES: Array = [ + AccountType_Enum.Ethereum, + AccountType_Enum.Discord, + AccountType_Enum.Discourse, + AccountType_Enum.Github, + AccountType_Enum.Twitter, ]; const parseAlias = (alias: SCAlias) => { try { const addressParts = api.core.graph.NodeAddress.toParts(alias.address); - const type = addressParts[1]?.toUpperCase() as Scalars['account_type']; + const type = addressParts[1]?.toUpperCase() as AccountType_Enum; if (VALID_ACCOUNT_TYPES.indexOf(type) < 0) { return null; diff --git a/packages/backend/src/handlers/actions/updateBoxProfile/updateVerifiedAccounts.ts b/packages/backend/src/handlers/actions/updateBoxProfile/updateVerifiedAccounts.ts index a7285191..135da6d6 100644 --- a/packages/backend/src/handlers/actions/updateBoxProfile/updateVerifiedAccounts.ts +++ b/packages/backend/src/handlers/actions/updateBoxProfile/updateVerifiedAccounts.ts @@ -1,5 +1,6 @@ import Box from '3box'; +import { AccountType_Enum } from '../../../lib/autogen/hasura-sdk'; import { client } from '../../../lib/hasuraClient'; import { UpdateBoxProfileResponse } from '../types'; @@ -23,15 +24,18 @@ export async function updateVerifiedAccounts( objects: [ { player_id: playerId, - type: 'GITHUB', + type: AccountType_Enum.Github, identifier: verifiedAccounts.github.username, }, ], }); - if (result.insert_Account?.affected_rows === 0) { - throw new Error('Error while upserting github profile'); + if (result.insert_Account?.affected_rows) { + updatedProfiles.push('github'); + } else { + console.warn( + `Unable to insert Github user ${verifiedAccounts.github.username} for playerId ${playerId}`, + ); } - updatedProfiles.push('github'); } if (verifiedAccounts.twitter) { @@ -39,15 +43,18 @@ export async function updateVerifiedAccounts( objects: [ { player_id: playerId, - type: 'TWITTER', + type: AccountType_Enum.Github, identifier: verifiedAccounts.twitter.username, }, ], }); - if (result.insert_Account?.affected_rows === 0) { - throw new Error('Error while upserting github profile'); + if (result.insert_Account?.affected_rows) { + updatedProfiles.push('twitter'); + } else { + console.warn( + `Unable to insert Twitter user ${verifiedAccounts.twitter.username} for playerId ${playerId}`, + ); } - updatedProfiles.push('twitter'); } return { diff --git a/packages/backend/src/handlers/graphql/mutations.ts b/packages/backend/src/handlers/graphql/mutations.ts index f688a3b2..605527ca 100644 --- a/packages/backend/src/handlers/graphql/mutations.ts +++ b/packages/backend/src/handlers/graphql/mutations.ts @@ -63,10 +63,7 @@ export const UpdatePlayer = gql` { scIdentityId: { _eq: $identityId } } { Accounts: { - _and: { - type: { _eq: "DISCORD" } - identifier: { _eq: $discordId } - } + _and: { type: { _eq: DISCORD }, identifier: { _eq: $discordId } } } } ] diff --git a/packages/codegen/schema.graphql b/packages/codegen/schema.graphql index 6c0c41de..02789f59 100644 --- a/packages/codegen/schema.graphql +++ b/packages/codegen/schema.graphql @@ -12,7 +12,7 @@ type Account { Player: Player! identifier: String! player_id: uuid! - type: account_type! + type: AccountType_enum! } """ @@ -59,7 +59,7 @@ input Account_bool_exp { _or: [Account_bool_exp] identifier: String_comparison_exp player_id: uuid_comparison_exp - type: account_type_comparison_exp + type: AccountType_enum_comparison_exp } """ @@ -77,7 +77,7 @@ input Account_insert_input { Player: Player_obj_rel_insert_input identifier: String player_id: uuid - type: account_type + type: AccountType_enum } """aggregate max on columns""" @@ -166,24 +166,7 @@ input type for updating data in table "Account" input Account_set_input { identifier: String player_id: uuid - type: account_type -} - -scalar account_type - -""" -expression to compare columns of type account_type. All fields are combined with logical 'AND'. -""" -input account_type_comparison_exp { - _eq: account_type - _gt: account_type - _gte: account_type - _in: [account_type!] - _is_null: Boolean - _lt: account_type - _lte: account_type - _neq: account_type - _nin: [account_type!] + type: AccountType_enum } """ @@ -200,6 +183,180 @@ enum Account_update_column { type } +""" +columns and relationships of "AccountType" +""" +type AccountType { + type: String! +} + +""" +aggregated selection of "AccountType" +""" +type AccountType_aggregate { + aggregate: AccountType_aggregate_fields + nodes: [AccountType!]! +} + +""" +aggregate fields of "AccountType" +""" +type AccountType_aggregate_fields { + count(columns: [AccountType_select_column!], distinct: Boolean): Int + max: AccountType_max_fields + min: AccountType_min_fields +} + +""" +order by aggregate values of table "AccountType" +""" +input AccountType_aggregate_order_by { + count: order_by + max: AccountType_max_order_by + min: AccountType_min_order_by +} + +""" +input type for inserting array relation for remote table "AccountType" +""" +input AccountType_arr_rel_insert_input { + data: [AccountType_insert_input!]! + on_conflict: AccountType_on_conflict +} + +""" +Boolean expression to filter rows from the table "AccountType". All fields are combined with a logical 'AND'. +""" +input AccountType_bool_exp { + _and: [AccountType_bool_exp] + _not: AccountType_bool_exp + _or: [AccountType_bool_exp] + type: String_comparison_exp +} + +""" +unique or primary key constraints on table "AccountType" +""" +enum AccountType_constraint { + """unique or primary key constraint""" + AccountType_pkey +} + +enum AccountType_enum { + DISCORD + DISCOURSE + ETHEREUM + GITHUB + TWITTER +} + +""" +expression to compare columns of type AccountType_enum. All fields are combined with logical 'AND'. +""" +input AccountType_enum_comparison_exp { + _eq: AccountType_enum + _in: [AccountType_enum!] + _is_null: Boolean + _neq: AccountType_enum + _nin: [AccountType_enum!] +} + +""" +input type for inserting data into table "AccountType" +""" +input AccountType_insert_input { + type: String +} + +"""aggregate max on columns""" +type AccountType_max_fields { + type: String +} + +""" +order by max() on columns of table "AccountType" +""" +input AccountType_max_order_by { + type: order_by +} + +"""aggregate min on columns""" +type AccountType_min_fields { + type: String +} + +""" +order by min() on columns of table "AccountType" +""" +input AccountType_min_order_by { + type: order_by +} + +""" +response of any mutation on the table "AccountType" +""" +type AccountType_mutation_response { + """number of affected rows by the mutation""" + affected_rows: Int! + + """data of the affected rows by the mutation""" + returning: [AccountType!]! +} + +""" +input type for inserting object relation for remote table "AccountType" +""" +input AccountType_obj_rel_insert_input { + data: AccountType_insert_input! + on_conflict: AccountType_on_conflict +} + +""" +on conflict condition type for table "AccountType" +""" +input AccountType_on_conflict { + constraint: AccountType_constraint! + update_columns: [AccountType_update_column!]! + where: AccountType_bool_exp +} + +""" +ordering options when selecting data from "AccountType" +""" +input AccountType_order_by { + type: order_by +} + +""" +primary key columns input for table: "AccountType" +""" +input AccountType_pk_columns_input { + type: String! +} + +""" +select columns of table "AccountType" +""" +enum AccountType_select_column { + """column name""" + type +} + +""" +input type for updating data in table "AccountType" +""" +input AccountType_set_input { + type: String +} + +""" +update columns of table "AccountType" +""" +enum AccountType_update_column { + """column name""" + type +} + type BoxProfile { description: String emoji: String @@ -210,21 +367,214 @@ type BoxProfile { name: String } -scalar enneagram_type +""" +columns and relationships of "EnneagramType" +""" +type EnneagramType { + description: String! + name: String! +} """ -expression to compare columns of type enneagram_type. All fields are combined with logical 'AND'. +aggregated selection of "EnneagramType" """ -input enneagram_type_comparison_exp { - _eq: enneagram_type - _gt: enneagram_type - _gte: enneagram_type - _in: [enneagram_type!] +type EnneagramType_aggregate { + aggregate: EnneagramType_aggregate_fields + nodes: [EnneagramType!]! +} + +""" +aggregate fields of "EnneagramType" +""" +type EnneagramType_aggregate_fields { + count(columns: [EnneagramType_select_column!], distinct: Boolean): Int + max: EnneagramType_max_fields + min: EnneagramType_min_fields +} + +""" +order by aggregate values of table "EnneagramType" +""" +input EnneagramType_aggregate_order_by { + count: order_by + max: EnneagramType_max_order_by + min: EnneagramType_min_order_by +} + +""" +input type for inserting array relation for remote table "EnneagramType" +""" +input EnneagramType_arr_rel_insert_input { + data: [EnneagramType_insert_input!]! + on_conflict: EnneagramType_on_conflict +} + +""" +Boolean expression to filter rows from the table "EnneagramType". All fields are combined with a logical 'AND'. +""" +input EnneagramType_bool_exp { + _and: [EnneagramType_bool_exp] + _not: EnneagramType_bool_exp + _or: [EnneagramType_bool_exp] + description: String_comparison_exp + name: String_comparison_exp +} + +""" +unique or primary key constraints on table "EnneagramType" +""" +enum EnneagramType_constraint { + """unique or primary key constraint""" + EnneagramType_pkey +} + +enum EnneagramType_enum { + """Adaptive, Excelling, Driven, and Image-Conscious""" + ACHIEVER + + """Self-Confident, Decisive, Willful, and Confrontational""" + CHALLENGER + + """Spontaneous, Versatile, Distractible, and Scattered""" + ENTHUSIAST + + """Demonstrative, Generous, People-Pleasing, and Possessive""" + HELPER + + """Expressive, Dramatic, Self-Absorbed, and Temperamental""" + INDIVIDUALIST + + """Perceptive, Innovative, Secretive, and Isolated""" + INVESTIGATOR + + """Engaging, Responsible, Anxious, and Suspicious""" + LOYALIST + + """Receptive, Reassuring, Agreeable, and Complacent""" + PEACEMAKER + + """Principled, Purposeful, Self-Controlled, and Perfectionistic""" + REFORMER +} + +""" +expression to compare columns of type EnneagramType_enum. All fields are combined with logical 'AND'. +""" +input EnneagramType_enum_comparison_exp { + _eq: EnneagramType_enum + _in: [EnneagramType_enum!] _is_null: Boolean - _lt: enneagram_type - _lte: enneagram_type - _neq: enneagram_type - _nin: [enneagram_type!] + _neq: EnneagramType_enum + _nin: [EnneagramType_enum!] +} + +""" +input type for inserting data into table "EnneagramType" +""" +input EnneagramType_insert_input { + description: String + name: String +} + +"""aggregate max on columns""" +type EnneagramType_max_fields { + description: String + name: String +} + +""" +order by max() on columns of table "EnneagramType" +""" +input EnneagramType_max_order_by { + description: order_by + name: order_by +} + +"""aggregate min on columns""" +type EnneagramType_min_fields { + description: String + name: String +} + +""" +order by min() on columns of table "EnneagramType" +""" +input EnneagramType_min_order_by { + description: order_by + name: order_by +} + +""" +response of any mutation on the table "EnneagramType" +""" +type EnneagramType_mutation_response { + """number of affected rows by the mutation""" + affected_rows: Int! + + """data of the affected rows by the mutation""" + returning: [EnneagramType!]! +} + +""" +input type for inserting object relation for remote table "EnneagramType" +""" +input EnneagramType_obj_rel_insert_input { + data: EnneagramType_insert_input! + on_conflict: EnneagramType_on_conflict +} + +""" +on conflict condition type for table "EnneagramType" +""" +input EnneagramType_on_conflict { + constraint: EnneagramType_constraint! + update_columns: [EnneagramType_update_column!]! + where: EnneagramType_bool_exp +} + +""" +ordering options when selecting data from "EnneagramType" +""" +input EnneagramType_order_by { + description: order_by + name: order_by +} + +""" +primary key columns input for table: "EnneagramType" +""" +input EnneagramType_pk_columns_input { + name: String! +} + +""" +select columns of table "EnneagramType" +""" +enum EnneagramType_select_column { + """column name""" + description + + """column name""" + name +} + +""" +input type for updating data in table "EnneagramType" +""" +input EnneagramType_set_input { + description: String + name: String +} + +""" +update columns of table "EnneagramType" +""" +enum EnneagramType_update_column { + """column name""" + description + + """column name""" + name } """ @@ -717,6 +1067,32 @@ type mutation_root { where: Account_bool_exp! ): Account_mutation_response + """ + delete data from the table: "AccountType" + """ + delete_AccountType( + """filter the rows which have to be deleted""" + where: AccountType_bool_exp! + ): AccountType_mutation_response + + """ + delete single row from the table: "AccountType" + """ + delete_AccountType_by_pk(type: String!): AccountType + + """ + delete data from the table: "EnneagramType" + """ + delete_EnneagramType( + """filter the rows which have to be deleted""" + where: EnneagramType_bool_exp! + ): EnneagramType_mutation_response + + """ + delete single row from the table: "EnneagramType" + """ + delete_EnneagramType_by_pk(name: String!): EnneagramType + """ delete data from the table: "Guild" """ @@ -819,6 +1195,28 @@ type mutation_root { on_conflict: Account_on_conflict ): Account_mutation_response + """ + insert data into the table: "AccountType" + """ + insert_AccountType( + """the rows to be inserted""" + objects: [AccountType_insert_input!]! + + """on conflict condition""" + on_conflict: AccountType_on_conflict + ): AccountType_mutation_response + + """ + insert a single row into the table: "AccountType" + """ + insert_AccountType_one( + """the row to be inserted""" + object: AccountType_insert_input! + + """on conflict condition""" + on_conflict: AccountType_on_conflict + ): AccountType + """ insert a single row into the table: "Account" """ @@ -830,6 +1228,28 @@ type mutation_root { on_conflict: Account_on_conflict ): Account + """ + insert data into the table: "EnneagramType" + """ + insert_EnneagramType( + """the rows to be inserted""" + objects: [EnneagramType_insert_input!]! + + """on conflict condition""" + on_conflict: EnneagramType_on_conflict + ): EnneagramType_mutation_response + + """ + insert a single row into the table: "EnneagramType" + """ + insert_EnneagramType_one( + """the row to be inserted""" + object: EnneagramType_insert_input! + + """on conflict condition""" + on_conflict: EnneagramType_on_conflict + ): EnneagramType + """ insert data into the table: "Guild" """ @@ -1000,6 +1420,46 @@ type mutation_root { where: Account_bool_exp! ): Account_mutation_response + """ + update data of the table: "AccountType" + """ + update_AccountType( + """sets the columns of the filtered rows to the given values""" + _set: AccountType_set_input + + """filter the rows which have to be updated""" + where: AccountType_bool_exp! + ): AccountType_mutation_response + + """ + update single row of the table: "AccountType" + """ + update_AccountType_by_pk( + """sets the columns of the filtered rows to the given values""" + _set: AccountType_set_input + pk_columns: AccountType_pk_columns_input! + ): AccountType + + """ + update data of the table: "EnneagramType" + """ + update_EnneagramType( + """sets the columns of the filtered rows to the given values""" + _set: EnneagramType_set_input + + """filter the rows which have to be updated""" + where: EnneagramType_bool_exp! + ): EnneagramType_mutation_response + + """ + update single row of the table: "EnneagramType" + """ + update_EnneagramType_by_pk( + """sets the columns of the filtered rows to the given values""" + _set: EnneagramType_set_input + pk_columns: EnneagramType_pk_columns_input! + ): EnneagramType + """ update data of the table: "Guild" """ @@ -1267,7 +1727,7 @@ type Player { """Remote relationship field""" daohausMemberships: [Member!]! - enneagram: enneagram_type + enneagram: EnneagramType_enum ethereum_address: String id: uuid! rank: Player_Rank_enum @@ -1353,7 +1813,7 @@ input Player_bool_exp { _not: Player_bool_exp _or: [Player_bool_exp] created_at: timestamptz_comparison_exp - enneagram: enneagram_type_comparison_exp + enneagram: EnneagramType_enum_comparison_exp ethereum_address: String_comparison_exp id: uuid_comparison_exp rank: Player_Rank_enum_comparison_exp @@ -1397,7 +1857,7 @@ input Player_insert_input { Accounts: Account_arr_rel_insert_input Player_Skills: Player_Skill_arr_rel_insert_input created_at: timestamptz - enneagram: enneagram_type + enneagram: EnneagramType_enum ethereum_address: String id: uuid rank: Player_Rank_enum @@ -1736,7 +2196,7 @@ input type for updating data in table "Player" """ input Player_set_input { created_at: timestamptz - enneagram: enneagram_type + enneagram: EnneagramType_enum ethereum_address: String id: uuid rank: Player_Rank_enum @@ -2093,6 +2553,49 @@ type query_root { where: Account_bool_exp ): [Account!]! + """ + fetch data from the table: "AccountType" + """ + AccountType( + """distinct select on columns""" + distinct_on: [AccountType_select_column!] + + """limit the number of rows returned""" + limit: Int + + """skip the first n rows. Use only with order_by""" + offset: Int + + """sort the rows by one or more columns""" + order_by: [AccountType_order_by!] + + """filter the rows returned""" + where: AccountType_bool_exp + ): [AccountType!]! + + """ + fetch aggregated fields from the table: "AccountType" + """ + AccountType_aggregate( + """distinct select on columns""" + distinct_on: [AccountType_select_column!] + + """limit the number of rows returned""" + limit: Int + + """skip the first n rows. Use only with order_by""" + offset: Int + + """sort the rows by one or more columns""" + order_by: [AccountType_order_by!] + + """filter the rows returned""" + where: AccountType_bool_exp + ): AccountType_aggregate! + + """fetch data from the table: "AccountType" using primary key columns""" + AccountType_by_pk(type: String!): AccountType + """ fetch aggregated fields from the table: "Account" """ @@ -2113,6 +2616,49 @@ type query_root { where: Account_bool_exp ): Account_aggregate! + """ + fetch data from the table: "EnneagramType" + """ + EnneagramType( + """distinct select on columns""" + distinct_on: [EnneagramType_select_column!] + + """limit the number of rows returned""" + limit: Int + + """skip the first n rows. Use only with order_by""" + offset: Int + + """sort the rows by one or more columns""" + order_by: [EnneagramType_order_by!] + + """filter the rows returned""" + where: EnneagramType_bool_exp + ): [EnneagramType!]! + + """ + fetch aggregated fields from the table: "EnneagramType" + """ + EnneagramType_aggregate( + """distinct select on columns""" + distinct_on: [EnneagramType_select_column!] + + """limit the number of rows returned""" + limit: Int + + """skip the first n rows. Use only with order_by""" + offset: Int + + """sort the rows by one or more columns""" + order_by: [EnneagramType_order_by!] + + """filter the rows returned""" + where: EnneagramType_bool_exp + ): EnneagramType_aggregate! + + """fetch data from the table: "EnneagramType" using primary key columns""" + EnneagramType_by_pk(name: String!): EnneagramType + """ fetch data from the table: "Guild" """ @@ -2855,6 +3401,49 @@ type subscription_root { where: Account_bool_exp ): [Account!]! + """ + fetch data from the table: "AccountType" + """ + AccountType( + """distinct select on columns""" + distinct_on: [AccountType_select_column!] + + """limit the number of rows returned""" + limit: Int + + """skip the first n rows. Use only with order_by""" + offset: Int + + """sort the rows by one or more columns""" + order_by: [AccountType_order_by!] + + """filter the rows returned""" + where: AccountType_bool_exp + ): [AccountType!]! + + """ + fetch aggregated fields from the table: "AccountType" + """ + AccountType_aggregate( + """distinct select on columns""" + distinct_on: [AccountType_select_column!] + + """limit the number of rows returned""" + limit: Int + + """skip the first n rows. Use only with order_by""" + offset: Int + + """sort the rows by one or more columns""" + order_by: [AccountType_order_by!] + + """filter the rows returned""" + where: AccountType_bool_exp + ): AccountType_aggregate! + + """fetch data from the table: "AccountType" using primary key columns""" + AccountType_by_pk(type: String!): AccountType + """ fetch aggregated fields from the table: "Account" """ @@ -2875,6 +3464,49 @@ type subscription_root { where: Account_bool_exp ): Account_aggregate! + """ + fetch data from the table: "EnneagramType" + """ + EnneagramType( + """distinct select on columns""" + distinct_on: [EnneagramType_select_column!] + + """limit the number of rows returned""" + limit: Int + + """skip the first n rows. Use only with order_by""" + offset: Int + + """sort the rows by one or more columns""" + order_by: [EnneagramType_order_by!] + + """filter the rows returned""" + where: EnneagramType_bool_exp + ): [EnneagramType!]! + + """ + fetch aggregated fields from the table: "EnneagramType" + """ + EnneagramType_aggregate( + """distinct select on columns""" + distinct_on: [EnneagramType_select_column!] + + """limit the number of rows returned""" + limit: Int + + """skip the first n rows. Use only with order_by""" + offset: Int + + """sort the rows by one or more columns""" + order_by: [EnneagramType_order_by!] + + """filter the rows returned""" + where: EnneagramType_bool_exp + ): EnneagramType_aggregate! + + """fetch data from the table: "EnneagramType" using primary key columns""" + EnneagramType_by_pk(name: String!): EnneagramType + """ fetch data from the table: "Guild" """ diff --git a/packages/web/graphql/fragments.ts b/packages/web/graphql/fragments.ts index 7abac274..16f861e8 100644 --- a/packages/web/graphql/fragments.ts +++ b/packages/web/graphql/fragments.ts @@ -7,7 +7,7 @@ export const PlayerFragment = gql` totalXp rank ethereum_address - Accounts(where: { type: { _in: ["TWITTER", "GITHUB"] } }) { + Accounts(where: { type: { _in: [TWITTER, GITHUB] } }) { identifier type } diff --git a/yarn.lock b/yarn.lock index 0fb90ff1..21495a13 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12362,7 +12362,7 @@ eslint-config-airbnb-base@^14.2.0: object.assign "^4.1.0" object.entries "^1.1.2" -eslint-config-airbnb-typescript@9.0: +eslint-config-airbnb-typescript@9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-9.0.0.tgz#2524f3fa6fceb3df4ae191d1e1114a04fe54c6e6" integrity sha512-BxckAZU4rwfOidZVucAO120fTSGQAugimS8HFp7OoiordpyNkq5bxSlTPZ2XxSY8Q2NWDIygqtJKqupZld/TXA==