1
0
forked from wrenn/wrenn
Co-authored-by: Tasnim Kabir Sadik <tksadik92@gmail.com>
Reviewed-on: wrenn/sandbox#8
This commit is contained in:
2026-04-09 19:24:49 +00:00
parent 32e5a5a715
commit d3e4812e46
199 changed files with 24552 additions and 2776 deletions

29
db/queries/channels.sql Normal file
View File

@ -0,0 +1,29 @@
-- name: InsertChannel :one
INSERT INTO channels (id, team_id, name, provider, config, event_types)
VALUES ($1, $2, $3, $4, $5, $6)
RETURNING *;
-- name: ListChannelsByTeam :many
SELECT * FROM channels WHERE team_id = $1 ORDER BY created_at DESC;
-- name: GetChannelByTeam :one
SELECT * FROM channels WHERE id = $1 AND team_id = $2;
-- name: UpdateChannel :one
UPDATE channels SET name = $3, event_types = $4, updated_at = NOW()
WHERE id = $1 AND team_id = $2
RETURNING *;
-- name: UpdateChannelConfig :one
UPDATE channels SET config = $3, updated_at = NOW()
WHERE id = $1 AND team_id = $2
RETURNING *;
-- name: DeleteChannelByTeam :exec
DELETE FROM channels WHERE id = $1 AND team_id = $2;
-- name: ListChannelsForEvent :many
SELECT * FROM channels
WHERE team_id = $1
AND sqlc.arg(event_type)::text = ANY(event_types)
ORDER BY created_at;