Exploring Some More Ideas

Learn about some more ideas that we can implement in the reservation application.

Expansions in the application

How about making the price depend on the hotel? What would change is that we’d get another type of data in the database, probably with the prefix HOTEL#, containing all relevant information about a hotel, like its name, location, and pricing. We’d also have to change the code in the Create Lambda before calculating the price, we’d do a retrieval of price data from the database, meaning our Either would become a TaskEither a bit earlier than before. Furthermore, to pass the information along, we could enrich our CreateReservationRequest with price information (roomPrice, for example), while leaving CreateReservationPricedRequest as-is because when the request has been priced, we no longer need that information. As usual, having the right kind of information in our data structure at the right time helps our compiler help us. This would require changes in quite a few files (index, database, and priceCalculation), though almost all of it would be contained within the specifics of the Create Lambda.

We could also make it possible to get discounts for early booking, perhaps depending on the hotel, in which case we might save this information in the database, perhaps under HOTEL#. The rest of the scenario is also similar to the above. We retrieve this information, add it to the type, and expand the price calculation. If we’ve already done the above, this new feature won’t affect the composition in our index, limiting the scope of our changes.

Get hands-on with 1200+ tech skills courses.