export memo-demo.hasura.app

This commit is contained in:
Nebel 2022-03-07 11:59:06 +09:00
parent d81260001b
commit 722c6553a8
11 changed files with 117 additions and 0 deletions

3
db/README.md Normal file
View file

@ -0,0 +1,3 @@
# [memo-demo.hasura.app](https://memo-demo.hasura.app)
https://cloud.hasura.io → "Git Deployment"

6
db/config.yaml Normal file
View file

@ -0,0 +1,6 @@
version: 3
endpoint: https://memo-demo.hasura.app
metadata_directory: metadata
actions:
kind: synchronous
handler_webhook_baseurl: http://localhost:3000

View file

6
db/metadata/actions.yaml Normal file
View file

@ -0,0 +1,6 @@
actions: []
custom_types:
enums: []
input_objects: []
objects: []
scalars: []

View file

@ -0,0 +1 @@
- collection: allowed-queries

View file

@ -0,0 +1,16 @@
- name: daily_reset
webhook: https://memo-demo.hasura.app/api/rest/delete_pages
schedule: 0 0 * * *
include_in_metadata: true
payload: {}
headers:
- value: "***"
name: x-hasura-admin-secret
- name: daily_seed
webhook: https://memo-demo.hasura.app/api/rest/seed_page
schedule: 1 0 * * *
include_in_metadata: true
payload: {}
headers:
- value: "***"
name: x-hasura-admin-secret

View file

@ -0,0 +1,35 @@
- name: default
kind: postgres
tables:
- table:
schema: public
name: pages
insert_permissions:
- role: anonymous
permission:
check: {}
columns:
- id
- content
backend_only: false
select_permissions:
- role: anonymous
permission:
columns:
- id
- content
filter: {}
update_permissions:
- role: anonymous
permission:
columns:
- id
- content
filter: {}
check: {}
configuration:
connection_info:
use_prepared_statements: false
database_url:
from_env: HEROKU_DATABASE_URL
isolation_level: read-committed

View file

@ -0,0 +1,11 @@
- name: allowed-queries
definition:
queries:
- name: get page
query: "query getPage($id: Int!) {\n page: pages_by_pk(id: $id) {\n id\n content\n }\n}"
- name: put page
query: "mutation putPage($id: Int, $content: jsonb!) {\n page: insert_pages_one(object: {id: $id, content: $content}, on_conflict: {constraint: pages_pkey, update_columns: content}) {\n id\n content\n }\n}"
- name: seed
query: "mutation seed($scheduled_time: String = \"\", $payload: jsonb = {}, $name: String = \"\", $id: String = \"\") {\n insert_pages_one(object: {id: 1, content: {ops: [{insert: \"メモ帳\\n\", attributes: {header: 1}}, {insert: \"\\nこんにちは!\\nこれは「Hasuraで作るREST API」のデモ用Webアプリです。\\nここに入力した内容は自動的にHasuraに送信されデータベースに保存されます。\\n\\n\"}], scheduled_time: $scheduled_time, payload: $payload, name: $name, id: $id}}) {\n id\n content\n }\n}"
- name: delete all
query: "mutation deleteAll($scheduled_time: String = \"\", $payload: jsonb = {}, $name: String = \"\", $id: String = \"\") {\n delete_pages(where: {id: {_is_null: false}, _or: {content: {_neq: {scheduled_time: $scheduled_time, payload: $payload, name: $name, id: $id}}}}) {\n affected_rows\n }\n}"

View file

@ -0,0 +1 @@
[]

View file

@ -0,0 +1,37 @@
- definition:
query:
collection_name: allowed-queries
query_name: delete all
url: delete_pages
methods:
- POST
- DELETE
name: delete all
comment: null
- definition:
query:
collection_name: allowed-queries
query_name: get page
url: page/:id
methods:
- GET
name: get page
comment: null
- definition:
query:
collection_name: allowed-queries
query_name: put page
url: page/:id
methods:
- PUT
name: put page
comment: null
- definition:
query:
collection_name: allowed-queries
query_name: seed
url: seed_page
methods:
- POST
name: seed
comment: null

1
db/metadata/version.yaml Normal file
View file

@ -0,0 +1 @@
version: 3