diff --git a/endpoints/api/v1/endpoint.post.py b/endpoints/api/v1/endpoint.post.py new file mode 100644 index 0000000..b6c438c --- /dev/null +++ b/endpoints/api/v1/endpoint.post.py @@ -0,0 +1,40 @@ +from fastapi import APIRouter, Depends, HTTPException +from core.database import fake_users_db +import random + +router = APIRouter() + +# Sample Abuja area districts/cities +ABUJA_CITIES = [ + "Garki", "Wuse", "Maitama", "Asokoro", "Gwarinpa", + "Kubwa", "Nyanya", "Karu", "Jabi", "Utako", + "Durumi", "Lugbe", "Gwagwalada", "Kuje", "Bwari", + "Dutse", "Life Camp", "Mpape", "Mabushi", "Katampe", + "Dakibiyu", "Galadimawa", "Lokogoma", "Apo", "Gudu" +] + +@router.post("/api/v1/endpoint") +async def generate_abuja_cities( + count: int = 5 +): + """Generate random cities in Abuja""" + if count <= 0 or count > len(ABUJA_CITIES): + raise HTTPException( + status_code=400, + detail=f"Count must be between 1 and {len(ABUJA_CITIES)}" + ) + + selected_cities = random.sample(ABUJA_CITIES, count) + + return { + "message": "Cities generated successfully", + "data": { + "cities": selected_cities, + "count": len(selected_cities) + }, + "metadata": { + "total_available_cities": len(ABUJA_CITIES), + "region": "Federal Capital Territory", + "country": "Nigeria" + } + } \ No newline at end of file