| Type | Service | Description |
|---|---|---|
| Hotel Manager | Onboarding | Hotel managers should be able to register and onboard their properties onto the platform. |
| Property Management |
Hotel managers should have the ability to update property details, such as:
|
|
| Booking Insights |
Hotel managers should be able to:
|
|
| User | Search Properties |
Users should be able to search for properties in a specific location with customizable filters, including:
|
| Book Properties | Users should be able to book properties directly from the platform. | |
| Manage Bookings | Users should have the ability to view and manage their past and upcoming bookings. | |
| Analytics | Analytics Enablement |
The system should be designed to support future analytics, such as:
|
When a booking is made:
The reserved room cannot stay indefinitely:
There are four possible outcomes after a booking:
Stores information about hotels.
Table Name: hotels
Columns:
- hotel_id: VARCHAR(255) [Primary Key]
- name: VARCHAR(255)
- location: VARCHAR(255)
- rooms: INT
- available_rooms: INT
- amenities: JSON
- manager_id: VARCHAR(255)
- created_at: TIMESTAMP
- updated_at: TIMESTAMP
Stores information about users who use the platform.
Table Name: users
Columns:
- user_id: VARCHAR(255) [Primary Key]
- name: VARCHAR(255)
- email: VARCHAR(255) [Unique]
- phone: VARCHAR(15)
- password_hash: VARCHAR(255)
- created_at: TIMESTAMP
- updated_at: TIMESTAMP
Stores booking details for users.
Table Name: bookings
Columns:
- booking_id: VARCHAR(255) [Primary Key]
- hotel_id: VARCHAR(255) [Foreign Key to hotels(hotel_id)]
- user_id: VARCHAR(255) [Foreign Key to users(user_id)]
- checkin_date: DATE
- checkout_date: DATE
- rooms: INT
- status: ENUM('BOOKED', 'CANCELLED', 'COMPLETED')
- total_amount: DECIMAL(10, 2)
- created_at: TIMESTAMP
- updated_at: TIMESTAMP
Stores payment information for bookings.
Table Name: payments
Columns:
- payment_id: VARCHAR(255) [Primary Key]
- booking_id: VARCHAR(255) [Foreign Key to bookings(booking_id)]
- amount: DECIMAL(10, 2)
- payment_method: ENUM('credit_card', 'debit_card', 'paypal')
- status: ENUM('PENDING', 'SUCCESS', 'FAILED')
- created_at: TIMESTAMP
- updated_at: TIMESTAMP
Used for searching hotels based on criteria like location, amenities, and availability.
Index Name: hotels_index
Fields:
- hotel_id: VARCHAR(255)
- name: VARCHAR(255)
- location: VARCHAR(255)
- available_rooms: INT
- price_per_night: DECIMAL(10, 2)
- amenities: JSON
Stores historical booking data for analysis.
Table Name: bookings_archive
Columns:
- booking_id: VARCHAR(255) [Primary Key]
- hotel_id: VARCHAR(255)
- user_id: VARCHAR(255)
- checkin_date: DATE
- checkout_date: DATE
- rooms: INT
- status: ENUM('BOOKED', 'CANCELLED', 'COMPLETED')
- total_amount: DECIMAL(10, 2)
- archived_at: TIMESTAMP
Logs events for notifications and analytics.
Table Name: kafka_event_log
Columns:
- event_id: VARCHAR(255) [Primary Key]
- event_type: ENUM('BOOKING_CONFIRMED', 'BOOKING_CANCELLED', 'PAYMENT_SUCCESS', 'PAYMENT_FAILED')
- payload: JSON
- created_at: TIMESTAMP
The Hotel Service handles hotel-related data such as adding new hotels, updating details, and fetching information for managers.
Endpoint: POST /hotels
Request Body:
{
"name": "Hotel Paradise",
"location": "New York",
"rooms": 50,
"amenities": ["WiFi", "Pool", "Gym"],
"manager_id": "manager123"
}
Response:
{
"hotel_id": "hotel123",
"message": "Hotel added successfully"
}
Endpoint: PUT /hotels/{hotel_id}
Request Body:
{
"name": "Hotel Paradise Deluxe",
"amenities": ["WiFi", "Pool", "Spa"]
}
Response:
{
"message": "Hotel details updated successfully"
}
Endpoint: GET /hotels/{hotel_id}
Response:
{
"hotel_id": "hotel123",
"name": "Hotel Paradise",
"location": "New York",
"rooms": 50,
"available_rooms": 20,
"amenities": ["WiFi", "Pool", "Gym"]
}
This service provides APIs to search for available hotels based on criteria such as location, dates, and amenities.
Endpoint: GET /search
Request Parameters:
location=New York&checkin_date=2025-01-15&checkout_date=2025-01-20&amenities=WiFi
Response:
[
{
"hotel_id": "hotel123",
"name": "Hotel Paradise",
"location": "New York",
"available_rooms": 15,
"price_per_night": 150
},
{
"hotel_id": "hotel456",
"name": "City Lights Hotel",
"location": "New York",
"available_rooms": 10,
"price_per_night": 200
}
]
This service manages the booking process, including reservation creation, status updates, and cancellations.
Endpoint: POST /bookings
Request Body:
{
"hotel_id": "hotel123",
"user_id": "user789",
"checkin_date": "2025-01-15",
"checkout_date": "2025-01-20",
"rooms": 1
}
Response:
{
"booking_id": "booking456",
"status": "RESERVED",
"message": "Booking created successfully"
}
Endpoint: PUT /bookings/{booking_id}/cancel
Response:
{
"message": "Booking cancelled successfully"
}
Endpoint: GET /bookings/{booking_id}
Response:
{
"booking_id": "booking456",
"hotel_id": "hotel123",
"user_id": "user789",
"status": "RESERVED",
"checkin_date": "2025-01-15",
"checkout_date": "2025-01-20",
"rooms": 1
}
This service processes payments and communicates success or failure to the booking service.
Endpoint: POST /payments
Request Body:
{
"booking_id": "booking456",
"amount": 750,
"payment_method": "credit_card",
"card_details": {
"card_number": "4111111111111111",
"expiry_date": "12/26",
"cvv": "123"
}
}
Response:
{
"payment_id": "payment789",
"status": "SUCCESS",
"message": "Payment processed successfully"
}
Endpoint: GET /payments/{payment_id}
Response:
{
"payment_id": "payment789",
"status": "SUCCESS",
"amount": 750
}
This service allows users to view and manage their bookings, including retrieving booking history.
Endpoint: GET /users/{user_id}/bookings
Response:
[
{
"booking_id": "booking123",
"hotel_name": "Hotel Paradise",
"checkin_date": "2025-01-15",
"checkout_date": "2025-01-20",
"status": "BOOKED"
},
{
"booking_id": "booking456",
"hotel_name": "City Lights Hotel",
"checkin_date": "2025-02-01",
"checkout_date": "2025-02-05",
"status": "CANCELLED"
}
]
This service listens to Kafka events for updates such as booking status changes and sends notifications to users.
Example Kafka Event:
{
"event_type": "BOOKING_CONFIRMED",
"user_id": "user789",
"booking_id": "booking456",
"message": "Your booking at Hotel Paradise has been confirmed."
}
Manages data archival to Cassandra and Hadoop for historical analysis and storage.