fix: inactive carriers show yellow warning instead of green, even if FMCSA says 'allowed'

This commit is contained in:
justin 2026-05-30 20:39:28 -05:00
parent 18fb45dba0
commit 2b8e2cf7ea

View file

@ -98,12 +98,16 @@ router.get("/api/v1/dot/lookup", async (req, res) => {
C: "Cancelled",
};
const statusLabel = statusLabels[statusCode] || statusCode;
const isInactive = statusCode === "I" || statusCode === "S" || statusCode === "C";
const effectiveStatus = allowed && !isInactive ? "green" : isInactive && allowed ? "yellow" : "red";
checks.push({
id: "operating_status",
label: "Operating Status",
status: allowed ? "green" : "red",
detail: allowed
? `Authorized to operate (${statusLabel}).`
status: effectiveStatus,
detail: effectiveStatus === "green"
? `Active and authorized to operate.`
: effectiveStatus === "yellow"
? `USDOT status is ${statusLabel}, but FMCSA still shows as authorized. This may indicate your registration needs to be updated or reactivated. Contact FMCSA at (800) 832-5660 if this is incorrect.`
: `NOT authorized to operate — ${statusLabel}. ${
statusCode === "I" ? "This USDOT number is inactive. You may need to reactivate it before operating."
: statusCode === "N" ? "This carrier is not authorized. Operating authority may be required."