From b731911e79f3c400bd195f6aaf4b4513b9ec1f0c Mon Sep 17 00:00:00 2001 From: Goldlabel Apps Ltd Date: Thu, 19 Mar 2026 20:37:35 +0000 Subject: [PATCH 1/2] Remove inline root, health, and echo routes Delete the local implementations of '/', '/health', and '/echo' from app/api/routes.py. These handlers were redundant after including root_router, health_router, and echo_router at the top of the file; removing them centralizes route definitions and eliminates the duplicate DB cursor and local Echo request/response logic. --- app/api/routes.py | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/app/api/routes.py b/app/api/routes.py index 954279b..285daef 100644 --- a/app/api/routes.py +++ b/app/api/routes.py @@ -22,47 +22,3 @@ router.include_router(health_router) router.include_router(echo_router) - - - - -@router.get("/") -def root(conn=Depends(get_db_connection)) -> dict: - """Return a structured welcome message for the API root, including product data.""" - cur = conn.cursor() - try: - cur.execute('SELECT id, name, description, price, in_stock, created_at FROM product;') - products = [ - { - "id": row[0], - "name": row[1], - "description": row[2], - "price": str(row[3]) if row[3] is not None else None, - "in_stock": row[4], - "created_at": row[5].isoformat() if row[5] else None, - } - for row in cur.fetchall() - ] - finally: - cur.close() - epoch = int(time.time() * 1000) - meta = { - "version": __version__, - "time": time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), - "epoch": epoch, - "severity": "success", - "message": f"NX AI says hello. Returned {len(products)} products.", - } - return {"meta": meta, "data": products} - - -@router.get("/health") -def health() -> dict[str, str]: - """Return the health status of the application.""" - return {"status": "ok"} - - -@router.post("/echo", response_model=EchoResponse) -def echo(body: EchoRequest) -> EchoResponse: - """Echo the provided message back to the caller.""" - return EchoResponse(echo=body.message) From b8f5991c90a296de122d8ce53ce4eef3e6f45c23 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Mar 2026 20:41:43 +0000 Subject: [PATCH 2/2] Initial plan