From 1a4d119b7c75ef447881f22a0058a4fbe9ce5515 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 19 Mar 2025 16:06:00 +0000 Subject: [PATCH] feat: Update endpoint orders --- endpoints/orders.post.py | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/endpoints/orders.post.py b/endpoints/orders.post.py index e69de29..a286ae1 100644 --- a/endpoints/orders.post.py +++ b/endpoints/orders.post.py @@ -0,0 +1,41 @@ +from fastapi import APIRouter, HTTPException +from typing import List, Dict +import uuid + +router = APIRouter() + +@router.post("/order-logistics") +async def order_logistics( + customer_name: str, + pickup_location: Dict[str, str], + dropoff_location: Dict[str, str], + package_details: str, + contact_number: str +): + """Create a logistics order for pickup and delivery""" + order_id = str(uuid.uuid4()) + + if not customer_name or not pickup_location or not dropoff_location or not contact_number: + raise HTTPException( + status_code=400, + detail="All required fields must be provided" + ) + + order_details = { + "id": order_id, + "customer_name": customer_name, + "pickup_location": pickup_location, + "dropoff_location": dropoff_location, + "package_details": package_details, + "contact_number": contact_number, + "status": "Pending" + } + + return { + "message": "Logistics order created successfully", + "data": order_details, + "metadata": { + "tracking_enabled": True, + "estimated_delivery_time": "2 hours" + } + }