MCPcopy
hub / github.com/IBM/AssetOpsBench / get_my_assigned_workorders

Function get_my_assigned_workorders

src/servers/wo/main.py:219–235  ·  view source on GitHub ↗

Work orders assigned to a given technician (labor code).

(
    labor_code: str, site_id: Optional[str] = None, open_only: bool = True
)

Source from the content-addressed store, hash-verified

217
218
219async def get_my_assigned_workorders(
220 labor_code: str, site_id: Optional[str] = None, open_only: bool = True
221) -> Union[WorkOrdersResult, ErrorResult]:
222 """Work orders assigned to a given technician (labor code)."""
223 res = await wo.get_my_assigned_workorders(db(), labor_code, site_id, open_only)
224 err = _failed(res)
225 if err:
226 return err
227 d = res["data"]
228 items = [WorkOrderItem.model_validate(x) for x in d["workorders"]]
229 return WorkOrdersResult(
230 site_id=site_id,
231 labor_code=labor_code,
232 total=d["totalCount"],
233 work_orders=items,
234 message=f"{d['totalCount']} work order(s) for {labor_code}.",
235 )
236
237
238async def generate_work_order(

Callers

nothing calls this directly

Calls 3

dbFunction · 0.85
_failedFunction · 0.85
WorkOrdersResultClass · 0.85

Tested by

no test coverage detected