Problem Description
Design a RESTful API that allows a guest to book a trip.
The design should include:
- Core Endpoints: Define the necessary API endpoints for key operations such as searching for availability, creating a booking, viewing an existing booking, canceling a booking, and handling payment/confirmation processes if deemed necessary.
- Request/Response Shapes: Specify the structure of requests and responses for these endpoints, along with appropriate HTTP status codes.
- Data Model Design & Indexing: Propose a data model for storing booking and inventory information, including considerations for database indexing.
- Inventory Modeling Approaches: Compare and contrast two distinct approaches for managing inventory:
- Per-date inventory: Storing availability on a day-by-day basis.
- Range/interval-based inventory: Storing availability as contiguous date ranges. Discuss the pros and cons of each approach.
Follow-up
Extend the design to support modifying an existing booking, specifically for extending the checkout date. Detail the required changes to both the API and the underlying data model.
AI interview prep
Core dilemma
Balancing the need for accurate, real-time inventory availability and booking consistency under concurrent access with the complexities of different inventory modeling approaches and system scalability.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Problem Description
Design a RESTful API that allows a guest to book a trip.
The design should include:
- Core Endpoints: Define the necessary API endpoints for key operations such as searching for availability, creating a booking, viewing an existing booking, canceling a booking, and handling payment/confirmation processes if deemed necessary.
- Request/Response Shapes: Specify the structure of requests and responses for these endpoints, along with appropriate HTTP status codes.
- Data Model Design & Indexing: Propose a data model for storing booking and inventory information, including considerations for database indexing.
- Inventory Modeling Approaches: Compare and contrast two distinct approaches for managing inventory:
- Per-date inventory: Storing availability on a day-by-day basis.
- Range/interval-based inventory: Storing availability as contiguous date ranges. Discuss the pros and cons of each approach.
Follow-up
Extend the design to support modifying an existing booking, specifically for extending the checkout date. Detail the required changes to both the API and the underlying data model.