Hotel reservation DB specification Benjamin Ard Tom
Message summary
Messages to/from HR ● AvailabilityRequest :: (RoomType, Dates :: [Date]) ● AvailabilityResponse :: [ (Date, AmountOfAvailableRooms) ] ● PriceRequest :: (RoomType, NumberOfPersons, Date) ● PriceResponse :: Price ● RoomTypesRequest :: () ● RoomTypesResponse :: [RoomType]
Messages to/from UI ● ReserveRequest :: ( UserId, DateFrom, DateTo, RoomsAmount, NumberOfPersons, CustomerDetails :: (Name, Surname, Address, PaymentDetails) ) – NB! Removed datatypes, changed RoomNumber and CreditCardDetails ● ReserveResponse :: {Accept|Reject|Error} – Accept :: ReservationID ● NB! Removed CustomerID and CustomerPassword – Reject – Error
Messages to/from UI ● CancelRequest :: (ReservationID, UserId) – Removed CustomerID and CustomerPassword ● CancelResponse :: {Accept|Reject|Error}
Database definition
Database Assumed Functionality ● The database supports locking of our relations (tables). – Lock(relation) – Unlock(relation) ● Relational algebra
Relations ● Reservations – RoomType – Amount – Date – CustomerID – ReservationID ● Customers – Name – Address – PaymentDetails
Constraint: Reservations ● For each RoomType and Date, the sum of Amount should not be greater than the Amount of the RoomType in the hotel.
Relations(2) ● RoomTypes – Amount – RoomDetails – MaxNumberOfPersons ● Price – Date – PricePerPerson – RoomType
Database functions
HR functions ● Availability – Input: a::AvailabilityRequest – Output: b::AvailabilityResponse – For each input a.Date calculate the amount of rooms that are available on a.Date and has a.RoomType.
HR functions ● Price – Input: a::PriceRequest – Output: b::PriceResponse
HR functions ● RoomTypes – Input: RoomTypeRequest – Output: b::RoomTypeResponse
UI functions ● Reservation – Input: ReservationRequest – Output: ReservationResponse – If Address and Payment details are valid ● Lock(Reservations) – Insert all data in Reservations and return Accept/Reject ● Unlock(Reservations) – Else return Error
UI functions ● Cancellation – Input: CancelRequest – Output: CancelResponse – If input data is valid ● Lock(Reservations) – Remove reservation with the ReservationID equal to the given ReservationID and return Accept/Reject ● Unlock(Reservations) – Else return Error