Skip to content

Rent Domain Model

Class Diagram

UML diagram image

Rules

A scooter has three properties that decide if customers have the ability to rent it.

  • enabled: a scooter disabled by an employee cannot be rented;
  • standby: a scooter in standby mode cannot be rented;
  • outOfService: a scooter outside of its area of service cannot be rented.

While this context has the authority over the enabled property, the remaining are owned by different contexts which Rent has to integrate with.

The combination of the aforementioned properties defines the rentability of a scooter for what concerns the rent context. In addition, a scooter cannot be rented by any customer if another customer is already riding it. This defines its availability state. In order to succeed, a rent request must be made on a scooter that is both rentable and available at the time of the request.

Finally, a constraint exists to prevent customers from renting scooter while another rent is ongoing for them.

Rent lifecycle diagram

UML diagram image

Rent Process Diagram

UML diagram image

Domain Events

Rent aggregate

  • RentRequested: When a customer requests a rent.
  • RentConfirmed: When a rent is confirmed.
  • RentStopped: When a rent is stopped.
  • RentCancelled: When a rent is cancelled.
  • RentEnded: When a rent is ended either by cancellation or by stop.

Scooter aggregate

  • ScooterEnabled: When a scooter is enabled.
  • ScooterDisabled: When a scooter is disabled.
  • ScooterBecameRentable: When the combination of enabled/out of service/standby is changed to make the scooter rentable.
  • ScooterBecameNotRentable: When the combination of enabled/out of service/standby is changed to make the scooter not rentable.

Last update: January 16, 2022 23:20:33
Created: July 1, 2021 16:16:42
Authors: Simone (8.11%), ldeluigi (9.46%), Francesco Dente (82.43%)