tirbofish/kitgit · commit
b80a1f0d7a84bc0cc43ab868b07b1976557f61b3
merge: feat/webhooks into integrate/all-features
Type: SSH
SSH Key Fingerprint:
Verified
SgQHY4vUORbJC3ZtdixCl62ek/4QGh/iG2FRSyjfGPc
@@ -0,0 +1,27 @@ +-- Repository webhooks + delivery log + +CREATE TABLE webhooks ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + repo_id UUID NOT NULL REFERENCES repositories(id) ON DELETE CASCADE, + url TEXT NOT NULL, + secret TEXT NOT NULL DEFAULT '', + events TEXT[] NOT NULL DEFAULT '{}', + active BOOLEAN NOT NULL DEFAULT TRUE, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + CONSTRAINT webhooks_url_http CHECK (url ~* '^https?://') +); +CREATE INDEX webhooks_repo_id_idx ON webhooks(repo_id); + +CREATE TABLE webhook_deliveries ( + id BIGSERIAL PRIMARY KEY, + webhook_id UUID NOT NULL REFERENCES webhooks(id) ON DELETE CASCADE, + event TEXT NOT NULL, + action TEXT NOT NULL DEFAULT '', + success BOOLEAN NOT NULL DEFAULT FALSE, + status_code INT, + error TEXT, + duration_ms INT, + created_at TIMESTAMPTZ NOT NULL DEFAULT now() +); +CREATE INDEX webhook_deliveries_webhook_id_idx ON webhook_deliveries(webhook_id); +CREATE INDEX webhook_deliveries_created_at_idx ON webhook_deliveries(created_at DESC); @@ -271,6 +271,30 @@ pub struct CommitDay { pub count: i32, } +#[derive(Debug, Clone, FromRow, Serialize)] +pub struct Webhook { + pub id: Uuid, + pub repo_id: Uuid, + pub url: String, + pub secret: String, + pub events: Vec<String>, + pub active: bool,
Large diffs are not rendered by default. Showing the first 50 of 1001 lines. Show full diff