Coder Social home page Coder Social logo

betschki / hotel-api Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 1.0 194 KB

Generic Hotel API for a basic hotel booking system created with NestJS and SQLite.

License: GNU General Public License v3.0

JavaScript 1.68% TypeScript 98.32%
hotel booking-system hotel-booking

hotel-api's Introduction

Generic Hotel API

Generic Hotel API for a basic hotel booking system created with NestJS and SQLite.

(this is a hobby project to learn NestJS)

Table of contents

ToDos

  • Develop /hotels route
    • split address into address Object instead of string
    • implement /:id/rooms after basic /rooms route is created
    • add "number of rooms" to GET /hotels/:id Issue
    • implement /:id/categories after basic /categories route is created
  • Develop /rooms route
  • Develop /categories route
  • Develop /reservations route
    • add /:id/rooms route
  • Develop /guests route
    • add /:id/reservations
  • Set up typeorm relations (POST)
    • hotel --> rooms (OneToMany)
    • rooms --> hotels (ManyToOne)
    • categories --> rooms (OneToMany)
    • rooms --> categories (ManyToOne)
    • hotel --> cateogies (OneToMany)
    • categories --> hotels (ManyToOne)
    • reservations --> categories (ManyToMany)
    • categories --> reservations (ManyToMany)
    • reservations --> rooms (ManyToMany)
    • rooms --> reservations (ManyToMany)
    • reservations --> guest (ManyToOne)
    • guest --> reservations (OneToMany)
  • Set up typeorm relations for PATCH methods
    • /hotels
    • /rooms
    • /categories
    • /reservations
    • /guests
  • add Swagger for API documentation
  • add validation that POST /rooms can only contain roomCategory that belongs to hotel in request
  • add validation that roomNumbers cannot be used multiple times in same hotel
  • Strategy for date availability checker
  • Integrate authentication
  • Connect with Webflow API (as database option)

General info

This project serves a simple hotel booking system API that includes the following aspects (CRUD):

  • hotels can be created, viewed, updated, and deleted
  • room categories can be created, viewed, updated, and deleted
  • rooms can be created, viewed, updated, and deleted
  • guests can be created, viewed, updated, and deleted
  • reservations can be created, viewed, updated, and deleted

Hotels

A hotel has basic information, such as:

  • id
  • hotel name
  • star rating
  • address
  • number of rooms (dynamic, based on rooms attached to hotel)
  • room categories (dynamic, based on room categories attached to hotel)

Room Categories

Room categories are always tied to a hotel. One room category can not have multiple hotels, but a hotel can have multiple room categories. The name of the room category is shown in the frontend of the booking system (and therefore what a guest books)

A room category has basic information, such as:

  • id
  • hotel
  • name
  • number of rooms (dynamic, based on rooms attached to room category)
  • balcony [true/false]
  • baththub [true/false]
  • shower [true/false]
  • view [park, inland, sea view, partial sea view, sea front]
  • number of adults per room
  • number of children per room
  • price per night

Rooms

A room is tied to a room category and a hotel. Rooms are identified by their room number. The room name (e.g. displayed in a booking frontend) derives from the room category, therefore an individual room has no name.

A room has basic information, such as:

  • id (primary key in database)
  • room number (individual to the hotel's numbering system)
  • hotel
  • room category
  • size
  • smoking allowed [true/false]
  • pets allowed [true/false]

Guests

Guests can have multiple reservations and have basic information, such as:

  • id
  • name
  • gender
  • preferred payment method
  • billing address
  • staff notes

Reservations

Reservations are connected to guests, room categories, and rooms. When a guest makes a reservation, only a room categroy is assigned. Hotel staff can later on assign an individual room. One reservation can have multiple room (categories).

Reservations have basic information, such as:

  • id
  • guest
  • hotel
  • room categories
  • rooms
  • arrival date
  • departure date
  • total price
  • number of adults
  • number of children
  • pets
  • notes

hotel-api's People

Contributors

betschki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

nguyen-khoa01

hotel-api's Issues

Number of rooms dropped from `GET /hotels/:id`

Implementing the TypeORM relations between /hotels and rooms made some changes in the GET /hotels/:id necessary, in order for all types to still be valid.

After implementing all relations, the number of rooms should be re-implemented on this route.

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.