feat: add cancel reservation handler and background cleanup

Add CancelReservationHandler (DELETE /api/bookings/reserve) to release authenticated user's active reservation. Register route in main.go. Add background goroutine for periodic reservation cleanup using CleanupOldReservations. Add idx_time_blockers_created_at index and extend anon cleanup to cover edit_request reservations in init-script.sql.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-07-05 11:47:54 +01:00
co-authored by Sisyphus
parent 2386bd0ca2
commit 33c945159c
4 changed files with 366 additions and 4 deletions
+3 -1
View File
@@ -604,6 +604,7 @@ CREATE TABLE time_blockers (
CREATE INDEX idx_time_blockers_start_time ON time_blockers(start_time);
CREATE INDEX idx_time_blockers_cron ON time_blockers(cron_expression) WHERE cron_expression IS NOT NULL;
CREATE INDEX idx_time_blockers_created_by ON time_blockers(created_by);
CREATE INDEX idx_time_blockers_created_at ON time_blockers(created_at);
CREATE INDEX IF NOT EXISTS idx_time_blockers_desc_trgm ON time_blockers USING GIN (description gin_trgm_ops);
-- =======================================
@@ -918,7 +919,8 @@ BEGIN
UPDATE time_blockers
SET description = NULL
WHERE created_by = target_id
AND description LIKE 'RESERVATION:user:%';
AND (description LIKE 'RESERVATION:user:%'
OR description LIKE 'RESERVATION:edit_request:%');
-- Scrub notes on booking_edit_requests made by this user (free-text PII)
UPDATE booking_edit_requests