Files
pgbackweb/internal/service/webhooks/run_webhook.sql
Luis Eduardo Jeréz Girón c9ea76be56 Add webhooks mechanism
2024-08-18 23:02:25 -06:00

17 lines
468 B
SQL

-- name: WebhooksServiceGetWebhooksToRun :many
SELECT * FROM webhooks
WHERE is_active = true
AND event_type = @event_type
AND @target_id = ANY(target_ids);
-- name: WebhooksServiceCreateWebhookResult :one
INSERT INTO webhook_results (
webhook_id, req_method, req_headers, req_body,
res_status, res_headers, res_body, res_duration
)
VALUES (
@webhook_id, @req_method, @req_headers, @req_body,
@res_status, @res_headers, @res_body, @res_duration
)
RETURNING *;