Giter Site home page Giter Site logo

cancunsurvivor's Introduction

License .NET Core

Reliability Rating Security Rating Maintainability Rating Code Smells Lines of Code Coverage Vulnerabilities Bugs

Cancun Survivor

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.

Requirements

  • 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.

Instructions

  • No time limit (very well done, you need at least 3 to 4 evenings)
  • The minimum required is a README and code.
  • All shortcuts to save time are allowed as far as documented. Any unexplained shortcut should be considered an error. We could accept a rendering with 3 lines of code if they make sense and all the reasoning and issues to be taken into account are described.

Overview

The application was built in .NET 5 and uses an in-memory database to store the data.

Usage

The API intends to follow common standards and practices. The endpoints are defined in plural and use HTTP methods to behave accordingly: GET, POST, PUT and DELETE.There are two areas available:

Rooms

The management of the single room available.

  • You can check all available rooms
    • GET /rooms
  • You can obtain the room (without its reservations)
    • GET /rooms/{id}
      • where [id} is a GUID
  • You can modify the name of the room
    • PUT /rooms/{id}
      • where [id} is a GUID
  • You cannot add a new room
  • You cannot delete the existing room

Reservation

The management of the reservations of the room.

  • You can check all existing reservations
    • GET /reservations
  • You can obtain the reservation
    • GET /reservations/{id}
      • where [id} is a GUID
  • You can add a new reservation
    • POST /reservations
  • You can modify the reservation
    • PUT /reservations/{id}
      • where [id} is a GUID
      • you cannot change who made the reservation (customer email)
  • You can delete an existing reservation
    • DELETE /reservations/{id}
      • where [id} is a GUID

Reservations validations follow the rules stated:

  • Maximum of 3 days stay.
  • Can book on day after (current date) and later.
  • The last day of the stay cannot exceed 30 days from current date.
  • The same customer (customer email) cannot book two reservations sequentially without a day between them.

Notes

  • An in-memory database was chosen for this demo.
  • The single room is generated each time the application starts and its id is randomly generated. There is no need to worry about it as booking new reservations does not require to set it.
  • Local datetime was considered the base for comparison. In real-world scenarios, the timezones and UTC should take place and play an important role.
  • I intended to use a simplified version of clean-architecture. I'm studying it lately so it was an opportunity to practice more.

Author

Lucas Rosinelli

cancunsurvivor's People

Contributors

lucasrosinelli avatar

Stargazers

 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.