A consumer of your hotel 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 Hotel record with a name, a phonenumber and a postcode.
-
Be able to retrieve a collection of all hotels (and associated information) with a single request.
-
Be able to create a Booking record, with a Customer id, a Hotel 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 Hotel records (these are unsupported operations).
-
Not be able to make create a Customer/Hotel/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.
-
Hotel name: a non-empty alphabetical string less than 50 characters in length.
-
Hotel phonenumber: a non-empty string which starts with a 0, contains only digits and is 11 characters in length.
-
Hotel postcode: a non-empty alpha-numerical string which is 6 characters in length.
-
Customer/Hotel/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.
-
Hotel phonenumber: A hotel’s phone number should be unique to that hotel.
-
Booking hotel & date: A combination of the hotel 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 hotel/date combination.