Complete Non-Conformance Report system replacing the PowerApps/SharePoint prototype: FastAPI + SQLAlchemy 2 (async) + Alembic + MySQL 8 backend, React 18 + Vite + TypeScript + MUI frontend, Entra ID auth (MSAL / JWKS, group-gated), Microsoft Graph delegated Mail.Send notifications (OBO), six-stage workflow state machine with server-side enforcement, atomic NCR-YYYY-NNNN numbering, attachments with camera capture, immutable field-level audit trail, admin reopen, reports + CSV export, WeasyPrint PDF traveler, Power BI reporting views + read-only DB user, documented VISUAL ERP job-lookup stub, pytest suite (26 tests), docker-compose deployment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
29 lines
995 B
Python
29 lines
995 B
Python
from fastapi import APIRouter, Depends
|
|
|
|
from app.auth.deps import CurrentUser, get_current_user
|
|
from app.services.job_lookup import get_job_lookup_service
|
|
|
|
router = APIRouter(tags=["jobs"])
|
|
|
|
|
|
@router.get("/jobs/{job_number}/lookup")
|
|
async def lookup_job(
|
|
job_number: str,
|
|
_: CurrentUser = Depends(get_current_user),
|
|
) -> dict:
|
|
"""Job-number enrichment endpoint. Returns {found: false} under the
|
|
default NullJobLookupService; a future VisualJobLookupService will return
|
|
part/customer/work-order data from Infor VISUAL without frontend changes."""
|
|
info = await get_job_lookup_service().lookup(job_number)
|
|
if info is None:
|
|
return {"found": False, "job_number": job_number}
|
|
return {
|
|
"found": True,
|
|
"job_number": job_number,
|
|
"part_id": info.part_id,
|
|
"part_description": info.part_description,
|
|
"customer_name": info.customer_name,
|
|
"work_order_status": info.work_order_status,
|
|
"source": info.source,
|
|
}
|