这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@tirumaraiselvan
Copy link
Contributor

@tirumaraiselvan tirumaraiselvan commented Mar 26, 2019

Description

The new API adds an optional manual BOOLEAN key to the spec:

{
    "type" : "create_event_trigger",
    "args" : {
        "name": "testtrigger",
        "table": "users",
        "webhook": "https://httpbin.org/post",
        "insert": {
            "columns": "*"
        },
        "manual": true
    }
}

Affected components

  • Server
  • Console
  • Docs

Related Issues

#1687

Solution and Design

  • Create a new v1 query type: invoke_event_trigger
  • Create a function which takes row data and related metadata and inserts into event_log.
  • Use above function to take params from invoke_event_trigger

Steps to test and verify

  1. Create a table:
curl 'http://localhost:8080/v1/query'  -H 'Content-Type: application/json'  -d '{"type":"bulk","args":[{"type":"run_sql","args":{"sql":"CREATE TABLE public.\"users\"(\"username\" text NOT NULL, \"real_name\" text NOT NULL, PRIMARY KEY (\"username\") );"}},{"type":"add_existing_table_or_view","args":{"name":"users","schema":"public"}}]}' 
  1. Create an event trigger with manual spec:
curl -H 'Content-Type: application/json' -X POST -d '{"type": "create_event_trigger", "args": {"name": "testtrigger", "table": "users", "update": { "columns" : ["username", "real_name"]},"insert": { "columns" : ["username"] }, "manual": true, "webhook": "https://httpbin.org/post" } }' localhost:8080/v1/query
  1. Invoke an event manually:
curl -d '{"type": "invoke_event_trigger", "args": {"name": "testtrigger", "new": { "username": "manualusername", "real_name": "manualrealname"}, "old": null}}' localhost:8080/v1/query

Limitations, known bugs & workarounds

@netlify
Copy link

netlify bot commented Mar 26, 2019

Deploy preview for hasura-docs ready!

Built with commit 03b9d27

https://deploy-preview-1872--hasura-docs.netlify.com

@tirumaraiselvan tirumaraiselvan changed the title Manual event triggers: invoke event triggers manually on rows Manual event triggers: invoke event triggers manually on rows (close #1687) Mar 26, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 233bbdf deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-233bbdf

@hasura-bot
Copy link
Contributor

Review app for commit 6c533fc deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-6c533fc

@shahidhk shahidhk added the c/server Related to server label Mar 27, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 973972d deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-973972d

@hasura-bot
Copy link
Contributor

Review app for commit 041bde4 deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-041bde4

karthikvt26 and others added 5 commits April 9, 2019 16:48
@hasura-bot
Copy link
Contributor

Review app for commit 3517eca deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-3517eca

@hasura-bot
Copy link
Contributor

Review app for commit 251b3de deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-251b3de

@dsandip dsandip added this to the release-candidates milestone Apr 15, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 8c981bd deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-8c981bd5

@trekze
Copy link

trekze commented Apr 25, 2019

Tested the feature on the review app with glitch. Seems to work correctly!

@hasura-bot
Copy link
Contributor

Review app for commit db02a93 deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-db02a931

@hasura-bot
Copy link
Contributor

Review app for commit 82f2267 deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-82f2267b

@hasura-bot
Copy link
Contributor

Review app for commit 3a3484c deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-3a3484cf

@hasura-bot
Copy link
Contributor

Review app for commit 03b9d27 deployed to Heroku: https://hge-ci-pull-1872.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1872-03b9d279

@tirumaraiselvan
Copy link
Contributor Author

Closing this draft PR for actual PR

@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-1872.herokuapp.com is deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants