|
|
|
@ -20,10 +20,13 @@ client = httpx.AsyncClient(timeout=300.0)
|
|
|
|
async def get_all(*, common):
|
|
|
|
async def get_all(*, common):
|
|
|
|
"""Returns all documents."""
|
|
|
|
"""Returns all documents."""
|
|
|
|
query = Select(AerosEquipment).options(
|
|
|
|
query = Select(AerosEquipment).options(
|
|
|
|
selectinload(AerosEquipment.aeros_equipment_details)
|
|
|
|
selectinload(AerosEquipment.master_equipment)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
results = await search_filter_sort_paginate(model=query, **common)
|
|
|
|
results = await search_filter_sort_paginate(model=query, **common)
|
|
|
|
reg_nodes = [node.node_name for node in results["items"]]
|
|
|
|
reg_nodes = [node.node_name for node in results["items"]]
|
|
|
|
|
|
|
|
equipment_data = {
|
|
|
|
|
|
|
|
node.node_name: node for node in results["items"]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
updateNodeReq = {"projectName": "trialapi", "equipmentNames": reg_nodes}
|
|
|
|
updateNodeReq = {"projectName": "trialapi", "equipmentNames": reg_nodes}
|
|
|
|
|
|
|
|
|
|
|
|
@ -42,10 +45,20 @@ async def get_all(*, common):
|
|
|
|
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e)
|
|
|
|
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
results["items"] = res
|
|
|
|
results["items"] = [
|
|
|
|
|
|
|
|
{"AerosData": data, "MasterData": equipment_data.get(data["equipmentName"]) } for data in res
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
return results
|
|
|
|
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def get_equipment_by_location_tag(*, db_session: DbSession, location_tag: str):
|
|
|
|
|
|
|
|
query = (
|
|
|
|
|
|
|
|
Select(AerosEquipment)
|
|
|
|
|
|
|
|
.where(AerosEquipment.location_tag == location_tag)
|
|
|
|
|
|
|
|
.options(selectinload(AerosEquipment.aeros_equipment_details))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def get_by_id(*, db_session: DbSession, id: UUID):
|
|
|
|
async def get_by_id(*, db_session: DbSession, id: UUID):
|
|
|
|
query = (
|
|
|
|
query = (
|
|
|
|
|