mirror of
https://github.com/kou029w/hasura-rest-hands-on.git
synced 2025-01-18 16:08:14 +00:00
export memo-demo.hasura.app
This commit is contained in:
parent
d81260001b
commit
722c6553a8
11 changed files with 117 additions and 0 deletions
3
db/README.md
Normal file
3
db/README.md
Normal 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
6
db/config.yaml
Normal 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
|
0
db/metadata/actions.graphql
Normal file
0
db/metadata/actions.graphql
Normal file
6
db/metadata/actions.yaml
Normal file
6
db/metadata/actions.yaml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
actions: []
|
||||||
|
custom_types:
|
||||||
|
enums: []
|
||||||
|
input_objects: []
|
||||||
|
objects: []
|
||||||
|
scalars: []
|
1
db/metadata/allow_list.yaml
Normal file
1
db/metadata/allow_list.yaml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
- collection: allowed-queries
|
16
db/metadata/cron_triggers.yaml
Normal file
16
db/metadata/cron_triggers.yaml
Normal 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
|
35
db/metadata/databases/databases.yaml
Normal file
35
db/metadata/databases/databases.yaml
Normal 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
|
11
db/metadata/query_collections.yaml
Normal file
11
db/metadata/query_collections.yaml
Normal 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}"
|
1
db/metadata/remote_schemas.yaml
Normal file
1
db/metadata/remote_schemas.yaml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
[]
|
37
db/metadata/rest_endpoints.yaml
Normal file
37
db/metadata/rest_endpoints.yaml
Normal 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
1
db/metadata/version.yaml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
version: 3
|
Loading…
Add table
Reference in a new issue