Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pluralize queries, self hasura #123

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
VITE_ENDPOINT=https://gh-discuss.devnet.govgen.dev
STORAGE_KEY=github-comment-jwt
VITE_REPO=allinbits/govgen-governance-discussions-test
VITE_GRAPHQL_ENDPOINT=https://graphql-devnet.govgen.dev/v1/graphql
#VITE_GRAPHQL_ENDPOINT=https://graphql-devnet.govgen.dev/v1/graphql
VITE_GRAPHQL_ENDPOINT=http://localhost:8080/v1/graphql
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ dist-ssr
/blob-report/
/playwright/.cache/
coverage
yarn.lock
36 changes: 36 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# To work, you need to have docker-compose up in allinbits/eclesia-indexer
# and create there a database `metadata-govgen-dapp`
# CREATE DATABASE "metadata-govgen-dapp";
networks:
eclesia-indexer_default:
external: true

services:
hasura:
image: hasura/graphql-engine:v2.38.0.cli-migrations-v3
ports:
- "8081:8080"
restart: always
networks:
- eclesia-indexer_default
environment:
# whitelist of gql queries for security purpose
HASURA_GRAPHQL_ENABLE_ALLOWLIST: "true"
# queries are send with x-hasura-role: anonymous
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "anonymous"
## postgres database to store Hasura metadata
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/metadata-govgen-dapp
## this env var can be used to add the above postgres database to Hasura as a data source. this can be removed/updated based on your needs
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
## uncomment next line to run console offline (i.e load console assets from server instead of CDN)
# HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets
## uncomment next line to set an admin secret
# HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_GRAPHQL_METADATA_DIR: "/hasura-metadata"
volumes:
- ./hasura/metadata:/hasura-metadata
6 changes: 6 additions & 0 deletions hasura/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 3
endpoint: http://localhost:8081
metadata_directory: metadata
actions:
kind: synchronous
handler_webhook_baseurl: http://localhost:3000
Empty file.
6 changes: 6 additions & 0 deletions hasura/metadata/actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions: []
custom_types:
enums: []
input_objects: []
objects: []
scalars: []
3 changes: 3 additions & 0 deletions hasura/metadata/allow_list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- collection: allowed-queries
scope:
global: true
1 change: 1 addition & 0 deletions hasura/metadata/api_limits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions hasura/metadata/backend_configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions hasura/metadata/cron_triggers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
14 changes: 14 additions & 0 deletions hasura/metadata/databases/databases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- name: default
kind: postgres
configuration:
connection_info:
database_url:
from_env: HASURA_GRAPHQL_DATABASE_URL
isolation_level: read-committed
pool_settings:
connection_lifetime: 600
idle_timeout: 180
max_connections: 50
retries: 1
use_prepared_statements: true
tables: "!include default/tables/tables.yaml"
62 changes: 62 additions & 0 deletions hasura/metadata/databases/default/tables/public_accounts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
table:
name: accounts
schema: public
configuration:
column_config: {}
custom_column_names: {}
custom_root_fields:
delete_by_pk: delete_account
insert_one: insert_account
select_by_pk: account
update_by_pk: update_account
array_relationships:
- name: balances
using:
foreign_key_constraint_on:
column: address
table:
name: balances
schema: public
- name: proposal_deposits
using:
foreign_key_constraint_on:
column: depositor_address
table:
name: proposal_deposits
schema: public
- name: proposal_votes
using:
foreign_key_constraint_on:
column: voter_address
table:
name: proposal_votes
schema: public
- name: proposals
using:
foreign_key_constraint_on:
column: proposer_address
table:
name: proposals
schema: public
- name: staked_balances
using:
foreign_key_constraint_on:
column: delegator
table:
name: staked_balances
schema: public
- name: validator_infos
using:
foreign_key_constraint_on:
column: self_delegate_address
table:
name: validator_infos
schema: public
select_permissions:
- comment: ""
permission:
allow_aggregations: true
columns:
- address
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table:
name: average_block_time_per_day
schema: public
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
table:
name: average_block_time_per_days
schema: public
configuration:
column_config: {}
custom_column_names: {}
custom_root_fields:
delete_by_pk: delete_average_block_time_per_day
insert_one: insert_average_block_time_per_day
select_by_pk: average_block_time_per_day
update_by_pk: update_average_block_time_per_day
select_permissions:
- comment: ""
permission:
columns:
- height
- one_row_id
- average_time
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table:
name: average_block_time_per_hour
schema: public
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
table:
name: average_block_time_per_hours
schema: public
configuration:
column_config: {}
custom_column_names: {}
custom_root_fields:
delete_by_pk: delete_average_block_time_per_hour
insert_one: insert_average_block_time_per_hour
select_by_pk: average_block_time_per_hour
update_by_pk: update_average_block_time_per_hour
select_permissions:
- comment: ""
permission:
columns:
- height
- one_row_id
- average_time
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table:
name: average_block_time_per_minute
schema: public
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
table:
name: average_block_time_per_minutes
schema: public
configuration:
column_config: {}
custom_column_names: {}
custom_root_fields:
delete_by_pk: delete_average_block_time_per_minute
insert_one: insert_average_block_time_per_minute
select_by_pk: average_block_time_per_minute
update_by_pk: update_average_block_time_per_minute
select_permissions:
- comment: ""
permission:
columns:
- height
- one_row_id
- average_time
filter: {}
role: anonymous
27 changes: 27 additions & 0 deletions hasura/metadata/databases/default/tables/public_balances.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
table:
name: balances
schema: public
configuration:
column_config: {}
custom_column_names: {}
custom_root_fields:
delete_by_pk: delete_balance
insert_one: insert_balance
select_by_pk: balance
update_by_pk: update_balance
object_relationships:
- name: account
using:
foreign_key_constraint_on: address
- name: block
using:
foreign_key_constraint_on: height
select_permissions:
- comment: ""
permission:
columns:
- coins
- height
- address
filter: {}
role: anonymous
119 changes: 119 additions & 0 deletions hasura/metadata/databases/default/tables/public_blocks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
table:
name: blocks
schema: public
configuration:
column_config: {}
custom_column_names: {}
custom_root_fields:
delete_by_pk: delete_block
insert_one: insert_block
select_by_pk: block
update_by_pk: update_block
object_relationships:
- name: validator
using:
foreign_key_constraint_on: proposer_address
array_relationships:
- name: balances
using:
foreign_key_constraint_on:
column: height
table:
name: balances
schema: public
- name: gov_params
using:
foreign_key_constraint_on:
column: height
table:
name: gov_params
schema: public
- name: proposal_deposits
using:
foreign_key_constraint_on:
column: height
table:
name: proposal_deposits
schema: public
- name: proposal_tally_results
using:
foreign_key_constraint_on:
column: height
table:
name: proposal_tally_results
schema: public
- name: proposal_votes
using:
foreign_key_constraint_on:
column: height
table:
name: proposal_votes
schema: public
- name: staked_balances
using:
foreign_key_constraint_on:
column: height
table:
name: staked_balances
schema: public
- name: supplies
using:
foreign_key_constraint_on:
column: height
table:
name: supplies
schema: public
- name: transactions
using:
foreign_key_constraint_on:
column: height
table:
name: transactions
schema: public
- name: validator_commissions
using:
foreign_key_constraint_on:
column: height
table:
name: validator_commissions
schema: public
- name: validator_descriptions
using:
foreign_key_constraint_on:
column: height
table:
name: validator_descriptions
schema: public
- name: validator_infos
using:
foreign_key_constraint_on:
column: height
table:
name: validator_infos
schema: public
- name: validator_statuses
using:
foreign_key_constraint_on:
column: height
table:
name: validator_statuses
schema: public
- name: validator_voting_powers
using:
foreign_key_constraint_on:
column: height
table:
name: validator_voting_powers
schema: public
select_permissions:
- comment: ""
permission:
columns:
- height
- total_gas
- num_txs
- hash
- proposer_address
- timestamp
filter: {}
role: anonymous
Loading
Loading