This projects is an API for hotel management that performs reservation, customer, employee and room management.
- Customer, employee, room and reservation management.
- Date control for room reservations.
- Reservation, customer, employee and room CRUD operations.
- Backend: Node.js, Express.js
- Database: MongoDB, Mongoose
- Node.js
- MongoDB
- Clone the project:
git clone https://github.com/HasanBocek/HPMS-Backend.git cd HPMS-Backend - Install dependencies:
npm install
- Configure
.envfile:MONGODB_URI= SECRET=
- Start server:
npm start
- Project will be running on
localhost:4000
- Body
{ "status": "succes / error / server error / unknown", "message": "success_message", "error":" [error_messages]", "data": "data" }
-
Description: List the data by ID.
-
Path Parameters:
id(CustomID): Item ID.
-
Response Data: Item Data
- Description: List all customers.
- Data:
[ { "_id": "66f56186c7e96e81b3556d6a", "name": "Alva Marvin", "tckn": "894-64-3926", "address": "6077 Buddy Square Turtle Lake, ND 58575 ", "email": "summer.labadie@price.info", "gender": "Kadın", "phone": 12923306849, "nation": "US", "note": "", "reservations": [ "8JQP", "GPEL", "3V9J", "FM3Q" ], "customId": "INUO", "__v": 24 }, ]
- Description: List the customer by ID.
- Data: Customer Data
- Description: Create a new customer.
- Request Body:
- Content-Type:
application/json - Body:
{ "name": "(str)", "tckn": "SSN-TCKN-PASSPORTNO(str)", "address": "(str)", "email": "(str)", "gender": "(str)", "phone": "(int)", "nation": "(str)", "note": "(not required)(str)" }
- Content-Type:
- Response Data: Customer Data
- Description: Edit the customer by ID.
- Path Parameters:
id(CustomID): Customer ID.
- Request Body:
- Content-Type:
application/json - Body:
{ "name": "(str)", "tckn": "SSN-TCKN-PASSPORTNO(str)", "address": "(str)", "email": "(str)", "gender": "(str)", "phone": "(int)", "nation": "(str)", "note": "(not required)(str)" }
- Content-Type:
- Response Data: Edited Customer Data
- Description: List the customer by ID.
- Path Parameters:
id(CustomID): Customer ID.
- Description: List all rooms.
- Data:
[ { "_id": "66f56198c7e96e81b3556d7b", "roomType": { "roomName": "Room 1", "price": 400, "adults": 2, "childs": 0, "note": "" }, "roomNumber": 1, "note": "", "reservations": [ "8JQP", "GPEL", "3V9J", "FM3Q" ], "customId": "GVTR", "__v": 24 }, ]
- Description: List the empty rooms between the specified dates.
- Query Parameters:
checkInDate(Date[YYYY-MM-DD]): Checkin Date.checkOutDate(Date[YYYY-MM-DD]): Checkout Date.
- Data: Available Rooms Data
- Description: List the room by ID.
- Path Parameters:
id(CustomID): Room ID.
- Data: Room Data
- Description: Create a new room.
- Request Body:
- Content-Type:
application/json - Body:
{ "roomNumber": "(int)", "roomName": "(str)", "price": "(int)", "description": "(str)", "adults": "(int)", "childs": "(int)", "note": "(not required)(str)" }
- Content-Type:
- Data: Room Data
- Description: Edit the room by ID.
- Path Parameters:
id(CustomID): Room ID.
- Request Body:
- Content-Type:
application/json - Body:
{ "roomNumber": "(int)", "roomName": "(str)", "price": "(int)", "description": "(str)", "adults": "(int)", "childs": "(int)", "note": "(not required)(str)" }
- Content-Type:
- Data: Edited Room Data
- Description: Edit the room status by ID.
- Path Parameters:
id(CustomID): Room ID.
- Request Body:
- Content-Type:
application/json - Body:
{ "status": "(str)" // "Dirty", "Clean", "Cleaning", "Maintenance Required" }
- Content-Type:
- Data: Edited Room Data
- Description: Delete the room by ID.
- Path Parameters:
id(CustomID): Room ID.
- Description: List all reservations.
- Data:
[ { "_id": "66f563924331f07f2f2fd27e", "employee": "ZS24", "customers": [ "INUO" ], "rooms": [ "GVTR" ], "checkin": "2024-10-15", "checkout": "2024-10-17", "adults": 1, "childs": 0, "price": 200, "note": "", "isPaid": true, "customId": "8JQP", "__v": 0 }, ]
- Description: List the reservation by ID.
- Path Parameters:
id(CustomID): Reservation ID.
- Data: Reservation Data
- Description: Create a new reservation.
- Request Body:
- Content-Type:
application/json - Body:
{ "customers": "CUSTOMERID(arr)", "rooms": "ROOMID(arr)", "checkin": "(YYYY-MM-DD)(str)", "checkout": "(YYYY-MM-DD)(str)", "adults": "(int)", "childs": "(int)", "note": "(not required)(str)", "isPaid": "PAYMENT-STATUS(bool)" }
- Content-Type:
- Data: Reservation Data
- Description: Edit the reservation by ID.
- Path Parameters:
id(CustomID): Reservation ID.
- Request Body:
- Content-Type:
application/json - Body:
{ "customers": "(arr)", "rooms": "(arr)", "checkin": "(YYYY-MM-DD)(str)", "checkout": "(YYYY-MM-DD)(str)", "adults": "(int)", "childs": "(int)", "note": "(not required)(str)", "isPaid": "(bool)" }
- Content-Type:
- Data: Edited Reservation Data
- Description: Delete the reservation by ID.
- Path Parameters:
id(CustomID): Reservation ID.
- Description: List all employees.
- Data:
[ { "_id": "66dcaef908e8f025fb182fc8", "name": "Hasan Bocek", "job": "Dev", "salary": 200, "jobStartDate": "2024-08-25", "jobDescription": "123", "contact": { "tckn": "11111111111", "phone": 5555555555, "email": "mail@mail.com", "address": "address", "_id": "66f68e7349803958ce878cd4" }, "note": "", "dob": "2007-09-20", "password": "", "permissions": [ "ADMINISTRATOR" ], "customId": "ZS24" } ]
- Description: List the employee by ID.
- Path Parameters:
id(CustomID): Employee ID.
- Data: Employee Data
- Description: Create a new employee.
- Request Body:
- Content-Type:
application/json - Body:
{ "name": "(str)", "job": "(str)", "salary": "(int)", "jobStartDate": "(str)", "jobDescription": "(str)", "tckn": "(str)", "phone": "(int)", "email": "(str)", "address": "(str)", "dob": "(YYYY-MM-DD)(str)", "password": "(str)", "permissions": "(arr)" }
- Content-Type:
- Data: Employee Data
- Description: Edit the employee by ID.
- Path Parameters:
id(CustomID): Employee ID.
- Request Body:
- Content-Type:
application/json - Body:
{ "name": "(str)", "job": "(str)", "salary": "(int)", "jobStartDate": "(str)", "jobDescription": "(str)", "tckn": "(str)", "phone": "(int)", "email": "(str)", "address": "(str)", "dob": "(YYYY-MM-DD)(str)", "password": "(str)", "permissions": "(arr)" }
- Content-Type:
- Data: Edited Employee Data
- Description: Delete the employee by ID.
- Path Parameters:
id(CustomID): Employee ID.
- Description: Login.
- Request Body:
- Content-Type:
application/json - Body:
{ "email": "(str)", "password": "(str)" }
- Content-Type:
- Description: Logout.
- Response:
- Status:
200 OK - Headers:
Location: /login
- Status:
- Pull Request: If you want to make changes to the code, please send a pull request.
- Issue: Report bugs or development suggestions as issues.