From a4aca1216d6f23260c4e2401acdbafd21c112200 Mon Sep 17 00:00:00 2001 From: George Date: Mon, 28 Sep 2026 12:13:09 +0530 Subject: [PATCH] feat: --ADDED Api to get node details --- main.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/main.py b/main.py index 0b5288c..4b8c63b 100644 --- a/main.py +++ b/main.py @@ -555,6 +555,49 @@ def get_node_interfaces(db: Session = Depends(get_db),token_data: dict = Depends ) +@app.get("/spock/node-interfaces/{node_uuid}") +def get_node_interface_by_uuid( + node_uuid: UUID, + db: Session = Depends(get_db), + token_data: dict = Depends(verify_token) +): + try: + row = ( + db.query(NodeInterface) + .filter(NodeInterface.uuid == node_uuid) + .first() + ) + + if not row: + raise HTTPException( + status_code=404, + detail="Node not found" + ) + + return { + "status": "success", + "node": { + "uuid": str(row.uuid), + "if_id": row.if_id, + "if_name": row.if_name, + "if_nodeid": row.if_nodeid, + "host": row.host, + "port": row.port, + "dbname": row.dbname, + "user": row.user + } + } + + except HTTPException: + raise + + except Exception as e: + raise HTTPException( + status_code=500, + detail=str(e) + ) + + # !!!!!!!!!!!!!!!!!PASSWORD MUST BE STORED IN MANAGEMENT TABLE!!!!!!!!!!!!!! @app.delete("/spock/del-node-interfaces") def delete_node_interface(