mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-11-03 13:33:32 +00:00
29 lines
909 B
SQL
29 lines
909 B
SQL
-- name: get-active-inboxes
|
|
SELECT * from inboxes where enabled is TRUE and deleted_at is NULL;
|
|
|
|
-- name: get-all-inboxes
|
|
SELECT id, created_at, updated_at, name, channel, enabled from inboxes where deleted_at is NULL;
|
|
|
|
-- name: insert-inbox
|
|
INSERT INTO inboxes
|
|
(channel, config, "name", "from", csat_enabled, secret)
|
|
VALUES($1, $2, $3, $4, $5, $6)
|
|
RETURNING *
|
|
|
|
-- name: get-inbox
|
|
SELECT * from inboxes where id = $1 and deleted_at is NULL;
|
|
|
|
-- name: update
|
|
UPDATE inboxes
|
|
set channel = $2, config = $3, "name" = $4, "from" = $5, csat_enabled = $6, enabled = $7, secret = $8, linked_email_inbox_id = $9, updated_at = now()
|
|
where id = $1 and deleted_at is NULL
|
|
RETURNING *;
|
|
|
|
-- name: soft-delete
|
|
UPDATE inboxes set deleted_at = now(), config = '{}', enabled = false where id = $1 and deleted_at is NULL;
|
|
|
|
-- name: toggle
|
|
UPDATE inboxes
|
|
SET enabled = NOT enabled, updated_at = NOW()
|
|
WHERE id = $1
|
|
RETURNING *; |