- Restaurant (Id, Name, Menu[])
- Order (Id, RestaurantId, CustomerAddress, Status, Items[])
List restaurants
- Query parameters:
{
"cuisine": "Italian",
"location": "Downtown",
"rating": 4,
"isOpen": true
}
- Response:
{
"restaurants": [
{
"id": 1,
"name": "Bella Italia",
"cuisine": "Italian",
"rating": 4.5,
"estimatedDeliveryTime": 30,
"minimumOrder": 15.00
}
]
}
Place order
- Request:
{
"restaurantId": 1,
"customerName": "Eve Wilson",
"deliveryAddress": "123 Main St",
"phone": "123-456-7890",
"items": [
{
"menuItemId": 1,
"quantity": 2,
"specialInstructions": "Extra cheese"
}
]
}
- Validation:
- Restaurant must be open
- Minimum order amount
- Valid phone format
- Delivery address within range
Update order status
- Business rules:
- Sequential status updates
- Time tracking for each stage
- Notification triggers
Get restaurant analytics
- Response:
{
"period": "2024-11",
"totalOrders": 150,
"revenue": 4500.00,
"averageDeliveryTime": 28,
"popularItems": [
{
"name": "Margherita Pizza",
"orderCount": 45,
"revenue": 675.00
}
]
}
- Handle multiple payment methods
- Implement delivery tracking
- Manage delivery zones
- Handle order rating/feedback
Implement global exception handling with appropriate status codes:
- 400: Bad Request (validation errors)
- 404: Not Found
- 409: Conflict (business rule violations)
- 500: Internal Server Error