2021-02-13 03:05:23 +03:00
|
|
|
type: bulk
|
|
|
|
args:
|
|
|
|
- type: create_query_collection
|
|
|
|
args:
|
|
|
|
name: test_collection
|
|
|
|
definition:
|
|
|
|
queries:
|
|
|
|
- name: simple_query_cached
|
|
|
|
query: "query @cached(ttl: 5) { test_table { first_name last_name } }"
|
|
|
|
|
|
|
|
- type: run_sql
|
|
|
|
args:
|
|
|
|
sql: |
|
|
|
|
create table test_table(
|
|
|
|
first_name text,
|
|
|
|
last_name text
|
|
|
|
);
|
|
|
|
|
|
|
|
- type: track_table
|
|
|
|
args:
|
|
|
|
schema: public
|
|
|
|
name: test_table
|
|
|
|
|
|
|
|
- type: create_select_permission
|
|
|
|
args:
|
|
|
|
table: test_table
|
|
|
|
role: user
|
|
|
|
permission:
|
|
|
|
columns: '*'
|
|
|
|
filter: {"first_name": "X-Hasura-User-Id"}
|
|
|
|
|
|
|
|
- type: run_sql
|
|
|
|
args:
|
|
|
|
sql: |
|
|
|
|
insert into test_table (first_name, last_name)
|
|
|
|
values
|
|
|
|
('Foo', 'Bar'),
|
|
|
|
('Baz', 'Qux'),
|
|
|
|
('X%20Y', 'Test');
|
2021-04-13 10:00:43 +03:00
|
|
|
|
|
|
|
- type: run_sql
|
|
|
|
args:
|
|
|
|
sql: |
|
|
|
|
CREATE TABLE "user"(
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
email TEXT NOT NULL
|
|
|
|
);
|
|
|
|
INSERT INTO "user" (name, email) VALUES ('Clarke 1', 'clarke1@gmail.com');
|
|
|
|
INSERT INTO "user" (name, email) VALUES ('Clarke 2', 'clarke2@gmail.com');
|
|
|
|
|
|
|
|
- type: set_custom_types
|
|
|
|
args:
|
|
|
|
objects:
|
|
|
|
- name: EmailResponse
|
|
|
|
fields:
|
|
|
|
- name: user
|
|
|
|
type: String!
|
|
|
|
|
|
|
|
- type: create_action
|
|
|
|
args:
|
|
|
|
name: get_user_by_email_1 # this action is being created with forward_client_headers set to `true`
|
|
|
|
definition:
|
|
|
|
type: query
|
|
|
|
arguments:
|
|
|
|
- name: email
|
|
|
|
type: String!
|
|
|
|
output_type: EmailResponse
|
2022-08-03 23:04:32 +03:00
|
|
|
handler: "{{ACTION_WEBHOOK_HANDLER}}/get-user-by-email"
|
2021-04-13 10:00:43 +03:00
|
|
|
forward_client_headers: true
|
|
|
|
|
|
|
|
- type: create_action
|
|
|
|
args:
|
|
|
|
name: get_user_by_email_2 # this action is being created with forward_client_headers set to `false`
|
|
|
|
definition:
|
|
|
|
type: query
|
|
|
|
arguments:
|
|
|
|
- name: email
|
|
|
|
type: String!
|
|
|
|
output_type: EmailResponse
|
2022-08-03 23:04:32 +03:00
|
|
|
handler: "{{ACTION_WEBHOOK_HANDLER}}/get-user-by-email"
|