mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
b274a2d240
Co-authored-by: Lyndon Maydwell <92299+sordina@users.noreply.github.com> Co-authored-by: Antoine Leblanc <1618949+nicuveo@users.noreply.github.com> Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com> Co-authored-by: hasura-bot <30118761+hasura-bot@users.noreply.github.com> Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> Co-authored-by: Ikechukwu Eze <22247592+iykekings@users.noreply.github.com> Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com> Co-authored-by: Rishichandra Wawhal <27274869+wawhal@users.noreply.github.com> Co-authored-by: Naveen Naidu <30195193+Naveenaidu@users.noreply.github.com> Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com> GitOrigin-RevId: c9a8be3cb607f7767e9d6791717106adf123e3a8
82 lines
1.8 KiB
YAML
82 lines
1.8 KiB
YAML
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');
|
|
|
|
- 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
|
|
handler: http://127.0.0.1:5593/get-user-by-email
|
|
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
|
|
handler: http://127.0.0.1:5593/get-user-by-email
|