fix: require completed photo review before pdf render

This commit is contained in:
2026-03-28 01:43:34 -05:00
parent a88d960ec9
commit b1722a04fa
4 changed files with 27 additions and 1 deletions

View File

@@ -28,8 +28,10 @@ export interface ReportPayload {
export function isDecisionGradeReportPayload(payload: ReportPayload): boolean {
const decision = String(payload.verdict?.decision || "").trim().toLowerCase();
const fairValueRange = String(payload.verdict?.fairValueRange || "").trim().toLowerCase();
const photoReviewStatus = String(payload.photoReview?.status || "").trim().toLowerCase();
if (!decision || decision === "pending") return false;
if (!fairValueRange || fairValueRange === "not established") return false;
if (photoReviewStatus !== "completed") return false;
return true;
}
@@ -79,7 +81,7 @@ export function validateReportPayload(payload: ReportPayload): string[] {
}
if (!isDecisionGradeReportPayload(payload)) {
throw new ReportValidationError(
"The report payload is still preliminary. Stop and complete the decision-grade analysis before generating or sending the property assessment PDF."
"The report payload is still preliminary. Stop and complete the decision-grade analysis, including subject-unit photo review, before generating or sending the property assessment PDF."
);
}
return recipients;