2019-10-18 11:29:47 +03:00
|
|
|
- description: Add a computed field for author table
|
|
|
|
url: /v1/query
|
|
|
|
status: 200
|
|
|
|
query:
|
|
|
|
type: add_computed_field
|
|
|
|
args:
|
|
|
|
table: author
|
|
|
|
name: get_articles
|
|
|
|
definition:
|
|
|
|
function: fetch_articles
|
|
|
|
table_argument: author_row
|
|
|
|
response:
|
|
|
|
message: success
|
|
|
|
|
|
|
|
- description: Drop computed field of a non existed table
|
|
|
|
url: /v1/query
|
|
|
|
status: 400
|
|
|
|
query:
|
|
|
|
type: drop_computed_field
|
|
|
|
args:
|
|
|
|
table: random
|
|
|
|
name: get_articles
|
|
|
|
response:
|
2020-12-28 15:56:00 +03:00
|
|
|
path: $.args.table
|
|
|
|
error: 'table "random" does not exist in source: default'
|
2019-10-18 11:29:47 +03:00
|
|
|
code: not-exists
|
|
|
|
- description: Drop a non existed computed field
|
|
|
|
url: /v1/query
|
|
|
|
status: 400
|
|
|
|
query:
|
|
|
|
type: drop_computed_field
|
|
|
|
args:
|
|
|
|
table: author
|
|
|
|
name: random
|
|
|
|
response:
|
2020-12-28 15:56:00 +03:00
|
|
|
path: $.args.name
|
2019-10-18 11:29:47 +03:00
|
|
|
error: computed field "random" does not exist
|
|
|
|
code: not-exists
|
|
|
|
|
|
|
|
- description: Drop a valid computed field
|
|
|
|
url: /v1/query
|
|
|
|
status: 200
|
|
|
|
query:
|
|
|
|
type: drop_computed_field
|
|
|
|
args:
|
|
|
|
table: author
|
|
|
|
name: get_articles
|
|
|
|
response:
|
|
|
|
message: success
|
2020-04-27 18:07:03 +03:00
|
|
|
|
|
|
|
- description: Add a computed field, passing the Hasura session argument
|
|
|
|
url: /v1/query
|
|
|
|
status: 200
|
|
|
|
query:
|
|
|
|
type: add_computed_field
|
|
|
|
args:
|
|
|
|
table: author
|
|
|
|
name: test_session
|
|
|
|
definition:
|
|
|
|
function: test_session
|
|
|
|
session_argument: session
|
|
|
|
response:
|
|
|
|
message: success
|
|
|
|
|
|
|
|
- description: obtain the session variable via computed fields
|
|
|
|
url: /v1/graphql
|
|
|
|
status: 200
|
|
|
|
query:
|
|
|
|
query: |
|
|
|
|
query {
|
|
|
|
author_by_pk(id: 1) {
|
|
|
|
test_session(args:{key:"x-hasura-role"})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
response:
|
|
|
|
data:
|
|
|
|
author_by_pk:
|
|
|
|
test_session: admin
|