Member-only story

EVENT SOURCING — THE PRIVILEGED MODEL FOR INDIRECTION — PART 2

Diogo Machado
7 min readNov 7, 2019

--

You can read the part 1 here.

Designing a Booking Service

In part 2 we will start to design a booking service, iterate over it and discuss all the steps. Let’s start with some requirements. We need a back-office to create hotels. Each hotel has a list of rooms. Each room has a capacity, a price and a reservation list with the interval of dates when it is booked. A hotel has an address, a city, a country and a list of facilities like pool, gym, children parks, etc. A back-office user can created and edit the hotel data, create new rooms, and manage room availability including booking cancellation. A customer can book rooms and cancel reservations.

Creating a relational database for this model is pretty straightforward, a table per entity and a foreign key for each 1-n relation. We implement the commands using database transaction, to ensure there are no race conditions between Clients bookings and/or a Back-Office edition. Our architecture is a very simple monolithic app.

Off course this application gets a lot of traction and soon the database have hundreds of thousand of…

--

--

Diogo Machado
Diogo Machado

Written by Diogo Machado

Software architect/developer. Developing software on the shoulders of giants.

Responses (1)