Skip to content

Allow cancelling active reservations until they end#33

Merged
xylo04 merged 1 commit into
mainfrom
copilot/allow-cancel-in-progress-reservation
May 25, 2026
Merged

Allow cancelling active reservations until they end#33
xylo04 merged 1 commit into
mainfrom
copilot/allow-cancel-in-progress-reservation

Conversation

Copilot AI commented May 25, 2026

Copy link
Copy Markdown
Contributor

Reservations could only be cancelled before their start time, which blocked owners and club admins from cancelling a reservation once it was already underway. This change extends cancellation to any active reservation that has not yet ended, while preserving the existing restriction on ended reservations.

  • Backend

    • Updates the cancel_reservation RPC to allow cancellation while a reservation is in progress.
    • Changes the cutoff from starts_at <= now() to ends_at <= now(), so ended reservations remain non-cancellable.
    • Keeps the existing authorization model intact: reservation owner or approved club admin only.
    • Preserves audit logging for cancellation events.
  • Frontend

    • Updates the reservation grid so the cancel action remains available for in-progress reservations.
    • Keeps ended reservations read-only in the UI.
  • Coverage

    • Adds focused grid-level tests for:
      • in-progress reservations remaining cancellable
      • ended reservations remaining non-cancellable
protected isCancellable(reservation: ClubReservation): boolean {
  if (new Date(reservation.ends_at) <= new Date()) return false;
  if (this.isAdmin()) return true;
  return reservation.membership_id === this.currentUserMembershipId();
}

@xylo04 xylo04 marked this pull request as ready for review May 25, 2026 02:25
@supabase

supabase Bot commented May 25, 2026

Copy link
Copy Markdown

Updates to Preview Branch (copilot/allow-cancel-in-progress-reservation) ↗︎

Deployments Status Updated
Database Mon, 25 May 2026 02:26:11 UTC
Services Mon, 25 May 2026 02:26:11 UTC
APIs Mon, 25 May 2026 02:26:11 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Mon, 25 May 2026 02:26:18 UTC
Migrations Mon, 25 May 2026 02:26:18 UTC
Seeding Mon, 25 May 2026 02:26:21 UTC
Edge Functions Mon, 25 May 2026 02:26:21 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@xylo04 xylo04 merged commit 3131c3a into main May 25, 2026
4 checks passed
@xylo04 xylo04 deleted the copilot/allow-cancel-in-progress-reservation branch May 25, 2026 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants