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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user