El proyecto siguiente está desarrollado con Django y Django rest Framework.
Básicamente es una API donde yo puedo gestionar reservas de habitaciones de un hotel.
A continuación los diferentes EndPoints:
Servicio simple donde el cliente pueda hacer login.
POST v1/api/bookings/clients
| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Body Example
{
"nit":"12345439",
"comercial_name":"José Osinaga",
"invoice_name":"Monterrey",
"email"="jose@hotmail.com"
}
Obtiene los clientes registrados
GET v1/api/bookings/clients| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Registro de habitaciones.
POST v1/api/bookings/rooms
| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Body Example
{
"number":"A3",
"price":65
}
Obtiene las habitaciones registrados
GET v1/api/bookings/rooms| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Registro de reserva por parte del cliente.
IMPORTANTE
Un cliente puede reservar varias habitaciones desde una fecha determinada a otra fecha determinada. cada reserva puede tener su propia fecha.
POST v1/api/bookings/bookings| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Body Example
{
"client":1,
"rooms":[
{
"room":3,
"inicial_date":"2021-11-08",
"final_date":"2021-11-08"
},
{
"room":2,
"inicial_date":"2021-11-10",
"final_date":"2021-11-15"
}
]
}
Obtiene las habitaciones registrados.
Opcionalmente se puede digitar el nro para buscarlo en el path.
GET v1/api/bookings/bookings/${id}| Parameter | Type | Description |
|---|---|---|
id |
int |
Not Required. Id de la reserva |
Modifica el status de la reserva.
PATCH v1/api/bookings/bookings/${id}| Parameter | Type | Description |
|---|---|---|
id |
int |
Required. Id de la reserva |
Body Example
{
"status":2
}
Obtiene las habitaciones que el usuario puede registrar según la fecha dada. Identifica cuales y cuantas habitaciones puedo reservar.
GET v1/api/bookings/bookings/| QueryParam | Type | Description |
|---|---|---|
inicial_date |
date |
Required. fecha inicial de consulta |
final_date |
date |
Required. fecha final de consulta |
Registro de pagos.
POST v1/api/bookings/payments
| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Body Example
{
"number":"1",
"booking":2,
"status":1,
"method":1,
"date":"2021-11-03",
"amount":50.05
}
Obtiene los pagos registradas
GET v1/api/bookings/payments| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Registro de facturas.
POST v1/api/bookings/invoices
| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Body Example
{
"nit":"12345439",
"booking":2,
"status":1,
"name":"Nahim Terrazas",
"number":"1",
"auth_number":"213431342304030",
"code_control":"2K-5F-D2-5F",
"discount":0,
"total":50.05,
"date":"2021-11-03"
}
Obtiene los pagos invoices
GET v1/api/bookings/payments| Parameter | Type | Description |
|---|---|---|
| - | - | - |
Install python
Install pip
Install hotel-management with pip
pip install requirements.txtTo run tests, run the following command
py manage.py testClone the project
git clone https://github.com/nahimdhaney/hotel-management.gitGo to the project directory
cd hotel-managementInstall packages
pip install requirements.txtMigrations and migrate
py manage.py makemigrations
py manage.py migrateStart the server
py manage.py runserver