diff --git a/src/app/api/certifications/[id]/route.ts b/src/app/api/certifications/[id]/route.ts index f7bfeb9..3f51c43 100644 --- a/src/app/api/certifications/[id]/route.ts +++ b/src/app/api/certifications/[id]/route.ts @@ -16,16 +16,22 @@ function rowToCert(row: Record): Certification { } })(); return { - id: String(row.id ?? ""), - name: String(row.name ?? ""), + id: typeof row.id === "string" ? row.id : "", + name: typeof row.name === "string" ? row.name : "", level: isCertLevel(row.level) ? row.level : "Federal", authority: typeof row.authority === "string" ? row.authority : "", status: isCertStatus(row.status) ? row.status : "NOT_STARTED", dueDate: typeof row.due_date === "string" ? row.due_date : undefined, - appliedDate: typeof row.applied_date === "string" ? row.applied_date : undefined, - decisionExpected: typeof row.decision_expected === "string" ? row.decision_expected : undefined, - expiresDate: typeof row.expires_date === "string" ? row.expires_date : undefined, - description: typeof row.description === "string" ? row.description : undefined, + appliedDate: + typeof row.applied_date === "string" ? row.applied_date : undefined, + decisionExpected: + typeof row.decision_expected === "string" + ? row.decision_expected + : undefined, + expiresDate: + typeof row.expires_date === "string" ? row.expires_date : undefined, + description: + typeof row.description === "string" ? row.description : undefined, notes: typeof row.notes === "string" ? row.notes : undefined, documents, }; diff --git a/src/app/api/certifications/route.ts b/src/app/api/certifications/route.ts index b46beac..0b20431 100644 --- a/src/app/api/certifications/route.ts +++ b/src/app/api/certifications/route.ts @@ -42,16 +42,22 @@ function rowToCert(row: Record): Certification { } })(); return { - id: String(row.id ?? ""), - name: String(row.name ?? ""), + id: typeof row.id === "string" ? row.id : "", + name: typeof row.name === "string" ? row.name : "", level: isCertLevel(row.level) ? row.level : "Federal", authority: typeof row.authority === "string" ? row.authority : "", status: isCertStatus(row.status) ? row.status : "NOT_STARTED", dueDate: typeof row.due_date === "string" ? row.due_date : undefined, - appliedDate: typeof row.applied_date === "string" ? row.applied_date : undefined, - decisionExpected: typeof row.decision_expected === "string" ? row.decision_expected : undefined, - expiresDate: typeof row.expires_date === "string" ? row.expires_date : undefined, - description: typeof row.description === "string" ? row.description : undefined, + appliedDate: + typeof row.applied_date === "string" ? row.applied_date : undefined, + decisionExpected: + typeof row.decision_expected === "string" + ? row.decision_expected + : undefined, + expiresDate: + typeof row.expires_date === "string" ? row.expires_date : undefined, + description: + typeof row.description === "string" ? row.description : undefined, notes: typeof row.notes === "string" ? row.notes : undefined, documents, };