Skip to content

It was the first round of Zopsmart on-campus hiring, and though I was not selected in the very first round, which is the project review round, I don't know why they didn't select me, even though my project was much better than those who were shortlisted in the first round.But okay, sometimes things don't go as planned.It might not a good day for me

Notifications You must be signed in to change notification settings

rahulcode751/Hotel-Booking-System-Zopsmart-mini-project-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zopsmart Mini Project (Hotel Booking)

It was the first round of Zopsmart on-campus hiring, and though I was not selected in the very first round, which is the project review round, I don't know why they didn't select me, even though my project was much better than those who were shortlisted in the first round. But okay, sometimes things don't go as planned. It was not a good day for me, but that drive taught me a great lesson in life.

The Hotel Booking project, developed using the GoLang language and the Gofr framework, operates as a comprehensive API for managing hotel room reservations. With a single model featuring fields such as ID, hotel name, customer name, date, price, room number, and customer contact number, the API facilitates essential CRUD operations necessary for efficient hotel booking management. This backend solution offers seamless integration for hotel systems, optimizing the process of adding, retrieving, updating, and deleting booking entries.

Functions :

  • Add Booking Details: This API is basically used for adding booking details, i.e., customer-level details, date for booking, and price for rooms.
  • Get Booking Details By ID: This API is basically used for extracting the booking details of hotel rooms based on a unique ID issued for each booking.
  • Get All Booking Details: This API is basically used for extracting all booking details of hotel rooms.
  • Update Booking Entry Detail By ID: This API is basically used for updating the booking details, i.e., the customer-level details or the details related to room number, price, and date.
  • Delete booking entry details. By ID: This API is basically used to delete the booking details, or, in simple words, to say that the customer has checked out of the hotel.

Setup

Installation

Clone Repository

  git clone https://github.com/rahulcode751/Gofr.git
  cd Gofr

Initializing the go module

  go mod init zopsmart-mini-project
  go get gofr.dev

Go to configs folder and create .env file

  cd configs
  echo. > "ConfigsFolderPath\.env"

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

  APP_NAME = zopsmart-mini-project
  APP_VERSION = dev
  DB_HOST = localhost
  DB_PORT = 3306
  DB_USER = your_sql_username
  DB_PASSWORD = your_sql_password
  DB_NAME = Bookings
  DB_DIALECT = mysql

Create Database in mysql

  > CREATE DATABASE Bookings;
  > USE Bookings;
  > CREATE TABLE bookings(
      id int AUTO_INCREMENT PRIMAY KEY,
      hotelname varchar(255),
      customername varchar(255)
      date varchar(255)
      price int,
      customercontact varchar(10),
      roomno int
    );

Download and sync the required modules and start the project.

  go mod tidy
  go run main.go

For testing

  go test

Postman API Collection Documentation

Endpoints Description

Get Booking Details By ID

  URL - http://localhost:8000/hotelbooking/detail/:id
  METHOD - GET
  Path Variables [id:1]

Get All Booking Details

  URL - http://localhost:8000/hotelbooking/details
  METHOD - GET

Add Booking Details To System

  URL - http://localhost:8000/hotelbooking/add
  METHOD - POST
  Body - (content-type = application/json)
  {
    "HotelName":"Vedantam",
    "CustomerName":"Abhay Butola",
    "Date":"15-12-2024",
    "Price":1000,
    "CustomerContact":"6264959991",
    "roomno":22
  }

Update Booking Entry Detail By ID

  URL - http://localhost:8000/hotelbooking/update/:id
  METHOD - PUT
  Path Variables [id:1]
  Body - (content-type = application/json)
  {
    "HotelName":"Vedantam",
    "CustomerName":"Abhay Butola",
    "Date":"15-12-2024",
    "Price":1000,
    "CustomerContact":"6264959991",
    "roomno":24
  }

Delete Booking Entry Detail By ID

  URL - http://localhost:8000/hotelbooking/delete/:id
  METHOD - DELETE
  Path Variables [id:1]

UML Diagram

Sequence Diagram

SequenceDiagram

The above diagram depicts the sequence diagram for a hotel booking system.

1. Firstly, the customer provides details to the receptionist.
2. The receptionist then checks the available room.
3. The receptionist then asks for the payment of room available.
4. The customer then makes payment for the room.
5. Receptionists add details to the system.
6. The system generates a unique ID for each booking detail.
7. The receptionist then provides the key to the room to the customer.

UseCase Diagram

UsecaseDiagram

The above diagram depicts the UseCase Diagram for a hotel booking system.

1. Here, our project has two actors: the receptionist and the customer.
2. Receptionists have access to all the features, like adding, deleting, updating, and creating bookings.
3. The customer has provided the details of the room after payment is done.

🔗 Profile Links

linkedin

twitter

About

It was the first round of Zopsmart on-campus hiring, and though I was not selected in the very first round, which is the project review round, I don't know why they didn't select me, even though my project was much better than those who were shortlisted in the first round.But okay, sometimes things don't go as planned.It might not a good day for me

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages