fix(group title added)
This commit is contained in:
@@ -126,17 +126,28 @@ router.post(
|
|||||||
responseType: "arraybuffer",
|
responseType: "arraybuffer",
|
||||||
});
|
});
|
||||||
|
|
||||||
const groupTitle = "Claims";
|
// Allowed keys as a literal tuple to derive a union type
|
||||||
|
const allowedKeys = [
|
||||||
|
"INSURANCE_CLAIM",
|
||||||
|
"INSURANCE_CLAIM_PREAUTH",
|
||||||
|
] as const;
|
||||||
|
type GroupKey = (typeof allowedKeys)[number];
|
||||||
|
const isGroupKey = (v: any): v is GroupKey =>
|
||||||
|
(allowedKeys as readonly string[]).includes(v);
|
||||||
|
|
||||||
// allowed keys
|
if (!isGroupKey(groupTitleKey)) {
|
||||||
const allowedKeys = ["INSURANCE_CLAIM", "INSURANCE_CLAIM_PREAUTH"];
|
|
||||||
if (!allowedKeys.includes(groupTitleKey)) {
|
|
||||||
return sendError(
|
return sendError(
|
||||||
res,
|
res,
|
||||||
`Invalid groupTitleKey. Must be one of: ${allowedKeys.join(", ")}`
|
`Invalid groupTitleKey. Must be one of: ${allowedKeys.join(", ")}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const GROUP_TITLES: Record<GroupKey, string> = {
|
||||||
|
INSURANCE_CLAIM: "Claims",
|
||||||
|
INSURANCE_CLAIM_PREAUTH: "Claims Preauth",
|
||||||
|
};
|
||||||
|
const groupTitle = GROUP_TITLES[groupTitleKey];
|
||||||
|
|
||||||
// ✅ Find or create PDF group for this claim
|
// ✅ Find or create PDF group for this claim
|
||||||
let group = await storage.findPdfGroupByPatientTitleKey(
|
let group = await storage.findPdfGroupByPatientTitleKey(
|
||||||
parsedPatientId,
|
parsedPatientId,
|
||||||
|
|||||||
Reference in New Issue
Block a user