graphql-engine/server/tests-py/queries/v1/metadata_order/setup.yaml
paritosh-08 0775c00b0d server: add validation for query collections
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3658
GitOrigin-RevId: 3c644da15c92cac16356985d0fe0c6adb7001862
2022-03-08 09:49:18 +00:00

198 lines
3.6 KiB
YAML

type: bulk
args:
- type: run_sql
args:
sql: |
CREATE TABLE test1 (id serial primary key);
CREATE TABLE test2 (id serial primary key);
CREATE FUNCTION get_test1(int)
RETURNS SETOF test1 as $$
SELECT * FROM test1 WHERE id = $1
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION get_test2(int)
RETURNS SETOF test2 as $$
SELECT * FROM test2 WHERE id = $1
$$ LANGUAGE SQL STABLE;
- type: track_table
args: test1
- type: track_table
version: 2
args:
table: test2
configuration:
custom_root_fields:
select: test2_select
insert: test2_insert
custom_column_names:
id: test2_id
- type: create_object_relationship
args:
table: test1
name: test2_obj1
using:
manual_configuration:
remote_table: test2
column_mapping:
id: id
- type: create_object_relationship
args:
table: test1
name: test2_obj2
using:
manual_configuration:
remote_table: test2
column_mapping:
id: id
- type: create_array_relationship
args:
table: test2
name: test1_arr1
using:
manual_configuration:
remote_table: test2
column_mapping:
id: id
- type: create_array_relationship
args:
table: test2
name: test1_arr2
using:
manual_configuration:
remote_table: test2
column_mapping:
id: id
- type: create_select_permission
args:
table: test1
role: role1
permission:
columns: '*'
filter: {}
- type: create_select_permission
args:
table: test1
role: role2
permission:
columns: '*'
filter: {}
- type: create_insert_permission
args:
table: test1
role: role1
permission:
check: {}
- type: create_insert_permission
args:
table: test1
role: role2
permission:
check: {}
- type: create_update_permission
args:
table: test1
role: role1
permission:
columns: '*'
filter: {}
- type: create_update_permission
args:
table: test1
role: role2
permission:
columns: '*'
filter: {}
- type: create_delete_permission
args:
table: test1
role: role1
permission:
filter: {}
- type: create_delete_permission
args:
table: test1
role: role2
permission:
filter: {}
- type: create_event_trigger
args:
table: test1
name: event_trigger_1
insert:
columns: '*'
update:
columns: '*'
webhook: http://httpbin.org/post
- type: create_event_trigger
args:
table: test1
name: event_trigger_2
insert:
columns: '*'
update:
columns: '*'
webhook: http://httpbin.org/post
- type: track_function
args: get_test1
- type: track_function
args: get_test2
- type: create_query_collection
args:
name: collection_1
definition:
queries:
- name: query_1
query: |
query {
test1{
id
}
}
- name: query_2
query: |
query {
test2_select{
test2_id
}
}
- type: create_query_collection
args:
name: collection_2
definition:
queries:
- name: query_1
query: |
query {
get_test1(args: {id: 1}){
id
}
}
- name: query_2
query: |
query {
get_test2(args: {id: 1}){
test2_id
}
}
- type: add_collection_to_allowlist
args:
collection: collection_1
- type: add_collection_to_allowlist
args:
collection: collection_2