From 062a6fd096e19de53426b173ff6409ef6a95ec0f Mon Sep 17 00:00:00 2001 From: Xavier <5632966+xavier506@users.noreply.github.com> Date: Thu, 13 May 2021 14:36:40 -0600 Subject: [PATCH] Publish changes to prod (#566) * avoid statefulsets update errors on actions runs refs #535. (#536) * deprecate demux service. refs #538 (#540) * add handler url from env var & other minor bug fixes (#542) * Add missing env var to config map (#543) * add handler url from env var & other minor bug fixes * add missing env var * fix: update some env vars * fix: update some env vars * fix: replace .env values with the previous ones * Feat/add tx link (#545) * feat: add tx link * feat: remove secrets * setup env workflow (#546) * wip * wip: add env files & db_data to .gitignore * fix: remove .env files * fix: remove .env files * fix: delete unnecessary code * refactor: remove unnecessary code * fix: minimal * Fix/rate action buttons not showing (#547) * wip * wip: add env files & db_data to .gitignore * fix: remove .env files * fix: remove .env files * fix: delete unnecessary code * refactor: remove unnecessary code * fix: minimal * fix: rate buttons not showing in certains densities * Fix/hasura console config (#556) * Deploy to mainnet (#544) * avoid statefulsets update errors on actions runs refs #535. (#536) * deprecate demux service. refs #538 (#540) * add handler url from env var & other minor bug fixes (#542) * Add missing env var to config map (#543) * add handler url from env var & other minor bug fixes * add missing env var * fix: update some env vars * fix: update some env vars * fix: replace .env values with the previous ones Co-authored-by: Andres Gomez Co-authored-by: JustinCast * wip * wip: add env files & db_data to .gitignore * fix: remove .env files * fix: remove .env files * fix: delete unnecessary code * refactor: remove unnecessary code * fix: minimal * feat: voting tool revamp * fix: remove comments * fix: add i18n entries * fix: bug fixes * fix: hasura console config Co-authored-by: Xavier <5632966+xavier506@users.noreply.github.com> Co-authored-by: Andres Gomez * Fix/add missing i18n entries (#554) * Deploy to mainnet (#544) * avoid statefulsets update errors on actions runs refs #535. (#536) * deprecate demux service. refs #538 (#540) * add handler url from env var & other minor bug fixes (#542) * Add missing env var to config map (#543) * add handler url from env var & other minor bug fixes * add missing env var * fix: update some env vars * fix: update some env vars * fix: replace .env values with the previous ones Co-authored-by: Andres Gomez Co-authored-by: JustinCast * wip * wip: add env files & db_data to .gitignore * fix: remove .env files * fix: remove .env files * fix: delete unnecessary code * refactor: remove unnecessary code * fix: minimal * feat: voting tool revamp * fix: remove comments * fix: add i18n entries * fix: bug fixes Co-authored-by: Xavier <5632966+xavier506@users.noreply.github.com> Co-authored-by: Andres Gomez * docs: add env example (#565) * fix: not able to sync proxies locally (#564) * fix: update hasura version * fix: hasura version && other minor bug fixes * Fix/update hasura version (#567) * fix: remove build:staging statement * latest changes Co-authored-by: Andres Gomez Co-authored-by: JustinCast --- .env.example | 27 ++++ .../workflows/push-master-environment.yaml | 2 +- .../workflows/push-staging-environment.yaml | 4 +- .gitignore | 13 +- docker-compose.staging.yml | 29 ++-- docker-compose.yml | 58 ++++---- makefile | 67 +++++++-- scripts/develop.sh | 13 -- scripts/flush.sh | 3 - scripts/fresh.sh | 3 +- scripts/hasura.sh | 4 - scripts/start.sh | 3 - scripts/stop.sh | 5 - services/frontend/.env.production | 8 -- services/frontend/Dockerfile | 20 ++- services/frontend/makefile | 14 +- services/frontend/package.json | 7 +- .../src/components/bp-chip-avatar/styles.js | 1 + .../frontend/src/components/card/index.js | 4 +- .../frontend/src/components/card/styles.js | 7 +- .../compare-tool/compare-graph-view.js | 9 +- .../src/components/compare-tool/index.js | 10 +- .../src/components/compare-tool/styles.js | 12 +- .../src/components/main-drawer/index.js | 2 - .../frontend/src/components/radar/index.js | 1 + services/frontend/src/config/index.js | 3 +- services/frontend/src/language/en.json | 9 +- services/frontend/src/language/es.json | 7 + .../block-producers/block-producer-rate.js | 95 +++++++------ .../bottom-sheet-selected-bps.js | 27 ++++ .../src/routes/block-producers/index.js | 63 +++++++-- .../src/routes/block-producers/styles.js | 40 +++++- services/frontend/src/routes/proxies/index.js | 4 +- .../src/routes/proxies/proxy-profile.js | 2 +- services/frontend/src/services/api.js | 8 +- services/hapi/makefile | 6 +- services/hapi/src/index.js | 4 +- services/hapi/src/libs/sync-proxies.js | 24 ++-- services/hasura/Dockerfile | 6 +- services/hasura/metadata/actions.graphql | 26 ++++ services/hasura/metadata/actions.yaml | 15 +++ services/hasura/metadata/allow_list.yaml | 1 + services/hasura/metadata/functions.yaml | 1 + .../hasura/metadata/query_collections.yaml | 1 + services/hasura/metadata/remote_schemas.yaml | 1 + services/hasura/metadata/tables.yaml | 88 ++++++++++++ services/hasura/metadata/version.yaml | 1 + .../1548725474630_create_producers.up.sql | 6 + .../1548725474630_create_producers.up.yaml | 13 -- ...48730845804_create_producer_ratings.up.sql | 7 + ...8730845804_create_producer_ratings.up.yaml | 14 -- ...1548732282821_create_producers_list.up.sql | 10 ++ ...548732282821_create_producers_list.up.yaml | 17 --- .../1580686687967_add_ratings_table/up.sql | 2 + .../1580686687967_add_ratings_table/up.yaml | 11 -- .../down.sql | 3 + .../down.yaml | 6 - .../up.sql | 3 + .../up.yaml | 6 - .../down.sql | 3 + .../down.yaml | 6 - .../up.sql | 3 + .../up.yaml | 6 - .../1580754206808_add_extra_data/up.sql | 4 + .../1580754206808_add_extra_data/up.yaml | 7 - .../down.sql | 2 + .../down.yaml | 3 - .../up.sql | 2 + .../up.yaml | 3 - .../up.sql | 15 +++ .../up.yaml | 10 -- .../down.sql | 2 + .../down.yaml | 5 - .../up.sql | 2 + .../up.yaml | 5 - .../down.sql | 2 + .../down.yaml | 5 - .../up.sql | 2 + .../up.yaml | 6 - .../down.sql | 5 + .../down.yaml | 11 -- .../up.sql | 5 + .../up.yaml | 11 -- .../down.sql | 2 + .../down.yaml | 5 - .../up.sql | 2 + .../up.yaml | 5 - .../down.sql | 2 + .../down.yaml | 5 - .../up.sql | 2 + .../up.yaml | 5 - .../down.yaml | 9 -- .../up.yaml | 35 ----- .../down.yaml | 37 ----- .../up.yaml | 36 ----- .../down.yaml | 37 ----- .../up.yaml | 36 ----- .../down.yaml | 37 ----- .../up.yaml | 36 ----- .../down.yaml | 37 ----- .../up.yaml | 36 ----- .../down.yaml | 37 ----- .../up.yaml | 36 ----- .../up.sql | 16 +++ .../up.yaml | 11 -- .../up.sql | 17 +++ .../up.yaml | 12 -- .../down.sql | 2 + .../down.yaml | 5 - .../up.sql | 2 + .../up.yaml | 12 -- .../down.yaml | 37 ----- .../up.yaml | 37 ----- .../down.yaml | 6 - .../up.yaml | 25 ---- .../down.yaml | 6 - .../up.yaml | 24 ---- .../down.yaml | 6 - .../up.yaml | 22 --- .../down.yaml | 6 - .../up.yaml | 17 --- .../1587692968903_save_action_perm/down.yaml | 4 - .../1587692968903_save_action_perm/up.yaml | 7 - .../down.yaml | 6 - .../up.yaml | 9 -- .../down.yaml | 45 ------- .../up.yaml | 54 -------- .../down.yaml | 58 -------- .../up.yaml | 57 -------- services/hasura/migrations/metadata.yaml | 127 ------------------ 130 files changed, 662 insertions(+), 1386 deletions(-) create mode 100644 .env.example delete mode 100755 scripts/develop.sh delete mode 100755 scripts/flush.sh delete mode 100755 scripts/hasura.sh delete mode 100755 scripts/start.sh delete mode 100755 scripts/stop.sh delete mode 100644 services/frontend/.env.production create mode 100644 services/frontend/src/routes/block-producers/bottom-sheet-selected-bps.js create mode 100644 services/hasura/metadata/actions.graphql create mode 100644 services/hasura/metadata/actions.yaml create mode 100644 services/hasura/metadata/allow_list.yaml create mode 100644 services/hasura/metadata/functions.yaml create mode 100644 services/hasura/metadata/query_collections.yaml create mode 100644 services/hasura/metadata/remote_schemas.yaml create mode 100644 services/hasura/metadata/tables.yaml create mode 100644 services/hasura/metadata/version.yaml create mode 100755 services/hasura/migrations/1548725474630_create_producers.up.sql delete mode 100644 services/hasura/migrations/1548725474630_create_producers.up.yaml create mode 100755 services/hasura/migrations/1548730845804_create_producer_ratings.up.sql delete mode 100644 services/hasura/migrations/1548730845804_create_producer_ratings.up.yaml create mode 100755 services/hasura/migrations/1548732282821_create_producers_list.up.sql delete mode 100644 services/hasura/migrations/1548732282821_create_producers_list.up.yaml create mode 100755 services/hasura/migrations/1580686687967_add_ratings_table/up.sql delete mode 100644 services/hasura/migrations/1580686687967_add_ratings_table/up.yaml create mode 100755 services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/down.sql delete mode 100644 services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/down.yaml create mode 100755 services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/up.sql delete mode 100644 services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/up.yaml create mode 100755 services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/down.sql delete mode 100644 services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/down.yaml create mode 100755 services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/up.sql delete mode 100644 services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/up.yaml create mode 100755 services/hasura/migrations/1580754206808_add_extra_data/up.sql delete mode 100644 services/hasura/migrations/1580754206808_add_extra_data/up.yaml create mode 100755 services/hasura/migrations/1580754274249_rename_table_public_ratings/down.sql delete mode 100644 services/hasura/migrations/1580754274249_rename_table_public_ratings/down.yaml create mode 100755 services/hasura/migrations/1580754274249_rename_table_public_ratings/up.sql delete mode 100644 services/hasura/migrations/1580754274249_rename_table_public_ratings/up.yaml create mode 100755 services/hasura/migrations/1581704802407_join_producer_ratings_stats/up.sql delete mode 100644 services/hasura/migrations/1581704802407_join_producer_ratings_stats/up.yaml create mode 100755 services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/down.sql delete mode 100644 services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/down.yaml create mode 100755 services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/up.sql delete mode 100644 services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/up.yaml create mode 100755 services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/down.sql delete mode 100644 services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/down.yaml create mode 100755 services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/up.sql delete mode 100644 services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/up.yaml create mode 100755 services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/down.sql delete mode 100644 services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/down.yaml create mode 100755 services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/up.sql delete mode 100644 services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/up.yaml create mode 100755 services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/down.sql delete mode 100644 services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/down.yaml create mode 100755 services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/up.sql delete mode 100644 services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/up.yaml create mode 100755 services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/down.sql delete mode 100644 services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/down.yaml create mode 100755 services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/up.sql delete mode 100644 services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/up.yaml delete mode 100644 services/hasura/migrations/1582950844052_create_action_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1582950844052_create_action_rateProducer/up.yaml delete mode 100644 services/hasura/migrations/1582994080171_modify_action_rateProducer_to_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1582994080171_modify_action_rateProducer_to_rateProducer/up.yaml delete mode 100644 services/hasura/migrations/1582994256642_modify_action_rateProducer_to_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1582994256642_modify_action_rateProducer_to_rateProducer/up.yaml delete mode 100644 services/hasura/migrations/1583004430995_modify_action_rateProducer_to_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1583004430995_modify_action_rateProducer_to_rateProducer/up.yaml delete mode 100644 services/hasura/migrations/1583004453318_modify_action_rateProducer_to_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1583004453318_modify_action_rateProducer_to_rateProducer/up.yaml delete mode 100644 services/hasura/migrations/1583004636939_modify_action_rateProducer_to_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1583004636939_modify_action_rateProducer_to_rateProducer/up.yaml create mode 100755 services/hasura/migrations/1583531471259_add_ratings_cntr_column/up.sql delete mode 100644 services/hasura/migrations/1583531471259_add_ratings_cntr_column/up.yaml create mode 100755 services/hasura/migrations/1583953599516_add_general_info_column/up.sql delete mode 100644 services/hasura/migrations/1583953599516_add_general_info_column/up.yaml create mode 100755 services/hasura/migrations/1584293813117_create_table_public_proxies/down.sql delete mode 100644 services/hasura/migrations/1584293813117_create_table_public_proxies/down.yaml create mode 100755 services/hasura/migrations/1584293813117_create_table_public_proxies/up.sql delete mode 100644 services/hasura/migrations/1584293813117_create_table_public_proxies/up.yaml delete mode 100644 services/hasura/migrations/1587519806338_modify_action_rateProducer_to_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1587519806338_modify_action_rateProducer_to_rateProducer/up.yaml delete mode 100644 services/hasura/migrations/1587692809044_update_permission_anonymous_public_table_producers_list/down.yaml delete mode 100644 services/hasura/migrations/1587692809044_update_permission_anonymous_public_table_producers_list/up.yaml delete mode 100644 services/hasura/migrations/1587692831014_update_permission_anonymous_public_table_proxies/down.yaml delete mode 100644 services/hasura/migrations/1587692831014_update_permission_anonymous_public_table_proxies/up.yaml delete mode 100644 services/hasura/migrations/1587692841531_update_permission_anonymous_public_table_ratings_stats/down.yaml delete mode 100644 services/hasura/migrations/1587692841531_update_permission_anonymous_public_table_ratings_stats/up.yaml delete mode 100644 services/hasura/migrations/1587692864567_update_permission_anonymous_public_table_user_ratings/down.yaml delete mode 100644 services/hasura/migrations/1587692864567_update_permission_anonymous_public_table_user_ratings/up.yaml delete mode 100644 services/hasura/migrations/1587692968903_save_action_perm/down.yaml delete mode 100644 services/hasura/migrations/1587692968903_save_action_perm/up.yaml delete mode 100644 services/hasura/migrations/1591561533500_update_permission_anonymous_public_table_user_ratings/down.yaml delete mode 100644 services/hasura/migrations/1591561533500_update_permission_anonymous_public_table_user_ratings/up.yaml delete mode 100644 services/hasura/migrations/1591591375238_modify_action_rateProducer_to_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1591591375238_modify_action_rateProducer_to_rateProducer/up.yaml delete mode 100644 services/hasura/migrations/1591592964244_modify_action_rateProducer_to_rateProducer/down.yaml delete mode 100644 services/hasura/migrations/1591592964244_modify_action_rateProducer_to_rateProducer/up.yaml delete mode 100644 services/hasura/migrations/metadata.yaml diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..b9182a67 --- /dev/null +++ b/.env.example @@ -0,0 +1,27 @@ +# POSTGRES +DB_USER=userhere +DB_PASSWORD=passhere +DB_NAME=dbnamehere +DB_PORT=dbporthere +POSTGRES_DATA=./db_data + +# HAPI +VIRTUAL_HOST=virtualhosthere +VIRTUAL_PORT=virtualporthere +EOS_API_ENDPOINT=https://jungle.eosio.cr +PROXY_INFO_CONTRACT_CODE=proxyaccount +PROXY_INFO_CONTRACT_SCOPE=proxyaccount + +# HASURA +HASURA_GRAPHQL_DATABASE_URL=dburlhere +HASURA_GRAPHQL_ADMIN_SECRET=hasurasecrethere +HASURA_GRAPHQL_UNAUTHORIZED_ROLE=rolehere + +# WEBAPP +REACT_APP_GRAPHQL_HTTP_URL=http://localhost:8080/v1/graphql +REACT_APP_GRAPHQL_WS_URL=ws://localhost:8080/v1/graphql +REACT_APP_EOS_API_URL=https://jungle.eosio.cr +REACT_APP_EOS_API_HOST=jungle.eosio.cr +REACT_APP_EOS_API_PORT=443 +REACT_APP_EOS_API_PROTOCOL=https +REACT_APP_EOS_CHAIN_ID=2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840 \ No newline at end of file diff --git a/.github/workflows/push-master-environment.yaml b/.github/workflows/push-master-environment.yaml index c93de1b4..e9c9fa09 100644 --- a/.github/workflows/push-master-environment.yaml +++ b/.github/workflows/push-master-environment.yaml @@ -71,7 +71,7 @@ jobs: DB_SCHEMA: ${{ secrets.DB_SCHEMA }} EOS_API_ENDPOINT: https://bp.cryptolions.io VIRTUAL_HOST: 0.0.0.0 - VIRTUAL_PORT: "9090" + VIRTUAL_PORT: 9090 # hasura HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }} HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations diff --git a/.github/workflows/push-staging-environment.yaml b/.github/workflows/push-staging-environment.yaml index ef707a55..a3e50725 100644 --- a/.github/workflows/push-staging-environment.yaml +++ b/.github/workflows/push-staging-environment.yaml @@ -71,7 +71,7 @@ jobs: DB_SCHEMA: ${{ secrets.DB_SCHEMA }} EOS_API_ENDPOINT: https://jungle3.cryptolions.io VIRTUAL_HOST: 0.0.0.0 - VIRTUAL_PORT: "9090" + VIRTUAL_PORT: 9090 # hasura HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }} HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations @@ -88,4 +88,4 @@ jobs: NAMESPACE: jungle-eosrate K8S_BUILD_DIR: build_k8s with: - args: version && make deploy-kubernetes \ No newline at end of file + args: version && make deploy-kubernetes diff --git a/.gitignore b/.gitignore index 12d57bd9..180f4a5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,4 @@ -# Compiled codes -build/ -dist/ -*.wast -# IDE's .vscode .idea *.iml @@ -23,11 +18,15 @@ temp .eslintcache # database data -.dbdata/ +db_data # wallet keys keys +# env files +.env* +!.env.example + # netlify cli .netlify/ @@ -35,4 +34,4 @@ keys __docs build_k8s/ -ssl/ +ssl/ \ No newline at end of file diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml index 7fa3e69a..107dd06a 100644 --- a/docker-compose.staging.yml +++ b/docker-compose.staging.yml @@ -38,15 +38,15 @@ services: ports: - "3005:9090" environment: - VIRTUAL_HOST: 0.0.0.0 - VIRTUAL_PORT: 9090 - DB_USER: user - DB_PASSWORD: pass - DB_PORT: 5432 - DB_NAME: eosrate + VIRTUAL_HOST: "${VIRTUAL_HOST}" + VIRTUAL_PORT: "${VIRTUAL_PORT}" + DB_USER: "${DB_USER}" + DB_PASSWORD: "${DB_PASSWORD}" + DB_PORT: "${DB_PORT}" + DB_NAME: "${DB_NAME}" DB_HOST: postgres DB_SCHEMA: public - EOS_API_ENDPOINT: "https://jungle.eosio.cr" + EOS_API_ENDPOINT: "${EOS_API_ENDPOINT}" depends_on: - postgres @@ -64,14 +64,14 @@ services: - postgres - hasura environment: - DB_USER: user - DB_PASSWORD: pass - DB_PORT: 5432 - DB_NAME: eosrate + DB_USER: "${DB_USER}" + DB_PASSWORD: "${DB_PASSWORD}" + DB_PORT: "${DB_PORT}" + DB_NAME: "${DB_NAME}" DB_HOST: postgres DB_SCHEMA: public - EOS_API_ENDPOINT: "https://jungle.eosio.cr" - WAIT_HOSTS: postgres:5432, hasura:8080 + EOS_API_ENDPOINT: "${EOS_API_ENDPOINT}" + WAIT_HOSTS: postgres:"${DB_PORT}" , hasura:8080 WAIT_HOSTS_TIMEOUT: 60 ports: - "3030:3030" @@ -80,7 +80,7 @@ services: hasura: container_name: eosrate_hasura - image: hasura/graphql-engine:v1.2.0-beta.4.cli-migrations + image: hasura/graphql-engine:v1.3.3.cli-migrations-v2 ports: - "8088:8080" depends_on: @@ -94,6 +94,7 @@ services: HASURA_GRAPHQL_ACTION_BASE_URL: http://hapi:9090 volumes: - ./services/hasura/migrations:/hasura-migrations # mount hasura migrations folder + - ./services/hasura/migrations:/hasura-metadata command: - graphql-engine - serve diff --git a/docker-compose.yml b/docker-compose.yml index 3d23c4ef..3dfb9068 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: eosrate_postgres image: postgres:10.4 volumes: - - eosrate-postgres:/var/lib/postgresql/data + - ${POSTGRES_DATA}:/var/lib/postgresql/data ports: - "5432:5432" environment: @@ -36,17 +36,17 @@ services: - ./services/hapi:/opt/application - /opt/application/node_modules # prevents host/container conflicts ports: - - "3005:9090" + - "9090:9090" environment: - VIRTUAL_HOST: 0.0.0.0 - VIRTUAL_PORT: 9090 - DB_USER: user - DB_PASSWORD: pass - DB_PORT: 5432 - DB_NAME: eosrate + VIRTUAL_HOST: "${VIRTUAL_HOST}" + VIRTUAL_PORT: "${VIRTUAL_PORT}" + DB_USER: "${DB_USER}" + DB_PASSWORD: "${DB_PASSWORD}" + DB_PORT: "${DB_PORT}" + DB_NAME: "${DB_NAME}" DB_HOST: postgres DB_SCHEMA: public - EOS_API_ENDPOINT: "https://jungle.eosio.cr" + EOS_API_ENDPOINT: "${EOS_API_ENDPOINT}" depends_on: - postgres @@ -64,14 +64,14 @@ services: - postgres - hasura environment: - DB_USER: user - DB_PASSWORD: pass - DB_PORT: 5432 - DB_NAME: eosrate + DB_USER: "${DB_USER}" + DB_PASSWORD: "${DB_PASSWORD}" + DB_PORT: "${DB_PORT}" + DB_NAME: "${DB_NAME}" DB_HOST: postgres DB_SCHEMA: public - EOS_API_ENDPOINT: "https://jungle.eosio.cr" - WAIT_HOSTS: postgres:5432, hasura:8080 + EOS_API_ENDPOINT: "${EOS_API_ENDPOINT}" + WAIT_HOSTS: postgres:"${DB_PORT}", hasura:8080 WAIT_HOSTS_TIMEOUT: 60 ports: - "3030:3030" @@ -83,23 +83,22 @@ services: build: context: ./services/hasura dockerfile: ./Dockerfile - image: hasura/graphql-engine:v1.2.0-beta.4.cli-migrations + image: hasura/graphql-engine:v1.3.3.cli-migrations-v2 ports: - - "8088:8080" + - "8080:8080" depends_on: - postgres restart: always environment: - HASURA_GRAPHQL_DATABASE_URL: postgres://user:pass@postgres:5432/eosrate?sslmode=disable + HASURA_GRAPHQL_DATABASE_URL: "${HASURA_GRAPHQL_DATABASE_URL}" HASURA_GRAPHQL_MIGRATIONS_DIR: /hasura-migrations HASURA_GRAPHQL_ACTION_BASE_URL: http://hapi:9090 + HASURA_GRAPHQL_ADMIN_SECRET: "${HASURA_GRAPHQL_ADMIN_SECRET}" + HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "${HASURA_GRAPHQL_UNAUTHORIZED_ROLE}" volumes: - ./services/hasura/migrations:/hasura-migrations # mount hasura migrations folder - command: - - graphql-engine - - serve - - --enable-console + - ./services/hasura/migrations:/hasura-metadata frontend: container_name: eosrate_frontend @@ -113,11 +112,14 @@ services: - hapi ports: - "80:80" + environment: + REACT_APP_GRAPHQL_HTTP_URL: "${REACT_APP_GRAPHQL_HTTP_URL}" + REACT_APP_GRAPHQL_WS_URL: "${REACT_APP_GRAPHQL_WS_URL}" + REACT_APP_EOS_API_URL: "${REACT_APP_EOS_API_URL}" + REACT_APP_EOS_API_HOST: "${REACT_APP_EOS_API_HOST}" + REACT_APP_EOS_API_PORT: "${REACT_APP_EOS_API_PORT}" + REACT_APP_EOS_API_PROTOCOL: "${REACT_APP_EOS_API_PROTOCOL}" + REACT_APP_EOS_CHAIN_ID: "${REACT_APP_EOS_CHAIN_ID}" + REACT_APP_BLOCK_EXPLORER: "${REACT_APP_BLOCK_EXPLORER}" networks: default: - -volumes: - eosrate-postgres: - -networks: - default: diff --git a/makefile b/makefile index 78ee7997..060b6b0d 100644 --- a/makefile +++ b/makefile @@ -1,25 +1,68 @@ include utils/meta.mk +#COLORS +WHITE := $(shell tput -Txterm setaf 7) +BLUE := $(shell tput -Txterm setaf 6) +YELLOW := $(shell tput -Txterm setaf 3) +GREEN := $(shell tput -Txterm setaf 2) +RESET := $(shell tput -Txterm sgr0) + K8S_BUILD_DIR ?= ./build_k8s K8S_FILES := $(shell find ./kubernetes -name '*.yaml' | sed 's:./kubernetes/::g') -dev: scripts/develop.sh - ./scripts/develop.sh +stop: + @docker-compose stop -start: scripts/start.sh - ./scripts/start.sh +## MAKE SURE YOU HAVE INITIALIZED THE PROJECT (make start) BEFORE RUN THIS +fresh: scripts/fresh.sh + ./scripts/fresh.sh -stop: scripts/stop.sh - ./scripts/stop.sh +start: + make -B start-postgres + make -B start-hapi + make -B start-hasura + make -B -j 3 start-hasura-cli start-logs start-frontend -flush: scripts/flush.sh - ./scripts/flush.sh +start-postgres: + @docker-compose up -d --build postgres -fresh: scripts/fresh.sh - ./scripts/fresh.sh +start-hapi: + @docker-compose up -d --build hapi + +start-hasura: + $(eval -include .env) + @until \ + docker-compose exec -T postgres pg_isready; \ + do echo "$(BLUE)$(STAGE)-$(APP_NAME)-hasura |$(RESET) waiting for postgres service"; \ + sleep 5; done; + @until \ + curl http://localhost:9090; \ + do echo "$(BLUE)$(STAGE)-$(APP_NAME)-hasura |$(RESET) waiting for hapi service"; \ + sleep 5; done; + @echo "..." + @docker-compose stop hasura + @docker-compose up -d --build hasura + +start-hasura-cli: + $(eval -include .env) + @until \ + curl http://localhost:8080; \ + do echo "$(BLUE)$(STAGE)-$(APP_NAME)-hasura |$(RESET) ..."; \ + sleep 5; done; + @echo "..." + @cd services/hasura && hasura console --endpoint http://localhost:8080 --skip-update-check; + +start-frontend: + $(eval -include .env) + @until \ + curl -s -o /dev/null -w 'hasura status %{http_code}\n' http://localhost:8080; \ + do echo "$(BLUE)$(STAGE)-$(APP_NAME)-frontend |$(RESET) waiting for hasura service"; \ + sleep 5; done; + @cd services/frontend && yarn && yarn start | cat + @echo "done frontend start" -hasura: scripts/hasura.sh - ./scripts/hasura.sh +start-logs: + @docker-compose logs -f hapi frontend migrate: scripts/migrate.sh ./scripts/migrate.sh diff --git a/scripts/develop.sh b/scripts/develop.sh deleted file mode 100755 index f8864744..00000000 --- a/scripts/develop.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -echo "Starting local development environment..." -docker-compose up -d --build postgres hasura hapi - -# wait 10s for the docker services to start -sleep 10s - -# start the reactjs client -cd services/frontend -yarn -yarn start - -cd ../.. diff --git a/scripts/flush.sh b/scripts/flush.sh deleted file mode 100755 index a353eef2..00000000 --- a/scripts/flush.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -echo "Flushing all docker containers and volumes" -docker-compose down -v diff --git a/scripts/fresh.sh b/scripts/fresh.sh index 0ca3e77d..e1eb681a 100755 --- a/scripts/fresh.sh +++ b/scripts/fresh.sh @@ -1,6 +1,7 @@ #!/bin/bash echo "Seeding Database and Syncing with Blockchain Tables" -cd ../services/hapi/src/libs/ +cd services/hapi/src/libs/ +pwd node sync-bps.js node sync-proxies.js node sync-ratings.js diff --git a/scripts/hasura.sh b/scripts/hasura.sh deleted file mode 100755 index f18d43d7..00000000 --- a/scripts/hasura.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -echo "Starting up hasura console" -cd ./services/hasura -hasura console diff --git a/scripts/start.sh b/scripts/start.sh deleted file mode 100755 index b986d902..00000000 --- a/scripts/start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -echo "Starting docker containers" -docker-compose up -d --build postgres hasura hapi frontend diff --git a/scripts/stop.sh b/scripts/stop.sh deleted file mode 100755 index 61136ac1..00000000 --- a/scripts/stop.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -echo "Stopping all eos-rate services.." - -docker-compose down diff --git a/services/frontend/.env.production b/services/frontend/.env.production deleted file mode 100644 index 320e1fed..00000000 --- a/services/frontend/.env.production +++ /dev/null @@ -1,8 +0,0 @@ -REACT_APP_GRAPHQL_HTTP_URL=https://graphql.eosrate.io/v1/graphql -REACT_APP_API_URL=https://api.eosio.cr -REACT_APP_GRAPHQL_WS_URL=wss://graphql.eosrate.io/v1/graphql -REACT_APP_EOS_API_URL=https://api.eosio.cr -REACT_APP_EOS_API_HOST=api.eosio.cr -REACT_APP_EOS_API_PORT=443 -REACT_APP_EOS_API_PROTOCOL=https -REACT_APP_EOS_CHAIN_ID=aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906 \ No newline at end of file diff --git a/services/frontend/Dockerfile b/services/frontend/Dockerfile index d7711400..e91c0dbe 100644 --- a/services/frontend/Dockerfile +++ b/services/frontend/Dockerfile @@ -1,6 +1,24 @@ FROM node:12-slim as builder ARG branch +ARG react_app_graphql_http_url +ARG react_app_api_url +ARG react_app_graphql_ws_url +ARG react_app_eos_api_url +ARG react_app_eos_api_host +ARG react_app_eos_api_port +ARG react_app_eos_api_protocol +ARG react_app_eos_chain_id +ARG react_app_block_explorer + +ENV REACT_APP_GRAPHQL_HTTP_URL $react_app_graphql_http_url +ENV REACT_APP_GRAPHQL_WS_URL $react_app_graphql_ws_url +ENV REACT_APP_EOS_API_URL $react_app_eos_api_url +ENV REACT_APP_EOS_API_HOST $react_app_eos_api_host +ENV REACT_APP_EOS_API_PORT $react_app_eos_api_port +ENV REACT_APP_EOS_API_PROTOCOL $react_app_eos_api_protocol +ENV REACT_APP_EOS_CHAIN_ID $react_app_eos_chain_id +ENV REACT_APP_BLOCK_EXPLORER $react_app_block_explorer WORKDIR /usr/src/app @@ -14,7 +32,7 @@ COPY . . ENV GENERATE_SOURCEMAP false -RUN yarn build:"$branch" +RUN yarn build FROM nginx:1.16.1-alpine as server diff --git a/services/frontend/makefile b/services/frontend/makefile index 0e22044b..be2bb5d3 100644 --- a/services/frontend/makefile +++ b/services/frontend/makefile @@ -4,16 +4,16 @@ LATEST_TAG ?= latest install: ##@local Install all dependencies install: - @npm install + @yarn clean-install: ##@local Reinstalls all dependencies clean-install: @rm -Rf node_modules - @npm install + @yarn run: ##@local Run the project locally (without docker) run: node_modules - @$(SHELL_EXPORT) npm run dev + @$(SHELL_EXPORT) yarn run dev build-docker: ##@devops Build the docker image build-docker: ./Dockerfile @@ -22,6 +22,14 @@ build-docker: ./Dockerfile @docker build \ -t $(DOCKER_REGISTRY)/$(IMAGE_NAME_WEBAPP):$(VERSION) --target server \ -t $(DOCKER_REGISTRY)/$(IMAGE_NAME_WEBAPP):$(LATEST_TAG) --target server \ + --build-arg react_app_graphql_http_url="$(REACT_APP_GRAPHQL_HTTP_URL)" \ + --build-arg react_app_graphql_ws_url="$(REACT_APP_GRAPHQL_WS_URL)" \ + --build-arg react_app_eos_api_url="$(REACT_APP_EOS_API_URL)" \ + --build-arg react_app_eos_api_host="$(REACT_APP_EOS_API_HOST)" \ + --build-arg react_app_eos_api_port="$(REACT_APP_EOS_API_PORT)" \ + --build-arg react_app_eos_api_protocol="$(REACT_APP_EOS_API_PROTOCOL)" \ + --build-arg react_app_eos_chain_id="$(REACT_APP_EOS_CHAIN_ID)" \ + --build-arg REACT_APP_BLOCK_EXPLORER="$(REACT_APP_BLOCK_EXPLORER)" \ --build-arg branch="$(BRANCH)" \ . diff --git a/services/frontend/package.json b/services/frontend/package.json index 72a6f60f..9243692a 100644 --- a/services/frontend/package.json +++ b/services/frontend/package.json @@ -9,12 +9,9 @@ "scripts": { "precommit": "pretty-quick --staged && lint-staged", "lint": "eslint .", - "start": "env-cmd -f .env react-scripts start", - "start:staging": "env-cmd -f .env.staging react-scripts start", + "start": "env-cmd -f ../../.env react-scripts start", "prod": "serve -l 9000 --single ./build", - "build": "env-cmd -f .env react-scripts build", - "build:staging": "env-cmd -f .env.staging react-scripts build", - "build:production": "env-cmd -f .env.production react-scripts build", + "build": "react-scripts build", "test": "env-cmd -f .env react-scripts test --env=jsdom", "eject": "react-scripts eject", "now": "now --public --npm && now alias", diff --git a/services/frontend/src/components/bp-chip-avatar/styles.js b/services/frontend/src/components/bp-chip-avatar/styles.js index 2b03b89d..9a585829 100644 --- a/services/frontend/src/components/bp-chip-avatar/styles.js +++ b/services/frontend/src/components/bp-chip-avatar/styles.js @@ -2,6 +2,7 @@ export default (props) => ({ root: { margin: 8, color: 'white', + width: 160, backgroundColor: (props) => props.color } }) diff --git a/services/frontend/src/components/card/index.js b/services/frontend/src/components/card/index.js index b7496117..0a6f3371 100644 --- a/services/frontend/src/components/card/index.js +++ b/services/frontend/src/components/card/index.js @@ -167,7 +167,7 @@ const CardData = ({ aria-label='Add to comparison' onClick={toggleSelection(!isSelected, owner)} > - {isSelected ? 'REMOVE' : buttonLabel} + {isSelected ? t('remove') : buttonLabel} {useRateButton && ( )} diff --git a/services/frontend/src/components/card/styles.js b/services/frontend/src/components/card/styles.js index 3966a0bd..0af4ffe4 100644 --- a/services/frontend/src/components/card/styles.js +++ b/services/frontend/src/components/card/styles.js @@ -1,6 +1,7 @@ export default (theme) => ({ card: { - backgroundColor: theme.palette.surface.dark + backgroundColor: theme.palette.surface.dark, + minWidth: 320 }, title: { textDecoration: 'none', @@ -32,8 +33,8 @@ export default (theme) => ({ height: '90%' }, btnRate: { - backgroundColor: theme.palette.secondary.main, - color: '#ffffff', + backgroundColor: theme.palette.primary.main, + color: 'white', '&:hover': { backgroundColor: theme.palette.secondary.dark } diff --git a/services/frontend/src/components/compare-tool/compare-graph-view.js b/services/frontend/src/components/compare-tool/compare-graph-view.js index a88a8c26..56dc66f3 100644 --- a/services/frontend/src/components/compare-tool/compare-graph-view.js +++ b/services/frontend/src/components/compare-tool/compare-graph-view.js @@ -3,8 +3,6 @@ import PropTypes from 'prop-types' import { makeStyles } from '@material-ui/core/styles' import Grid from '@material-ui/core/Grid' import CardHeader from '@material-ui/core/CardHeader' -import CloseIcon from '@material-ui/icons/HighlightOffOutlined' -import IconButton from '@material-ui/core/IconButton' import Typography from '@material-ui/core/Typography' import Avatar from '@material-ui/core/Avatar' import LockOpenIcon from '@material-ui/icons/LockOpenOutlined' @@ -135,7 +133,6 @@ const CompareGraphView = ({ isProxy, userInfo, width, - onHandleClose, ...props }) => { const { t } = useTranslation('translations') @@ -177,9 +174,6 @@ const CompareGraphView = ({ isUser={userInfo.isUser} /> - - - ) : ( @@ -86,11 +85,20 @@ const CompareTool = ({ } label={t('compareToolCollapsedSwitch')} /> + + + + + + + )} {showAlert && ( - - {t('infoMessage')} - + + + {t('infoMessage')} + + )} diff --git a/services/frontend/src/routes/block-producers/bottom-sheet-selected-bps.js b/services/frontend/src/routes/block-producers/bottom-sheet-selected-bps.js new file mode 100644 index 00000000..30e26f29 --- /dev/null +++ b/services/frontend/src/routes/block-producers/bottom-sheet-selected-bps.js @@ -0,0 +1,27 @@ +import React from 'react' +import PropTypes from 'prop-types' +import Drawer from '@material-ui/core/Drawer' +import Grid from '@material-ui/core/Grid' +import IconButton from '@material-ui/core/IconButton' +import CloseIcon from '@material-ui/icons/Close' + +const SelectedBpsBottomSheet = ({ open, setOpen, children }) => { + return ( + + + setOpen(false)}> + + + + {children} + + ) +} + +SelectedBpsBottomSheet.propTypes = { + open: PropTypes.bool, + setOpen: PropTypes.func, + children: PropTypes.node +} + +export default SelectedBpsBottomSheet diff --git a/services/frontend/src/routes/block-producers/index.js b/services/frontend/src/routes/block-producers/index.js index 97b85f0a..7731686c 100644 --- a/services/frontend/src/routes/block-producers/index.js +++ b/services/frontend/src/routes/block-producers/index.js @@ -3,6 +3,8 @@ import PropTypes from 'prop-types' import { useDispatch, useSelector } from 'react-redux' import Grid from '@material-ui/core/Grid' import Button from '@material-ui/core/Button' +import Typography from '@material-ui/core/Typography' +import ThumbUpAltIcon from '@material-ui/icons/ThumbUpAlt' import { makeStyles } from '@material-ui/core/styles' import { useTranslation } from 'react-i18next' import classNames from 'classnames' @@ -15,6 +17,8 @@ import getAverageValue from 'utils/getAverageValue' import applySortBy from 'utils/sortedBy' import styles from './styles' +import SelectedBpsBottomSheet from './bottom-sheet-selected-bps' +import { useMediaQuery } from '@material-ui/core' const useStyles = makeStyles(styles) @@ -23,7 +27,12 @@ const AllBps = ({ ual }) => { const dispatch = useDispatch() const classes = useStyles() const [currentlyVisible, setCurrentlyVisible] = useState(30) + const [openVoteDrawer, setOpenVoteDrawer] = useState(false) const { data: user } = useSelector((state) => state.user) + const isDesktop = useMediaQuery('(min-width:600px)', { + defaultMatches: false + }) + const [openDesktopVotingTool, setOpenDesktopVotingTool] = useState(isDesktop) const { list: blockProducers, selected: selectedBPs, @@ -58,6 +67,7 @@ const AllBps = ({ ual }) => { const handleOnClose = () => { handleToggleCompareTool() dispatch.blockProducers.clearSelected() + setOpenDesktopVotingTool(false) } const sendVoteBps = async (BPs) => { @@ -118,6 +128,21 @@ const AllBps = ({ ual }) => { } } + const cmprTool = () => ( + sendVoteBps(selectedBPs || [])} + userInfo={user} + message={ratingState} + onHandleClose={handleOnClose} + /> + ) + useEffect(() => { const getData = async () => { !blockProducers.length && (await dispatch.blockProducers.getBPs()) @@ -140,18 +165,7 @@ const AllBps = ({ ual }) => { return (
- sendVoteBps(selectedBPs || [])} - userInfo={user} - message={ratingState} - onHandleClose={() => handleOnClose()} - /> + {isDesktop && openDesktopVotingTool && cmprTool()} {(shownList || []).map((blockProducer) => ( { ))} + {selectedBPs && selectedBPs.length > 0 && ( + + + + )} + + {cmprTool()} +
) diff --git a/services/frontend/src/routes/block-producers/styles.js b/services/frontend/src/routes/block-producers/styles.js index 49f61486..3a1a4a15 100644 --- a/services/frontend/src/routes/block-producers/styles.js +++ b/services/frontend/src/routes/block-producers/styles.js @@ -1,7 +1,9 @@ export default (theme) => ({ // index style root: { - position: 'relative' + position: 'relative', + maxWidth: '100%', + margin: 'auto' }, compareToggleButton: { position: 'fixed', @@ -16,7 +18,9 @@ export default (theme) => ({ color: theme.palette.primary.main }, wrapper: { - padding: theme.spacing(3) + padding: theme.spacing(1), + maxWidth: '100%', + margin: 'auto' }, compareTool: { minHeight: 340, @@ -132,13 +136,30 @@ export default (theme) => ({ showOnlyLg: { display: 'flex', - [theme.breakpoints.down('sm')]: { + [theme.breakpoints.down('xs')]: { display: 'none' } }, alert: { width: '100%', - marginTop: theme.spacing(1) + marginTop: theme.spacing(1), + '& > div.MuiAlert-message': { + width: '100%' + } + }, + alertBody: { + width: '100%' + }, + alertActionsContainer: { + maxWidth: '60%' + }, + closeIconButton: { + padding: 0, + verticalAlign: 'middle', + color: 'red' + }, + detailsIconButton: { + padding: '0 10px' }, // bp profile bpAccountCircle: { @@ -185,6 +206,17 @@ export default (theme) => ({ margin: 0 } }, + openBottomSheetContainer: { + position: 'fixed', + bottom: 0, + zIndex: 999, + maxWidth: '100%', + '& > button': { + backgroundColor: 'black', + color: 'white', + borderRadius: '24px 0 0 0' + } + }, links: { textDecoration: 'none', color: theme.palette.secondary.main, diff --git a/services/frontend/src/routes/proxies/index.js b/services/frontend/src/routes/proxies/index.js index bb519dd9..677a103d 100644 --- a/services/frontend/src/routes/proxies/index.js +++ b/services/frontend/src/routes/proxies/index.js @@ -117,7 +117,7 @@ const AllProxies = ({ ual }) => { owner={_get(proxy, 'owner')} title={_get(proxy, 'name')} useRateButton={false} - buttonLabel='View' + buttonLabel={t('view')} pathLink='proxies' showOptions={false} /> @@ -128,7 +128,7 @@ const AllProxies = ({ ual }) => { className={classes.loadMoreButton} onClick={() => hasMore && loadMore()} > - LOAD MORE + {t('loadMore')} ) diff --git a/services/frontend/src/routes/proxies/proxy-profile.js b/services/frontend/src/routes/proxies/proxy-profile.js index 5a1da9f5..8655123e 100644 --- a/services/frontend/src/routes/proxies/proxy-profile.js +++ b/services/frontend/src/routes/proxies/proxy-profile.js @@ -242,7 +242,7 @@ const ProxyProfile = ({ account, ual, ...props }) => { variant='subtitle1' className={classNames(classes.subTitle, classes.bpName)} > - voting ... + {t('voting')} ... )} diff --git a/services/frontend/src/services/api.js b/services/frontend/src/services/api.js index e477272b..e9c1eae0 100644 --- a/services/frontend/src/services/api.js +++ b/services/frontend/src/services/api.js @@ -1,7 +1,7 @@ import qs from 'qs' import store from '../store' -const http = method => (endpoint, body, options = {}) => { +const http = (method) => (endpoint, body, options = {}) => { const token = store.getState().session ? store.getState().session.accessToken : null @@ -26,8 +26,10 @@ const http = method => (endpoint, body, options = {}) => { } } - return fetch(`${process.env.REACT_APP_API_URL}/${endpoint}`, params) - .then(response => response.json().then(payload => ({ payload, response }))) + return fetch(`${process.env.REACT_APP_EOS_API_URL}/${endpoint}`, params) + .then((response) => + response.json().then((payload) => ({ payload, response })) + ) .then(({ response, payload }) => response.ok ? payload : Promise.reject(payload) ) diff --git a/services/hapi/makefile b/services/hapi/makefile index 8564a389..9bee732c 100644 --- a/services/hapi/makefile +++ b/services/hapi/makefile @@ -4,16 +4,16 @@ LATEST_TAG ?= latest install: ##@local Install all dependencies install: - @npm install + @yarn clean-install: ##@local Reinstalls all dependencies clean-install: @rm -Rf node_modules - @npm install + @yarn run: ##@local Run the project locally (without docker) run: node_modules - @$(SHELL_EXPORT) npm run dev + @$(SHELL_EXPORT) yarn run dev build-docker: ##@devops Build the docker image build-docker: ./Dockerfile diff --git a/services/hapi/src/index.js b/services/hapi/src/index.js index 422ee614..1f9077c3 100644 --- a/services/hapi/src/index.js +++ b/services/hapi/src/index.js @@ -9,8 +9,8 @@ const Hapi = require('@hapi/hapi') const init = async () => { const server = Hapi.server({ - port: VIRTUAL_PORT || 9090, - host: VIRTUAL_HOST || '0.0.0.0' + port: VIRTUAL_PORT, + host: VIRTUAL_HOST }) server.route({ diff --git a/services/hapi/src/libs/sync-proxies.js b/services/hapi/src/libs/sync-proxies.js index ba023eaa..b5236b11 100644 --- a/services/hapi/src/libs/sync-proxies.js +++ b/services/hapi/src/libs/sync-proxies.js @@ -6,31 +6,31 @@ const massive = require('massive') const dbConfig = require('../config/dbConfig') -const EOS_API_ENDPOINT = process.env.EOS_API_ENDPOINT || 'https://jungle.eosio.cr' +const EOS_API_ENDPOINT = + process.env.EOS_API_ENDPOINT || 'https://jungle.eosio.cr' // gets data from blockchain const getProxiesData = async () => { const db = await massive(dbConfig) const eos = new JsonRpc(EOS_API_ENDPOINT, { fetch }) - const eosApi = EosApi({ - httpEndpoint: EOS_API_ENDPOINT, - verbose: false + const eosApi = EosApi({ + httpEndpoint: EOS_API_ENDPOINT, + verbose: false }) - const {rows : proxies} = await eos.get_table_rows({ + const { rows: proxies } = await eos.get_table_rows({ json: true, - code: 'regproxyinfo', - scope: 'regproxyinfo', + code: process.env.PROXY_INFO_CONTRACT_CODE, + scope: process.env.PROXY_INFO_CONTRACT_SCOPE, table: 'proxies', limit: 1000, reverse: false, show_payer: false }) - const getProxyAccount = async (proxy,i) => { - + const getProxyAccount = async (proxy, i) => { let account = await eosApi.getAccount({ account_name: proxy.owner }) - + if (account.voter_info.is_proxy) { proxies[i].voter_info = account.voter_info try { @@ -48,7 +48,7 @@ const getProxiesData = async () => { } } else { //proxies.splice(i, 1) - console.log(proxies[i].owner + " is not a proxy") + console.log(proxies[i].owner + ' is not a proxy') } } @@ -56,6 +56,4 @@ const getProxiesData = async () => { return proxies } - getProxiesData() - diff --git a/services/hasura/Dockerfile b/services/hasura/Dockerfile index 42c761e8..bee5c8d7 100644 --- a/services/hasura/Dockerfile +++ b/services/hasura/Dockerfile @@ -1,4 +1,4 @@ -FROM hasura/graphql-engine:v1.2.0-beta.4.cli-migrations +FROM hasura/graphql-engine:v1.3.3.cli-migrations-v2 ARG hasura_graphql_migrations_dir @@ -17,6 +17,4 @@ COPY migrations $HASURA_GRAPHQL_MIGRATIONS_DIR CMD graphql-engine \ serve \ - --database-url $HASURA_GRAPHQL_DATABASE_URL \ - --admin-secret $HASURA_GRAPHQL_ADMIN_SECRET \ - --unauthorized-role $HASURA_GRAPHQL_UNAUTHORIZED_ROLE + --database-url $HASURA_GRAPHQL_DATABASE_URL \ No newline at end of file diff --git a/services/hasura/metadata/actions.graphql b/services/hasura/metadata/actions.graphql new file mode 100644 index 00000000..8c4d53f6 --- /dev/null +++ b/services/hasura/metadata/actions.graphql @@ -0,0 +1,26 @@ +type Mutation { + rateProducer ( + ratingInput: RatingInput! + ): RatingOutput +} + + + + +input RatingInput { + user : String! + producer : String! +} + +type RatingOutput { + message : String! + uniq_rating : String + user : String + bp : String + ratings : jsonb +} + +type deleteUserRateOutput { + message : String! +} + diff --git a/services/hasura/metadata/actions.yaml b/services/hasura/metadata/actions.yaml new file mode 100644 index 00000000..5c44de47 --- /dev/null +++ b/services/hasura/metadata/actions.yaml @@ -0,0 +1,15 @@ +actions: +- name: rateProducer + definition: + kind: synchronous + handler: '{{HASURA_GRAPHQL_ACTION_BASE_URL}}/ratebp' + permissions: + - role: anonymous +custom_types: + enums: [] + input_objects: + - name: RatingInput + objects: + - name: RatingOutput + - name: deleteUserRateOutput + scalars: [] diff --git a/services/hasura/metadata/allow_list.yaml b/services/hasura/metadata/allow_list.yaml new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/services/hasura/metadata/allow_list.yaml @@ -0,0 +1 @@ +[] diff --git a/services/hasura/metadata/functions.yaml b/services/hasura/metadata/functions.yaml new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/services/hasura/metadata/functions.yaml @@ -0,0 +1 @@ +[] diff --git a/services/hasura/metadata/query_collections.yaml b/services/hasura/metadata/query_collections.yaml new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/services/hasura/metadata/query_collections.yaml @@ -0,0 +1 @@ +[] diff --git a/services/hasura/metadata/remote_schemas.yaml b/services/hasura/metadata/remote_schemas.yaml new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/services/hasura/metadata/remote_schemas.yaml @@ -0,0 +1 @@ +[] diff --git a/services/hasura/metadata/tables.yaml b/services/hasura/metadata/tables.yaml new file mode 100644 index 00000000..9ff443a2 --- /dev/null +++ b/services/hasura/metadata/tables.yaml @@ -0,0 +1,88 @@ +- table: + schema: public + name: producers + select_permissions: + - role: anonymous + permission: + columns: + - bpjson + - general_info + - owner + - system + filter: {} +- table: + schema: public + name: producers_list + select_permissions: + - role: anonymous + permission: + columns: + - owner + - bpjson + - system + - candidate_name + - total_votes + - average + - transparency + - infrastructure + - trustiness + - community + - development + - ratings_cntr + - general_info + filter: {} +- table: + schema: public + name: proxies + select_permissions: + - role: anonymous + permission: + columns: + - owner + - name + - website + - slogan + - philosophy + - background + - logo_256 + - telegram + - steemit + - twitter + - wechat + - voter_info + filter: {} +- table: + schema: public + name: ratings_stats + select_permissions: + - role: anonymous + permission: + columns: + - bp + - ratings_cntr + - average + - transparency + - infrastructure + - trustiness + - community + - development + - created_at + - updated_at + filter: {} +- table: + schema: public + name: user_ratings + select_permissions: + - role: anonymous + permission: + columns: + - ratings + - tx_data + - bp + - uniq_rating + - user + filter: {} + delete_permissions: + - role: anonymous + permission: + filter: {} diff --git a/services/hasura/metadata/version.yaml b/services/hasura/metadata/version.yaml new file mode 100644 index 00000000..22817d2a --- /dev/null +++ b/services/hasura/metadata/version.yaml @@ -0,0 +1 @@ +version: 2 diff --git a/services/hasura/migrations/1548725474630_create_producers.up.sql b/services/hasura/migrations/1548725474630_create_producers.up.sql new file mode 100755 index 00000000..20948675 --- /dev/null +++ b/services/hasura/migrations/1548725474630_create_producers.up.sql @@ -0,0 +1,6 @@ + +CREATE TABLE producers ( + owner text PRIMARY KEY, + system jsonb NOT NULL, + bpjson jsonb NOT NULL + ); \ No newline at end of file diff --git a/services/hasura/migrations/1548725474630_create_producers.up.yaml b/services/hasura/migrations/1548725474630_create_producers.up.yaml deleted file mode 100644 index e1fb3bb9..00000000 --- a/services/hasura/migrations/1548725474630_create_producers.up.yaml +++ /dev/null @@ -1,13 +0,0 @@ -- args: - cascade: true - sql: |- - CREATE TABLE producers ( - owner text PRIMARY KEY, - system jsonb NOT NULL, - bpjson jsonb NOT NULL - ); - type: run_sql -- args: - name: producers - schema: public - type: add_existing_table_or_view diff --git a/services/hasura/migrations/1548730845804_create_producer_ratings.up.sql b/services/hasura/migrations/1548730845804_create_producer_ratings.up.sql new file mode 100755 index 00000000..822b1f49 --- /dev/null +++ b/services/hasura/migrations/1548730845804_create_producer_ratings.up.sql @@ -0,0 +1,7 @@ + + CREATE TABLE producer_ratings ( + account text NOT NULL, + bp text NOT NULL, + ratings jsonb NOT NULL, + PRIMARY KEY(account, bp) + ); \ No newline at end of file diff --git a/services/hasura/migrations/1548730845804_create_producer_ratings.up.yaml b/services/hasura/migrations/1548730845804_create_producer_ratings.up.yaml deleted file mode 100644 index a075ea45..00000000 --- a/services/hasura/migrations/1548730845804_create_producer_ratings.up.yaml +++ /dev/null @@ -1,14 +0,0 @@ -- args: - cascade: true - sql: |2- - CREATE TABLE producer_ratings ( - account text NOT NULL, - bp text NOT NULL, - ratings jsonb NOT NULL, - PRIMARY KEY(account, bp) - ); - type: run_sql -- args: - name: producer_ratings - schema: public - type: add_existing_table_or_view diff --git a/services/hasura/migrations/1548732282821_create_producers_list.up.sql b/services/hasura/migrations/1548732282821_create_producers_list.up.sql new file mode 100755 index 00000000..3ad215ce --- /dev/null +++ b/services/hasura/migrations/1548732282821_create_producers_list.up.sql @@ -0,0 +1,10 @@ + +CREATE OR REPLACE VIEW producers_list AS + SELECT + owner, + bpjson, + system, + bpjson->'org'->>'candidate_name' AS candidate_name, + system->>'total_votes' AS total_votes + FROM + producers; \ No newline at end of file diff --git a/services/hasura/migrations/1548732282821_create_producers_list.up.yaml b/services/hasura/migrations/1548732282821_create_producers_list.up.yaml deleted file mode 100644 index 1ee86cb0..00000000 --- a/services/hasura/migrations/1548732282821_create_producers_list.up.yaml +++ /dev/null @@ -1,17 +0,0 @@ -- args: - cascade: false - sql: |- - CREATE OR REPLACE VIEW producers_list AS - SELECT - owner, - bpjson, - system, - bpjson->'org'->>'candidate_name' AS candidate_name, - system->>'total_votes' AS total_votes - FROM - producers; - type: run_sql -- args: - name: producers_list - schema: public - type: add_existing_table_or_view diff --git a/services/hasura/migrations/1580686687967_add_ratings_table/up.sql b/services/hasura/migrations/1580686687967_add_ratings_table/up.sql new file mode 100755 index 00000000..3f986bb9 --- /dev/null +++ b/services/hasura/migrations/1580686687967_add_ratings_table/up.sql @@ -0,0 +1,2 @@ + +CREATE TABLE "public".ratings ( bp varchar(12) NOT NULL , ratings_cntr integer , average decimal , transparency decimal , infrastructure decimal , trustiness decimal , community decimal , development decimal , created_at integer , updated_at integer , CONSTRAINT pk_ratings_bp PRIMARY KEY ( bp ) ) \ No newline at end of file diff --git a/services/hasura/migrations/1580686687967_add_ratings_table/up.yaml b/services/hasura/migrations/1580686687967_add_ratings_table/up.yaml deleted file mode 100644 index a6a24763..00000000 --- a/services/hasura/migrations/1580686687967_add_ratings_table/up.yaml +++ /dev/null @@ -1,11 +0,0 @@ -- args: - cascade: true - sql: 'CREATE TABLE "public".ratings ( bp varchar(12) NOT NULL , ratings_cntr integer - , average decimal , transparency decimal , infrastructure decimal , trustiness - decimal , community decimal , development decimal , created_at integer , updated_at - integer , CONSTRAINT pk_ratings_bp PRIMARY KEY ( bp ) ) ' - type: run_sql -- args: - name: ratings - schema: public - type: add_existing_table_or_view diff --git a/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/down.sql b/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/down.sql new file mode 100755 index 00000000..c5adc93c --- /dev/null +++ b/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/down.sql @@ -0,0 +1,3 @@ + +ALTER TABLE "public"."ratings" ALTER COLUMN "created_at" TYPE integer; +COMMENT ON COLUMN "public"."ratings"."created_at" IS E'null' \ No newline at end of file diff --git a/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/down.yaml b/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/down.yaml deleted file mode 100644 index f2485680..00000000 --- a/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/down.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - sql: ALTER TABLE "public"."ratings" ALTER COLUMN "created_at" TYPE integer; - type: run_sql -- args: - sql: COMMENT ON COLUMN "public"."ratings"."created_at" IS E'null' - type: run_sql diff --git a/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/up.sql b/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/up.sql new file mode 100755 index 00000000..ac32c959 --- /dev/null +++ b/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/up.sql @@ -0,0 +1,3 @@ + +ALTER TABLE "public"."ratings" ALTER COLUMN "created_at" TYPE int8; +COMMENT ON COLUMN "public"."ratings"."created_at" IS E'' \ No newline at end of file diff --git a/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/up.yaml b/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/up.yaml deleted file mode 100644 index 1b7f14d4..00000000 --- a/services/hasura/migrations/1580688144818_alter_table_public_ratings_alter_column_created_at/up.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - sql: ALTER TABLE "public"."ratings" ALTER COLUMN "created_at" TYPE int8; - type: run_sql -- args: - sql: COMMENT ON COLUMN "public"."ratings"."created_at" IS E'' - type: run_sql diff --git a/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/down.sql b/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/down.sql new file mode 100755 index 00000000..b8979dec --- /dev/null +++ b/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/down.sql @@ -0,0 +1,3 @@ + +ALTER TABLE "public"."ratings" ALTER COLUMN "updated_at" TYPE integer; +COMMENT ON COLUMN "public"."ratings"."updated_at" IS E'null' \ No newline at end of file diff --git a/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/down.yaml b/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/down.yaml deleted file mode 100644 index 95dafa86..00000000 --- a/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/down.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - sql: ALTER TABLE "public"."ratings" ALTER COLUMN "updated_at" TYPE integer; - type: run_sql -- args: - sql: COMMENT ON COLUMN "public"."ratings"."updated_at" IS E'null' - type: run_sql diff --git a/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/up.sql b/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/up.sql new file mode 100755 index 00000000..19b78439 --- /dev/null +++ b/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/up.sql @@ -0,0 +1,3 @@ + +ALTER TABLE "public"."ratings" ALTER COLUMN "updated_at" TYPE int8; +COMMENT ON COLUMN "public"."ratings"."updated_at" IS E'' \ No newline at end of file diff --git a/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/up.yaml b/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/up.yaml deleted file mode 100644 index 848f948e..00000000 --- a/services/hasura/migrations/1580688151803_alter_table_public_ratings_alter_column_updated_at/up.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - sql: ALTER TABLE "public"."ratings" ALTER COLUMN "updated_at" TYPE int8; - type: run_sql -- args: - sql: COMMENT ON COLUMN "public"."ratings"."updated_at" IS E'' - type: run_sql diff --git a/services/hasura/migrations/1580754206808_add_extra_data/up.sql b/services/hasura/migrations/1580754206808_add_extra_data/up.sql new file mode 100755 index 00000000..62cc9d8c --- /dev/null +++ b/services/hasura/migrations/1580754206808_add_extra_data/up.sql @@ -0,0 +1,4 @@ + +ALTER TABLE "public".producer_ratings ADD tx_data jsonb; +ALTER TABLE "public".producer_ratings RENAME TO user_ratings; +ALTER TABLE "public".producers ADD general_info jsonb; \ No newline at end of file diff --git a/services/hasura/migrations/1580754206808_add_extra_data/up.yaml b/services/hasura/migrations/1580754206808_add_extra_data/up.yaml deleted file mode 100644 index 2c1bde15..00000000 --- a/services/hasura/migrations/1580754206808_add_extra_data/up.yaml +++ /dev/null @@ -1,7 +0,0 @@ -- args: - cascade: true - sql: |- - ALTER TABLE "public".producer_ratings ADD tx_data jsonb; - ALTER TABLE "public".producer_ratings RENAME TO user_ratings; - ALTER TABLE "public".producers ADD general_info jsonb; - type: run_sql diff --git a/services/hasura/migrations/1580754274249_rename_table_public_ratings/down.sql b/services/hasura/migrations/1580754274249_rename_table_public_ratings/down.sql new file mode 100755 index 00000000..1a474a4b --- /dev/null +++ b/services/hasura/migrations/1580754274249_rename_table_public_ratings/down.sql @@ -0,0 +1,2 @@ + +alter table "public"."ratings_stats" rename to "ratings"; \ No newline at end of file diff --git a/services/hasura/migrations/1580754274249_rename_table_public_ratings/down.yaml b/services/hasura/migrations/1580754274249_rename_table_public_ratings/down.yaml deleted file mode 100644 index 116d8be9..00000000 --- a/services/hasura/migrations/1580754274249_rename_table_public_ratings/down.yaml +++ /dev/null @@ -1,3 +0,0 @@ -- args: - sql: alter table "public"."ratings_stats" rename to "ratings"; - type: run_sql diff --git a/services/hasura/migrations/1580754274249_rename_table_public_ratings/up.sql b/services/hasura/migrations/1580754274249_rename_table_public_ratings/up.sql new file mode 100755 index 00000000..c0bec4ca --- /dev/null +++ b/services/hasura/migrations/1580754274249_rename_table_public_ratings/up.sql @@ -0,0 +1,2 @@ + +alter table "public"."ratings" rename to "ratings_stats"; \ No newline at end of file diff --git a/services/hasura/migrations/1580754274249_rename_table_public_ratings/up.yaml b/services/hasura/migrations/1580754274249_rename_table_public_ratings/up.yaml deleted file mode 100644 index d9bfd44c..00000000 --- a/services/hasura/migrations/1580754274249_rename_table_public_ratings/up.yaml +++ /dev/null @@ -1,3 +0,0 @@ -- args: - sql: alter table "public"."ratings" rename to "ratings_stats"; - type: run_sql diff --git a/services/hasura/migrations/1581704802407_join_producer_ratings_stats/up.sql b/services/hasura/migrations/1581704802407_join_producer_ratings_stats/up.sql new file mode 100755 index 00000000..3ae0efc7 --- /dev/null +++ b/services/hasura/migrations/1581704802407_join_producer_ratings_stats/up.sql @@ -0,0 +1,15 @@ + +CREATE OR REPLACE VIEW "public"."producers_list" AS + SELECT producers.owner, + producers.bpjson, + producers.system, + ((producers.bpjson -> 'org'::text) ->> 'candidate_name'::text) AS candidate_name, + (producers.system ->> 'total_votes'::text) AS total_votes, + ratings_stats.average, + ratings_stats.transparency, + ratings_stats.infrastructure, + ratings_stats.trustiness, + ratings_stats.community, + ratings_stats.development + FROM (producers + FULL JOIN ratings_stats ON (((ratings_stats.bp)::text = producers.owner))); \ No newline at end of file diff --git a/services/hasura/migrations/1581704802407_join_producer_ratings_stats/up.yaml b/services/hasura/migrations/1581704802407_join_producer_ratings_stats/up.yaml deleted file mode 100644 index 746a6217..00000000 --- a/services/hasura/migrations/1581704802407_join_producer_ratings_stats/up.yaml +++ /dev/null @@ -1,10 +0,0 @@ -- args: - cascade: true - sql: "CREATE OR REPLACE VIEW \"public\".\"producers_list\" AS \n SELECT producers.owner,\n - \ producers.bpjson,\n producers.system,\n ((producers.bpjson -> 'org'::text) - ->> 'candidate_name'::text) AS candidate_name,\n (producers.system ->> 'total_votes'::text) - AS total_votes,\n ratings_stats.average,\n ratings_stats.transparency,\n - \ ratings_stats.infrastructure,\n ratings_stats.trustiness,\n ratings_stats.community,\n - \ ratings_stats.development\n FROM (producers\n FULL JOIN ratings_stats - ON (((ratings_stats.bp)::text = producers.owner)));" - type: run_sql diff --git a/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/down.sql b/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/down.sql new file mode 100755 index 00000000..15a876c7 --- /dev/null +++ b/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/down.sql @@ -0,0 +1,2 @@ + +alter table "public"."user_ratings" rename column "user" to "account"; \ No newline at end of file diff --git a/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/down.yaml b/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/down.yaml deleted file mode 100644 index 0fe6e34d..00000000 --- a/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/down.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- args: - cascade: false - read_only: false - sql: alter table "public"."user_ratings" rename column "user" to "account"; - type: run_sql diff --git a/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/up.sql b/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/up.sql new file mode 100755 index 00000000..81c82994 --- /dev/null +++ b/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/up.sql @@ -0,0 +1,2 @@ + +alter table "public"."user_ratings" rename column "account" to "user"; \ No newline at end of file diff --git a/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/up.yaml b/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/up.yaml deleted file mode 100644 index d9e94848..00000000 --- a/services/hasura/migrations/1582436287385_alter_table_public_user_ratings_alter_column_account/up.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- args: - cascade: false - read_only: false - sql: alter table "public"."user_ratings" rename column "account" to "user"; - type: run_sql diff --git a/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/down.sql b/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/down.sql new file mode 100755 index 00000000..a4fdea7b --- /dev/null +++ b/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/down.sql @@ -0,0 +1,2 @@ + +ALTER TABLE "public"."user_ratings" DROP COLUMN "uniq_rating"; \ No newline at end of file diff --git a/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/down.yaml b/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/down.yaml deleted file mode 100644 index f6903444..00000000 --- a/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/down.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- args: - cascade: false - read_only: false - sql: ALTER TABLE "public"."user_ratings" DROP COLUMN "uniq_rating"; - type: run_sql diff --git a/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/up.sql b/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/up.sql new file mode 100755 index 00000000..01d7766c --- /dev/null +++ b/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/up.sql @@ -0,0 +1,2 @@ + +ALTER TABLE "public"."user_ratings" ADD COLUMN "uniq_rating" text NOT NULL UNIQUE; \ No newline at end of file diff --git a/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/up.yaml b/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/up.yaml deleted file mode 100644 index b7948cbc..00000000 --- a/services/hasura/migrations/1582436803376_alter_table_public_user_ratings_add_column_uniq_rating/up.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - cascade: false - read_only: false - sql: ALTER TABLE "public"."user_ratings" ADD COLUMN "uniq_rating" text NOT NULL - UNIQUE; - type: run_sql diff --git a/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/down.sql b/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/down.sql new file mode 100755 index 00000000..597dba3b --- /dev/null +++ b/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/down.sql @@ -0,0 +1,5 @@ + +alter table "public"."user_ratings" drop constraint "user_ratings_pkey"; +alter table "public"."user_ratings" + add constraint "producer_ratings_pkey" + primary key ( "bp", "user" ); \ No newline at end of file diff --git a/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/down.yaml b/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/down.yaml deleted file mode 100644 index 88ee360d..00000000 --- a/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/down.yaml +++ /dev/null @@ -1,11 +0,0 @@ -- args: - cascade: false - read_only: false - sql: alter table "public"."user_ratings" drop constraint "user_ratings_pkey"; - type: run_sql -- args: - cascade: false - read_only: false - sql: "alter table \"public\".\"user_ratings\"\n add constraint \"producer_ratings_pkey\" - \n primary key ( \"bp\", \"user\" );" - type: run_sql diff --git a/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/up.sql b/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/up.sql new file mode 100755 index 00000000..b81f0245 --- /dev/null +++ b/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/up.sql @@ -0,0 +1,5 @@ + +alter table "public"."user_ratings" drop constraint "producer_ratings_pkey"; +alter table "public"."user_ratings" + add constraint "user_ratings_pkey" + primary key ( "uniq_rating" ); \ No newline at end of file diff --git a/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/up.yaml b/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/up.yaml deleted file mode 100644 index 6f0f2252..00000000 --- a/services/hasura/migrations/1582436829131_modify_primarykey_public_user_ratings/up.yaml +++ /dev/null @@ -1,11 +0,0 @@ -- args: - cascade: false - read_only: false - sql: alter table "public"."user_ratings" drop constraint "producer_ratings_pkey"; - type: run_sql -- args: - cascade: false - read_only: false - sql: "alter table \"public\".\"user_ratings\"\n add constraint \"user_ratings_pkey\" - \n primary key ( \"uniq_rating\" );" - type: run_sql diff --git a/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/down.sql b/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/down.sql new file mode 100755 index 00000000..3ff7aca8 --- /dev/null +++ b/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/down.sql @@ -0,0 +1,2 @@ + +ALTER TABLE "public"."user_ratings" ALTER COLUMN "ratings" SET NOT NULL; \ No newline at end of file diff --git a/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/down.yaml b/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/down.yaml deleted file mode 100644 index c2c0bad0..00000000 --- a/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/down.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- args: - cascade: false - read_only: false - sql: ALTER TABLE "public"."user_ratings" ALTER COLUMN "ratings" SET NOT NULL; - type: run_sql diff --git a/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/up.sql b/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/up.sql new file mode 100755 index 00000000..de94ed49 --- /dev/null +++ b/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/up.sql @@ -0,0 +1,2 @@ + +ALTER TABLE "public"."user_ratings" ALTER COLUMN "ratings" DROP NOT NULL; \ No newline at end of file diff --git a/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/up.yaml b/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/up.yaml deleted file mode 100644 index adebfe60..00000000 --- a/services/hasura/migrations/1582436863355_alter_table_public_user_ratings_alter_column_ratings/up.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- args: - cascade: false - read_only: false - sql: ALTER TABLE "public"."user_ratings" ALTER COLUMN "ratings" DROP NOT NULL; - type: run_sql diff --git a/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/down.sql b/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/down.sql new file mode 100755 index 00000000..de94ed49 --- /dev/null +++ b/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/down.sql @@ -0,0 +1,2 @@ + +ALTER TABLE "public"."user_ratings" ALTER COLUMN "ratings" DROP NOT NULL; \ No newline at end of file diff --git a/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/down.yaml b/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/down.yaml deleted file mode 100644 index adebfe60..00000000 --- a/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/down.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- args: - cascade: false - read_only: false - sql: ALTER TABLE "public"."user_ratings" ALTER COLUMN "ratings" DROP NOT NULL; - type: run_sql diff --git a/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/up.sql b/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/up.sql new file mode 100755 index 00000000..3ff7aca8 --- /dev/null +++ b/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/up.sql @@ -0,0 +1,2 @@ + +ALTER TABLE "public"."user_ratings" ALTER COLUMN "ratings" SET NOT NULL; \ No newline at end of file diff --git a/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/up.yaml b/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/up.yaml deleted file mode 100644 index c2c0bad0..00000000 --- a/services/hasura/migrations/1582437040531_alter_table_public_user_ratings_alter_column_ratings/up.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- args: - cascade: false - read_only: false - sql: ALTER TABLE "public"."user_ratings" ALTER COLUMN "ratings" SET NOT NULL; - type: run_sql diff --git a/services/hasura/migrations/1582950844052_create_action_rateProducer/down.yaml b/services/hasura/migrations/1582950844052_create_action_rateProducer/down.yaml deleted file mode 100644 index fb7519f3..00000000 --- a/services/hasura/migrations/1582950844052_create_action_rateProducer/down.yaml +++ /dev/null @@ -1,9 +0,0 @@ -- args: - name: rateProducer - type: drop_action -- args: - enums: [] - input_objects: [] - objects: [] - scalars: [] - type: set_custom_types diff --git a/services/hasura/migrations/1582950844052_create_action_rateProducer/up.yaml b/services/hasura/migrations/1582950844052_create_action_rateProducer/up.yaml deleted file mode 100644 index 1dad2b8e..00000000 --- a/services/hasura/migrations/1582950844052_create_action_rateProducer/up.yaml +++ /dev/null @@ -1,35 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: response - type: String! - name: RatingOutput - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: arg1 - type: RatingInput! - forward_client_headers: false - handler: https://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: create_action diff --git a/services/hasura/migrations/1582994080171_modify_action_rateProducer_to_rateProducer/down.yaml b/services/hasura/migrations/1582994080171_modify_action_rateProducer_to_rateProducer/down.yaml deleted file mode 100644 index 879c0250..00000000 --- a/services/hasura/migrations/1582994080171_modify_action_rateProducer_to_rateProducer/down.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - arguments: null - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: arg1 - type: RatingInput! - forward_client_headers: false - handler: https://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1582994080171_modify_action_rateProducer_to_rateProducer/up.yaml b/services/hasura/migrations/1582994080171_modify_action_rateProducer_to_rateProducer/up.yaml deleted file mode 100644 index 7195b0f1..00000000 --- a/services/hasura/migrations/1582994080171_modify_action_rateProducer_to_rateProducer/up.yaml +++ /dev/null @@ -1,36 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: https://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1582994256642_modify_action_rateProducer_to_rateProducer/down.yaml b/services/hasura/migrations/1582994256642_modify_action_rateProducer_to_rateProducer/down.yaml deleted file mode 100644 index 52a9a685..00000000 --- a/services/hasura/migrations/1582994256642_modify_action_rateProducer_to_rateProducer/down.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - arguments: null - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: https://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1582994256642_modify_action_rateProducer_to_rateProducer/up.yaml b/services/hasura/migrations/1582994256642_modify_action_rateProducer_to_rateProducer/up.yaml deleted file mode 100644 index d75dc83f..00000000 --- a/services/hasura/migrations/1582994256642_modify_action_rateProducer_to_rateProducer/up.yaml +++ /dev/null @@ -1,36 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://localhost:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1583004430995_modify_action_rateProducer_to_rateProducer/down.yaml b/services/hasura/migrations/1583004430995_modify_action_rateProducer_to_rateProducer/down.yaml deleted file mode 100644 index 3931d579..00000000 --- a/services/hasura/migrations/1583004430995_modify_action_rateProducer_to_rateProducer/down.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - arguments: null - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://localhost:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1583004430995_modify_action_rateProducer_to_rateProducer/up.yaml b/services/hasura/migrations/1583004430995_modify_action_rateProducer_to_rateProducer/up.yaml deleted file mode 100644 index da760a38..00000000 --- a/services/hasura/migrations/1583004430995_modify_action_rateProducer_to_rateProducer/up.yaml +++ /dev/null @@ -1,36 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://host.docker.internal:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1583004453318_modify_action_rateProducer_to_rateProducer/down.yaml b/services/hasura/migrations/1583004453318_modify_action_rateProducer_to_rateProducer/down.yaml deleted file mode 100644 index 7c7c68a6..00000000 --- a/services/hasura/migrations/1583004453318_modify_action_rateProducer_to_rateProducer/down.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - arguments: null - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://host.docker.internal:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1583004453318_modify_action_rateProducer_to_rateProducer/up.yaml b/services/hasura/migrations/1583004453318_modify_action_rateProducer_to_rateProducer/up.yaml deleted file mode 100644 index da760a38..00000000 --- a/services/hasura/migrations/1583004453318_modify_action_rateProducer_to_rateProducer/up.yaml +++ /dev/null @@ -1,36 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://host.docker.internal:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1583004636939_modify_action_rateProducer_to_rateProducer/down.yaml b/services/hasura/migrations/1583004636939_modify_action_rateProducer_to_rateProducer/down.yaml deleted file mode 100644 index 7c7c68a6..00000000 --- a/services/hasura/migrations/1583004636939_modify_action_rateProducer_to_rateProducer/down.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - arguments: null - description: null - name: response - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://host.docker.internal:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1583004636939_modify_action_rateProducer_to_rateProducer/up.yaml b/services/hasura/migrations/1583004636939_modify_action_rateProducer_to_rateProducer/up.yaml deleted file mode 100644 index 58b68d6a..00000000 --- a/services/hasura/migrations/1583004636939_modify_action_rateProducer_to_rateProducer/up.yaml +++ /dev/null @@ -1,36 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: message - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://host.docker.internal:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1583531471259_add_ratings_cntr_column/up.sql b/services/hasura/migrations/1583531471259_add_ratings_cntr_column/up.sql new file mode 100755 index 00000000..3f95f09f --- /dev/null +++ b/services/hasura/migrations/1583531471259_add_ratings_cntr_column/up.sql @@ -0,0 +1,16 @@ + +CREATE OR REPLACE VIEW "public"."producers_list" AS + SELECT producers.owner, + producers.bpjson, + producers.system, + ((producers.bpjson -> 'org'::text) ->> 'candidate_name'::text) AS candidate_name, + (producers.system ->> 'total_votes'::text) AS total_votes, + ratings_stats.average, + ratings_stats.transparency, + ratings_stats.infrastructure, + ratings_stats.trustiness, + ratings_stats.community, + ratings_stats.development, + ratings_stats.ratings_cntr + FROM (producers + FULL JOIN ratings_stats ON (((ratings_stats.bp)::text = producers.owner))); \ No newline at end of file diff --git a/services/hasura/migrations/1583531471259_add_ratings_cntr_column/up.yaml b/services/hasura/migrations/1583531471259_add_ratings_cntr_column/up.yaml deleted file mode 100644 index f61854be..00000000 --- a/services/hasura/migrations/1583531471259_add_ratings_cntr_column/up.yaml +++ /dev/null @@ -1,11 +0,0 @@ -- args: - cascade: true - read_only: false - sql: "CREATE OR REPLACE VIEW \"public\".\"producers_list\" AS \n SELECT producers.owner,\n - \ producers.bpjson,\n producers.system,\n ((producers.bpjson -> 'org'::text) - ->> 'candidate_name'::text) AS candidate_name,\n (producers.system ->> 'total_votes'::text) - AS total_votes,\n ratings_stats.average,\n ratings_stats.transparency,\n - \ ratings_stats.infrastructure,\n ratings_stats.trustiness,\n ratings_stats.community,\n - \ ratings_stats.development,\n ratings_stats.ratings_cntr\n FROM (producers\n - \ FULL JOIN ratings_stats ON (((ratings_stats.bp)::text = producers.owner)));" - type: run_sql diff --git a/services/hasura/migrations/1583953599516_add_general_info_column/up.sql b/services/hasura/migrations/1583953599516_add_general_info_column/up.sql new file mode 100755 index 00000000..82742e2f --- /dev/null +++ b/services/hasura/migrations/1583953599516_add_general_info_column/up.sql @@ -0,0 +1,17 @@ + +CREATE OR REPLACE VIEW "public"."producers_list" AS + SELECT producers.owner, + producers.bpjson, + producers.system, + ((producers.bpjson -> 'org'::text) ->> 'candidate_name'::text) AS candidate_name, + (producers.system ->> 'total_votes'::text) AS total_votes, + ratings_stats.average, + ratings_stats.transparency, + ratings_stats.infrastructure, + ratings_stats.trustiness, + ratings_stats.community, + ratings_stats.development, + ratings_stats.ratings_cntr, + producers.general_info + FROM (producers + FULL JOIN ratings_stats ON (((ratings_stats.bp)::text = producers.owner))); \ No newline at end of file diff --git a/services/hasura/migrations/1583953599516_add_general_info_column/up.yaml b/services/hasura/migrations/1583953599516_add_general_info_column/up.yaml deleted file mode 100644 index 066fe0b8..00000000 --- a/services/hasura/migrations/1583953599516_add_general_info_column/up.yaml +++ /dev/null @@ -1,12 +0,0 @@ -- args: - cascade: true - read_only: false - sql: "CREATE OR REPLACE VIEW \"public\".\"producers_list\" AS \n SELECT producers.owner,\n - \ producers.bpjson,\n producers.system,\n ((producers.bpjson -> 'org'::text) - ->> 'candidate_name'::text) AS candidate_name,\n (producers.system ->> 'total_votes'::text) - AS total_votes,\n ratings_stats.average,\n ratings_stats.transparency,\n - \ ratings_stats.infrastructure,\n ratings_stats.trustiness,\n ratings_stats.community,\n - \ ratings_stats.development,\n ratings_stats.ratings_cntr,\n producers.general_info\n - \ FROM (producers\n FULL JOIN ratings_stats ON (((ratings_stats.bp)::text - = producers.owner)));" - type: run_sql diff --git a/services/hasura/migrations/1584293813117_create_table_public_proxies/down.sql b/services/hasura/migrations/1584293813117_create_table_public_proxies/down.sql new file mode 100755 index 00000000..37b3e03e --- /dev/null +++ b/services/hasura/migrations/1584293813117_create_table_public_proxies/down.sql @@ -0,0 +1,2 @@ + +DROP TABLE "public"."proxies"; \ No newline at end of file diff --git a/services/hasura/migrations/1584293813117_create_table_public_proxies/down.yaml b/services/hasura/migrations/1584293813117_create_table_public_proxies/down.yaml deleted file mode 100644 index caba4db2..00000000 --- a/services/hasura/migrations/1584293813117_create_table_public_proxies/down.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- args: - cascade: false - read_only: false - sql: DROP TABLE "public"."proxies"; - type: run_sql diff --git a/services/hasura/migrations/1584293813117_create_table_public_proxies/up.sql b/services/hasura/migrations/1584293813117_create_table_public_proxies/up.sql new file mode 100755 index 00000000..3a98b6fc --- /dev/null +++ b/services/hasura/migrations/1584293813117_create_table_public_proxies/up.sql @@ -0,0 +1,2 @@ + +CREATE TABLE "public"."proxies"("owner" text NOT NULL, "name" text NOT NULL, "website" text, "slogan" text, "philosophy" text, "background" text, "logo_256" text, "telegram" text, "steemit" text, "twitter" text, "wechat" text, "voter_info" jsonb NOT NULL, PRIMARY KEY ("owner") , UNIQUE ("owner"), UNIQUE ("name")); \ No newline at end of file diff --git a/services/hasura/migrations/1584293813117_create_table_public_proxies/up.yaml b/services/hasura/migrations/1584293813117_create_table_public_proxies/up.yaml deleted file mode 100644 index 56190373..00000000 --- a/services/hasura/migrations/1584293813117_create_table_public_proxies/up.yaml +++ /dev/null @@ -1,12 +0,0 @@ -- args: - cascade: false - read_only: false - sql: CREATE TABLE "public"."proxies"("owner" text NOT NULL, "name" text NOT NULL, - "website" text, "slogan" text, "philosophy" text, "background" text, "logo_256" - text, "telegram" text, "steemit" text, "twitter" text, "wechat" text, "voter_info" - jsonb NOT NULL, PRIMARY KEY ("owner") , UNIQUE ("owner"), UNIQUE ("name")); - type: run_sql -- args: - name: proxies - schema: public - type: add_existing_table_or_view diff --git a/services/hasura/migrations/1587519806338_modify_action_rateProducer_to_rateProducer/down.yaml b/services/hasura/migrations/1587519806338_modify_action_rateProducer_to_rateProducer/down.yaml deleted file mode 100644 index 21bb6557..00000000 --- a/services/hasura/migrations/1587519806338_modify_action_rateProducer_to_rateProducer/down.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - arguments: null - description: null - name: message - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1587519806338_modify_action_rateProducer_to_rateProducer/up.yaml b/services/hasura/migrations/1587519806338_modify_action_rateProducer_to_rateProducer/up.yaml deleted file mode 100644 index a1abc8cb..00000000 --- a/services/hasura/migrations/1587519806338_modify_action_rateProducer_to_rateProducer/up.yaml +++ /dev/null @@ -1,37 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: message - type: String! - name: RatingOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - type: mutation - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1587692809044_update_permission_anonymous_public_table_producers_list/down.yaml b/services/hasura/migrations/1587692809044_update_permission_anonymous_public_table_producers_list/down.yaml deleted file mode 100644 index d62c1f97..00000000 --- a/services/hasura/migrations/1587692809044_update_permission_anonymous_public_table_producers_list/down.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - role: anonymous - table: - name: producers_list - schema: public - type: drop_select_permission diff --git a/services/hasura/migrations/1587692809044_update_permission_anonymous_public_table_producers_list/up.yaml b/services/hasura/migrations/1587692809044_update_permission_anonymous_public_table_producers_list/up.yaml deleted file mode 100644 index f1e519cf..00000000 --- a/services/hasura/migrations/1587692809044_update_permission_anonymous_public_table_producers_list/up.yaml +++ /dev/null @@ -1,25 +0,0 @@ -- args: - permission: - allow_aggregations: false - columns: - - owner - - bpjson - - system - - candidate_name - - total_votes - - average - - transparency - - infrastructure - - trustiness - - community - - development - - ratings_cntr - - general_info - computed_fields: [] - filter: {} - limit: null - role: anonymous - table: - name: producers_list - schema: public - type: create_select_permission diff --git a/services/hasura/migrations/1587692831014_update_permission_anonymous_public_table_proxies/down.yaml b/services/hasura/migrations/1587692831014_update_permission_anonymous_public_table_proxies/down.yaml deleted file mode 100644 index c2606de7..00000000 --- a/services/hasura/migrations/1587692831014_update_permission_anonymous_public_table_proxies/down.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - role: anonymous - table: - name: proxies - schema: public - type: drop_select_permission diff --git a/services/hasura/migrations/1587692831014_update_permission_anonymous_public_table_proxies/up.yaml b/services/hasura/migrations/1587692831014_update_permission_anonymous_public_table_proxies/up.yaml deleted file mode 100644 index c2d974ea..00000000 --- a/services/hasura/migrations/1587692831014_update_permission_anonymous_public_table_proxies/up.yaml +++ /dev/null @@ -1,24 +0,0 @@ -- args: - permission: - allow_aggregations: false - columns: - - owner - - name - - website - - slogan - - philosophy - - background - - logo_256 - - telegram - - steemit - - twitter - - wechat - - voter_info - computed_fields: [] - filter: {} - limit: null - role: anonymous - table: - name: proxies - schema: public - type: create_select_permission diff --git a/services/hasura/migrations/1587692841531_update_permission_anonymous_public_table_ratings_stats/down.yaml b/services/hasura/migrations/1587692841531_update_permission_anonymous_public_table_ratings_stats/down.yaml deleted file mode 100644 index b550eb82..00000000 --- a/services/hasura/migrations/1587692841531_update_permission_anonymous_public_table_ratings_stats/down.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - role: anonymous - table: - name: ratings_stats - schema: public - type: drop_select_permission diff --git a/services/hasura/migrations/1587692841531_update_permission_anonymous_public_table_ratings_stats/up.yaml b/services/hasura/migrations/1587692841531_update_permission_anonymous_public_table_ratings_stats/up.yaml deleted file mode 100644 index 2d2f43de..00000000 --- a/services/hasura/migrations/1587692841531_update_permission_anonymous_public_table_ratings_stats/up.yaml +++ /dev/null @@ -1,22 +0,0 @@ -- args: - permission: - allow_aggregations: false - columns: - - bp - - ratings_cntr - - average - - transparency - - infrastructure - - trustiness - - community - - development - - created_at - - updated_at - computed_fields: [] - filter: {} - limit: null - role: anonymous - table: - name: ratings_stats - schema: public - type: create_select_permission diff --git a/services/hasura/migrations/1587692864567_update_permission_anonymous_public_table_user_ratings/down.yaml b/services/hasura/migrations/1587692864567_update_permission_anonymous_public_table_user_ratings/down.yaml deleted file mode 100644 index 7e7cbd9f..00000000 --- a/services/hasura/migrations/1587692864567_update_permission_anonymous_public_table_user_ratings/down.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - role: anonymous - table: - name: user_ratings - schema: public - type: drop_select_permission diff --git a/services/hasura/migrations/1587692864567_update_permission_anonymous_public_table_user_ratings/up.yaml b/services/hasura/migrations/1587692864567_update_permission_anonymous_public_table_user_ratings/up.yaml deleted file mode 100644 index ef987239..00000000 --- a/services/hasura/migrations/1587692864567_update_permission_anonymous_public_table_user_ratings/up.yaml +++ /dev/null @@ -1,17 +0,0 @@ -- args: - permission: - allow_aggregations: false - columns: - - ratings - - tx_data - - bp - - uniq_rating - - user - computed_fields: [] - filter: {} - limit: null - role: anonymous - table: - name: user_ratings - schema: public - type: create_select_permission diff --git a/services/hasura/migrations/1587692968903_save_action_perm/down.yaml b/services/hasura/migrations/1587692968903_save_action_perm/down.yaml deleted file mode 100644 index 3c7b2a9b..00000000 --- a/services/hasura/migrations/1587692968903_save_action_perm/down.yaml +++ /dev/null @@ -1,4 +0,0 @@ -- args: - action: rateProducer - role: anonymous - type: drop_action_permission diff --git a/services/hasura/migrations/1587692968903_save_action_perm/up.yaml b/services/hasura/migrations/1587692968903_save_action_perm/up.yaml deleted file mode 100644 index bf8cd938..00000000 --- a/services/hasura/migrations/1587692968903_save_action_perm/up.yaml +++ /dev/null @@ -1,7 +0,0 @@ -- args: - action: rateProducer - definition: - select: - filter: {} - role: anonymous - type: create_action_permission diff --git a/services/hasura/migrations/1591561533500_update_permission_anonymous_public_table_user_ratings/down.yaml b/services/hasura/migrations/1591561533500_update_permission_anonymous_public_table_user_ratings/down.yaml deleted file mode 100644 index 817ef3bf..00000000 --- a/services/hasura/migrations/1591561533500_update_permission_anonymous_public_table_user_ratings/down.yaml +++ /dev/null @@ -1,6 +0,0 @@ -- args: - role: anonymous - table: - name: user_ratings - schema: public - type: drop_delete_permission diff --git a/services/hasura/migrations/1591561533500_update_permission_anonymous_public_table_user_ratings/up.yaml b/services/hasura/migrations/1591561533500_update_permission_anonymous_public_table_user_ratings/up.yaml deleted file mode 100644 index 0d18ba0c..00000000 --- a/services/hasura/migrations/1591561533500_update_permission_anonymous_public_table_user_ratings/up.yaml +++ /dev/null @@ -1,9 +0,0 @@ -- args: - permission: - backend_only: false - filter: {} - role: anonymous - table: - name: user_ratings - schema: public - type: create_delete_permission diff --git a/services/hasura/migrations/1591591375238_modify_action_rateProducer_to_rateProducer/down.yaml b/services/hasura/migrations/1591591375238_modify_action_rateProducer_to_rateProducer/down.yaml deleted file mode 100644 index 2e1a545b..00000000 --- a/services/hasura/migrations/1591591375238_modify_action_rateProducer_to_rateProducer/down.yaml +++ /dev/null @@ -1,45 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - arguments: null - description: null - name: message - type: String! - name: RatingOutput - relationships: null - - description: null - fields: - - arguments: null - description: null - name: message - type: String! - name: deleteUserRateOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1591591375238_modify_action_rateProducer_to_rateProducer/up.yaml b/services/hasura/migrations/1591591375238_modify_action_rateProducer_to_rateProducer/up.yaml deleted file mode 100644 index ee28c6f7..00000000 --- a/services/hasura/migrations/1591591375238_modify_action_rateProducer_to_rateProducer/up.yaml +++ /dev/null @@ -1,54 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: message - type: String! - - description: null - name: uniq_rating - type: String - - description: null - name: user - type: String - - description: null - name: bp - type: String - name: RatingOutput - relationships: null - - description: null - fields: - - arguments: null - description: null - name: message - type: String! - name: deleteUserRateOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - type: mutation - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1591592964244_modify_action_rateProducer_to_rateProducer/down.yaml b/services/hasura/migrations/1591592964244_modify_action_rateProducer_to_rateProducer/down.yaml deleted file mode 100644 index f346f256..00000000 --- a/services/hasura/migrations/1591592964244_modify_action_rateProducer_to_rateProducer/down.yaml +++ /dev/null @@ -1,58 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - arguments: null - description: null - name: message - type: String! - - arguments: null - description: null - name: uniq_rating - type: String - - arguments: null - description: null - name: user - type: String - - arguments: null - description: null - name: bp - type: String - name: RatingOutput - relationships: null - - description: null - fields: - - arguments: null - description: null - name: message - type: String! - name: deleteUserRateOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - type: mutation - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/1591592964244_modify_action_rateProducer_to_rateProducer/up.yaml b/services/hasura/migrations/1591592964244_modify_action_rateProducer_to_rateProducer/up.yaml deleted file mode 100644 index 011268dd..00000000 --- a/services/hasura/migrations/1591592964244_modify_action_rateProducer_to_rateProducer/up.yaml +++ /dev/null @@ -1,57 +0,0 @@ -- args: - enums: [] - input_objects: - - description: null - fields: - - description: null - name: user - type: String! - - description: null - name: producer - type: String! - name: RatingInput - objects: - - description: null - fields: - - description: null - name: message - type: String! - - description: null - name: uniq_rating - type: String - - description: null - name: user - type: String - - description: null - name: bp - type: String - - description: null - name: ratings - type: jsonb - name: RatingOutput - relationships: null - - description: null - fields: - - arguments: null - description: null - name: message - type: String! - name: deleteUserRateOutput - relationships: null - scalars: [] - type: set_custom_types -- args: - comment: null - definition: - arguments: - - description: null - name: ratingInput - type: RatingInput! - forward_client_headers: false - handler: http://hapi:3005/ratebp - headers: [] - kind: synchronous - output_type: RatingOutput - type: mutation - name: rateProducer - type: update_action diff --git a/services/hasura/migrations/metadata.yaml b/services/hasura/migrations/metadata.yaml deleted file mode 100644 index 7407f974..00000000 --- a/services/hasura/migrations/metadata.yaml +++ /dev/null @@ -1,127 +0,0 @@ -version: 2 -tables: - - table: - schema: public - name: producers - select_permissions: - - role: anonymous - permission: - columns: - - bpjson - - general_info - - owner - - system - filter: {} - - table: - schema: public - name: producers_list - select_permissions: - - role: anonymous - permission: - columns: - - owner - - bpjson - - system - - candidate_name - - total_votes - - average - - transparency - - infrastructure - - trustiness - - community - - development - - ratings_cntr - - general_info - filter: {} - - table: - schema: public - name: proxies - select_permissions: - - role: anonymous - permission: - columns: - - owner - - name - - website - - slogan - - philosophy - - background - - logo_256 - - telegram - - steemit - - twitter - - wechat - - voter_info - filter: {} - - table: - schema: public - name: ratings_stats - select_permissions: - - role: anonymous - permission: - columns: - - bp - - ratings_cntr - - average - - transparency - - infrastructure - - trustiness - - community - - development - - created_at - - updated_at - filter: {} - - table: - schema: public - name: user_ratings - select_permissions: - - role: anonymous - permission: - columns: - - ratings - - tx_data - - bp - - uniq_rating - - user - filter: {} - delete_permissions: - - role: anonymous - permission: - filter: {} -actions: - - name: rateProducer - definition: - handler: "{{HASURA_GRAPHQL_ACTION_BASE_URL}}/ratebp" - output_type: RatingOutput - arguments: - - name: ratingInput - type: RatingInput! - type: mutation - kind: synchronous - permissions: - - role: anonymous -custom_types: - input_objects: - - name: RatingInput - fields: - - name: user - type: String! - - name: producer - type: String! - objects: - - name: RatingOutput - fields: - - name: message - type: String! - - name: uniq_rating - type: String - - name: user - type: String - - name: bp - type: String - - name: ratings - type: jsonb - - name: deleteUserRateOutput - fields: - - name: message - type: String!