Files
libredesk/internal/inbox/queries.sql
Abhinav Raut 50188352a5 fix: Use SyncedEnforcer in casbin, fixes panics.
feat: store user roles in user roles table, drops the roles table on users table.
feat: standardize column names in schema, renames disabled bool to enables.
- vue router fixes to allow components / pages to rerender after creating an object in db.
- minor fixes and refactors.
2025-01-22 03:40:32 +05:30

26 lines
803 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)
VALUES($1, $2, $3, $4, $5)
-- 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, updated_at = now()
where id = $1 and deleted_at is NULL;
-- name: soft-delete
UPDATE inboxes set deleted_at = now(), config = '{}' where id = $1 and deleted_at is NULL;
-- name: toggle
UPDATE inboxes
SET enabled = NOT enabled, updated_at = NOW()
WHERE id = $1;