Fix compliance checker: include structured_checks + pdf_checks from audit

Was only reading pdf_checks, missing structured_checks. Also skip
minor-only issues — show major/critical that match email campaign data.
This fixes the "clean" result for carriers our audit flagged as deficient.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-05-07 10:59:59 -05:00
parent 9c1b1387cb
commit b5282f5e00

View file

@ -291,8 +291,11 @@ router.get("/api/v1/fcc/lookup", async (req, res) => {
);
if (auditRow.rows.length > 0) {
const audit = auditRow.rows[0] as Record<string, unknown>;
const pChecks = (audit.pdf_checks as Array<{ label: string; severity: string }>) || [];
for (const pc of pChecks) {
// Merge both structured and PDF audit checks
const pChecks = (audit.pdf_checks as Array<{ id?: string; label: string; severity: string }>) || [];
const sChecks = (audit.structured_checks as Array<{ id?: string; label: string; severity: string }>) || [];
for (const pc of [...sChecks, ...pChecks]) {
if (pc.severity === "minor") continue; // only show major/critical
if (pc.label && !rmdIssues.some(i => i.label === pc.label)) {
rmdIssues.push(pc);
}