Skip to content

feat: reschedule reservation#83

Merged
heitorrsdev merged 6 commits intomainfrom
feat/reschedule-reservation
Apr 10, 2026
Merged

feat: reschedule reservation#83
heitorrsdev merged 6 commits intomainfrom
feat/reschedule-reservation

Conversation

@heitorrsdev
Copy link
Copy Markdown
Owner

Description

Implements the "Reschedule Reservation" feature end-to-end, from domain logic to HTTP endpoint, including documentation and tests. The feature allows a client or barber to update the start/end times of an existing active reservation via PATCH /reservations/:id.

What was done

  • Added two new domain errors: CannotRescheduleCancelledReservationError and CannotReschedulePastReservationError
  • Added reschedule() method to the Reservation entity, enforcing all business invariants (cancelled status, authorization, past reservation, 1-hour client notice, invalid time range)
  • Made startTime and endTime mutable via private backing fields with public getters
  • Created RescheduleReservationCommand and RescheduleReservationUseCase
  • Registered the use case in ApplicationModule
  • Added RescheduleReservationDto for request validation
  • Exposed PATCH /reservations/:id in ReservationController
  • Mapped new errors in DomainErrorHttpMapper
  • Added 7 unit tests for reservation.reschedule() covering all invariants
  • Added 5 E2E tests for the PATCH endpoint
  • Added UC-09 to docs/use-cases.md

Why

Completing the core reservation lifecycle (create → cancel → reschedule) is a critical domain feature. The implementation follows the established layered architecture: domain invariants are validated in the entity, orchestration happens in the use case, and conflict detection is delegated to the PostgreSQL exclusion constraint (same proven pattern as CreateReservationUseCase).

@heitorrsdev heitorrsdev merged commit 24e6569 into main Apr 10, 2026
1 check passed
@heitorrsdev heitorrsdev deleted the feat/reschedule-reservation branch April 10, 2026 20:43
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.

1 participant