Skip to content

Issue #17 — Backend: Booking Status Management — Confirm, Cancel & Complete #709

@yusuftomilola

Description

@yusuftomilola

Location: backend/src/bookings/

Description

After a booking is created, admins need to manage its lifecycle — confirming it once payment is verified, marking it complete after the session ends, or cancelling it when needed. Members should also be able to cancel their own pending bookings. Each transition must validate that the current status allows the requested change to prevent invalid state jumps.

Acceptance Criteria

  • PATCH /bookings/:id/confirm — admin only (ADMIN, SUPER_ADMIN, STAFF)
    • Validates booking exists and current status is PENDING — throws BadRequestException if not
    • Sets status to CONFIRMED
    • Returns { success: true, message: "Booking confirmed successfully", data: Booking }
  • PATCH /bookings/:id/cancel — accessible by the booking owner or admin
    • Validates booking exists
    • Member can only cancel their own booking — throws ForbiddenException otherwise
    • Validates current status is PENDING or CONFIRMED — throws BadRequestException if already COMPLETED or CANCELLED
    • Sets status to CANCELLED
    • Returns { success: true, message: "Booking cancelled successfully", data: Booking }
  • PATCH /bookings/:id/complete — admin only
    • Validates booking exists and current status is CONFIRMED — throws BadRequestException if not
    • Sets status to COMPLETED
    • Returns { success: true, message: "Booking completed successfully", data: Booking }
  • Each action is handled by a dedicated provider class
  • npx tsc --noEmit passes with no errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions