Coding Dojo

Edit on Gitlab

CQRS Booking

You should implement a simple booking soluiton in CQRS architecture.

About CQRS

CQRS for Command Query Responsibility Segregation Pattern.

A query returns data and does not alter the state of the object. A command changes the state of an object but does not return any data.

We will split our code in read ans write code to really live this pattern

Booking subject

We whant to make a booking solution for one hotel.

The first 2 users stories are :

They whant to use the CQRS pattern, To do that we will have :

one command service with a function bookARoom(Booking) they call the WriteRegistry they notify the ReadRegistry called by query service with function Room[] freeRooms(arrival: Date, departure: Date)

The Booking struct contains

And the Room struct contain only