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.
- 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.
git clone https://github.com/rahulcode751/Gofr.git
cd Gofr
go mod init zopsmart-mini-project
go get gofr.dev
cd configs
echo. > "ConfigsFolderPath\.env"
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 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
);
go mod tidy
go run main.go
go test
Documentation link = Postman API Collection Documentation click here
URL - http://localhost:8000/hotelbooking/detail/:id
METHOD - GET
Path Variables [id:1]
URL - http://localhost:8000/hotelbooking/details
METHOD - GET
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
}
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
}
URL - http://localhost:8000/hotelbooking/delete/:id
METHOD - DELETE
Path Variables [id:1]
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.
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.