Files
libredesk/internal/macro/queries.sql
T
Abhinav Raut f6e2fc1956 feat: allow sending attachments in new conversations
- replace existing combobox selects with common component selectcombobox.vue
2025-06-03 04:03:16 +05:30

71 lines
1014 B
SQL

-- name: get
SELECT
id,
name,
message_content,
created_at,
updated_at,
visibility,
user_id,
team_id,
actions,
visible_when,
usage_count
FROM
macros
WHERE
id = $1;
-- name: get-all
SELECT
id,
name,
message_content,
created_at,
updated_at,
visibility,
user_id,
team_id,
actions,
visible_when,
usage_count
FROM
macros
ORDER BY
usage_count DESC;
-- name: create
INSERT INTO
macros (name, message_content, user_id, team_id, visibility, visible_when, actions)
VALUES
($1, $2, $3, $4, $5, $6, $7);
-- name: update
UPDATE
macros
SET
name = $2,
message_content = $3,
user_id = $4,
team_id = $5,
visibility = $6,
visible_when = $7,
actions = $8,
updated_at = NOW()
WHERE
id = $1;
-- name: delete
DELETE FROM
macros
WHERE
id = $1;
-- name: increment-usage-count
UPDATE
macros
SET
usage_count = usage_count + 1,
updated_at = NOW()
WHERE
id = $1;