Code Monkey home page Code Monkey logo

last-hotel's Introduction

last-hotel

Simple booking hotel API

Context

CHALLENGE

Post-Covid scenario: People are now free to travel everywhere but because of the pandemic, a lot of hotels went bankrupt. Some former famous travel places are left with only one hotel. You’ve been given the responsibility to develop a booking API for the very last hotel in Cancun. The requirements are:

  • API will be maintained by the hotel’s IT department.
  • As it’s the very last hotel, the quality of service must be 99.99 to 100% => no downtime - For the purpose of the test, we assume the hotel has only one room available - To give a chance to everyone to book the room, the stay can’t be longer than 3 days and can’t be reserved more than 30 days in advance.
  • All reservations start at least the next day of booking,
  • To simplify the use case, a “DAY’ in the hotel room starts from 00:00 to 23:59:59. - Every end-user can check the room availability, place a reservation, cancel it or modify it. - To simplify the API is insecure.

Assumptions

  • We don't need to keep track of the room because there's only one room.
  • Price of the booking was left out for simplicity's sake

Features

image

  • CRUD api for customers and bookings.
  • Bookings also have an endpoint to list the available booking's dates. This endpoint only shows the next N days (30) that user can make a booking.
  • We have 2 properties to set how long in advance can customers book a hotel room and how long can they stay
app.maxDaysBeforeBooking=30
app.maxStay=3

Development choices

Framework

Springboot with hibernate

Database

I used H2 in memory database, but same results could be achieved with any other relational db. Went with H2 to be faster, but if this API would be deployed in prod I would have chosen another one and left h2 just for tests.

Further Improvements

  • Create a docker image.
  • Improve unit tests and integration tests, add more test cases.
  • Create env variables.
  • Expand the api features to include room price management.
  • Swagger documentation can be improved.

last-hotel's People

Contributors

brunokreutz avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.