Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,6 +104,13 @@ class DeliveryOrderRequest(BaseModel):
|
|
| 104 |
delivery_address: str
|
| 105 |
contact_number: str
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
# --------------------
|
| 108 |
# INITIALIZATION
|
| 109 |
# --------------------
|
|
@@ -581,7 +588,7 @@ async def payment_callback(request: Request):
|
|
| 581 |
|
| 582 |
from fastapi_cache.decorator import cache
|
| 583 |
|
| 584 |
-
@app.get("/track_order/{deliveryId}", response_model=List[
|
| 585 |
@cache(expire=60) # Cache for 1 minute
|
| 586 |
async def get_order_tracking(order_id: str, page: int = 1, limit: int = 10):
|
| 587 |
order_id = order_id.upper() # Normalize the order ID to uppercase
|
|
|
|
| 104 |
delivery_address: str
|
| 105 |
contact_number: str
|
| 106 |
|
| 107 |
+
class TrackingUpdate(BaseModel):
|
| 108 |
+
status: str
|
| 109 |
+
message: str
|
| 110 |
+
timestamp: str # using ISO formatted datetime strings
|
| 111 |
+
location: Optional[Dict] = None
|
| 112 |
+
estimated_delivery: Optional[str] = None
|
| 113 |
+
|
| 114 |
# --------------------
|
| 115 |
# INITIALIZATION
|
| 116 |
# --------------------
|
|
|
|
| 588 |
|
| 589 |
from fastapi_cache.decorator import cache
|
| 590 |
|
| 591 |
+
@app.get("/track_order/{deliveryId}", response_model=List[TrackingUpdate])
|
| 592 |
@cache(expire=60) # Cache for 1 minute
|
| 593 |
async def get_order_tracking(order_id: str, page: int = 1, limit: int = 10):
|
| 594 |
order_id = order_id.upper() # Normalize the order ID to uppercase
|