Skip to content
Snippets Groups Projects
Commit 38d0f9ce authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

init hasura from v2 datapods

parent 3b400f34
No related branches found
No related tags found
No related merge requests found
Showing
with 222 additions and 15 deletions
# === POSTGRES / HASURA ===
DB_PASSWORD=my_db_password
HASURA_GRAPHQL_ADMIN_SECRET=my_hasura_password
HASURA_LISTEN_PORT=8765
...@@ -2,23 +2,10 @@ ...@@ -2,23 +2,10 @@
logs logs
*.log *.log
npm-debug.log* npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log* pnpm-debug.log*
lerna-debug.log*
node_modules node_modules
dist
dist-ssr
*.local *.local
# Editor directories and files # Env
.vscode/* .env
!.vscode/extensions.json \ No newline at end of file
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
// Pointez pour afficher la description des attributs existants.
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "C+ import",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tsx",
"program": "./src/scripts/cesium-plus-import.ts",
"console": "integratedTerminal"
}
]
}
\ No newline at end of file
version: "3.6"
services:
postgres:
image: postgres:16
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 2s
timeout: 2s
retries: 5
hasura:
image: hasura/graphql-engine:v2.38.1.cli-migrations-v3
depends_on:
postgres:
condition: service_healthy
restart: always
ports:
- "${HASURA_LISTEN_PORT}:8080"
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:${DB_PASSWORD}@postgres:5432/postgres
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: public
HASURA_GRAPHQL_ENABLE_TELEMETRY: "false"
HASURA_GRAPHQL_ADMIN_SECRET: ${HASURA_GRAPHQL_ADMIN_SECRET}
volumes: # for local developement, you want to record the database migrations in git
- ./hasura/migrations:/hasura-migrations
- ./hasura/metadata:/hasura-metadata
volumes:
db_data:
type Mutation {
addTransaction(
id: String!
address: String!
hash: String!
signature: String!
comment: String!
): AddTransactionResponse
}
type Mutation {
deleteProfile(
address: String!
hash: String!
signature: String!
): DeleteProfileResponse
}
type Mutation {
migrateProfile(
addressOld: String!
addressNew: String!
hash: String!
signature: String!
): MigrateProfileResponse
}
type Mutation {
updateProfile(
address: String!
hash: String!
signature: String!
avatarBase64: String
title: String
description: String
city: String
socials: [SocialInput!]
geoloc: GeolocInput
): UpdateProfileResponse
}
input GeolocInput {
latitude: Float!
longitude: Float!
}
input SocialInput {
url: String!
type: String
}
type UpdateProfileResponse {
success: Boolean!
message: String!
}
type DeleteProfileResponse {
success: Boolean!
message: String!
}
type MigrateProfileResponse {
success: Boolean!
message: String!
}
type AddTransactionResponse {
success: Boolean!
message: String!
}
actions:
- name: addTransaction
definition:
kind: synchronous
handler: http://host.docker.internal:3000/add-transaction
permissions:
- role: public
comment: addTransaction
- name: deleteProfile
definition:
kind: synchronous
handler: http://host.docker.internal:3000/delete-profile-data
permissions:
- role: public
comment: deleteProfile
- name: migrateProfile
definition:
kind: synchronous
handler: http://host.docker.internal:3000/migrate-profile-data
permissions:
- role: public
comment: migrateProfile
- name: updateProfile
definition:
kind: synchronous
handler: http://host.docker.internal:3000/update-profile-data
timeout: 15
permissions:
- role: public
comment: updateProfile
custom_types:
enums: []
input_objects:
- name: GeolocInput
- name: SocialInput
objects:
- name: UpdateProfileResponse
- name: DeleteProfileResponse
- name: MigrateProfileResponse
- name: AddTransactionResponse
scalars: []
[]
{}
{}
[]
- 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"
table:
name: profiles
schema: public
computed_fields:
- name: avatar64
definition:
function:
name: bytea_to_base64
schema: public
comment: convert avatar from bytea to base64
select_permissions:
- role: public
permission:
columns:
- avatar
- address
- geoloc
- description
- created_at
- updated_at
computed_fields:
- avatar64
filter: {}
limit: 500
comment: ""
- "!include public_profiles.yaml"
disabled_for_roles: []
[]
{}
{}
{}
[]
[]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment