mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-10-23 05:11:57 +00:00
- Update all SQL queries to add missing columns - Update the create conversation API to allow setting the initiator of a conversation. For example, we might want to use this API to create a conversation on behalf of a customer, with the first message coming from the customer instead of the agent. This param allows this. - Minor refactors and clean up - Tidy go.mod - Rename structs to reflect purpose - Create focus structs for scanning JSON payloads for clarity.
49 lines
851 B
SQL
49 lines
851 B
SQL
-- name: get-business-hours
|
|
SELECT id,
|
|
created_at,
|
|
updated_at,
|
|
"name",
|
|
description,
|
|
is_always_open,
|
|
hours,
|
|
holidays
|
|
FROM business_hours
|
|
WHERE id = $1;
|
|
|
|
-- name: get-all-business-hours
|
|
SELECT id,
|
|
created_at,
|
|
updated_at,
|
|
"name",
|
|
description,
|
|
is_always_open,
|
|
hours,
|
|
holidays
|
|
FROM business_hours
|
|
ORDER BY updated_at DESC;
|
|
|
|
-- name: insert-business-hours
|
|
INSERT INTO business_hours (
|
|
"name",
|
|
description,
|
|
is_always_open,
|
|
hours,
|
|
holidays
|
|
)
|
|
VALUES ($1, $2, $3, $4, $5)
|
|
RETURNING *;
|
|
|
|
-- name: delete-business-hours
|
|
DELETE FROM business_hours
|
|
WHERE id = $1;
|
|
|
|
-- name: update-business-hours
|
|
UPDATE business_hours
|
|
SET "name" = $2,
|
|
description = $3,
|
|
is_always_open = $4,
|
|
hours = $5,
|
|
holidays = $6,
|
|
updated_at = NOW()
|
|
WHERE id = $1
|
|
RETURNING *; |