A consumer of your taxi booking api should:
-
Be able to create a Customer record with a name, an email and a phonenumber
-
Be able to retrieve a collection of all customers (and associated information) with a single request.
-
Be able to create a Taxi record with a registration, and a number of seats.
-
Be able to retrieve a collection of all taxis (and associated information) with a single request.
-
Be able to create a Booking record, with a Customer id, a Taxi id & a future date.
-
Be able to retrieve a collection of all bookings made by a particular Customer, with a single request.
-
Be able to delete a Booking record.
-
Not be able to delete Customer or Taxi records (these are unsupported operations).
-
Not be able to create a Customer/Taxi/Booking record with incomplete or invalid information.
The validation requirements for your application’s data are up to you, though for simplicities sake we suggest something like the following:
-
Customer name: a non-empty alphabetical string less than 50 characters in length.
-
Customer email: a non-empty string which is a valid email address.
-
Customer phonenumber : a non-empty string which starts with a 0, contains only digits and is 11 characters in length.
-
Taxi registration: a non-empty alpha-numerical string which is 7 characters in length.
-
Taxi number of seats: a non-zero integer, in the range of 2-20.
-
Customer/Taxi/Booking id: a Long, which should not be settable or changable by an api consumer.
The following are the variables, or sets of variables, which should be unique for each Object of each Entity type in your system:
-
Customer email: A customer’s email address should be unique to that customer.
-
Taxi registration: A taxi’s registration should be unique to that taxi.
-
Booking taxi & date: A combination of the taxi for which a booking is made and the date for which it is made should be unique *.
Yes this does mean that for simplicities sake you should only have one customer per taxi/date combination.