finish pgc impl

This commit is contained in:
2024-07-31 22:15:37 +02:00
parent f20f256313
commit cec183b416
4 changed files with 564 additions and 0 deletions

View File

@ -199,3 +199,36 @@ FROM
rooms
ORDER BY
room_name;
-- name: GetRestrictionsForRoomByDate :many
SELECT
id,
coalesce(reservation_id, 0),
restriction_id,
room_id,
start_date,
end_date
FROM
room_restrictions
WHERE
$1 < end_date
AND $2 >= start_date
AND room_id = $3;
-- name: InsertBlockForRoom :exec
INSERT INTO
room_restrictions (
start_date,
end_date,
room_id,
restriction_id,
created_at,
updated_at
)
VALUES
($1, $2, $3, $4, $5, $6);
-- name: DeleteBlockByID :exec
DELETE FROM room_restrictions
WHERE
id = $1;