feat(procedureCodes-dialog) - v2 done
This commit is contained in:
@@ -28,6 +28,32 @@ router.get("/:appointmentId", async (req: Request, res: Response) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.get(
|
||||
"/prefill-from-appointment/:appointmentId",
|
||||
async (req: Request, res: Response) => {
|
||||
try {
|
||||
const appointmentId = Number(req.params.appointmentId);
|
||||
|
||||
if (!appointmentId || isNaN(appointmentId)) {
|
||||
return res.status(400).json({ error: "Invalid appointmentId" });
|
||||
}
|
||||
|
||||
const data = await storage.getPrefillDataByAppointmentId(appointmentId);
|
||||
|
||||
if (!data) {
|
||||
return res.status(404).json({ error: "Appointment not found" });
|
||||
}
|
||||
|
||||
return res.json(data);
|
||||
} catch (err: any) {
|
||||
console.error("prefill-from-appointment error", err);
|
||||
return res
|
||||
.status(500)
|
||||
.json({ error: err.message ?? "Failed to prefill claim data" });
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* POST /api/appointment-procedures
|
||||
* Add single manual procedure
|
||||
|
||||
@@ -336,6 +336,15 @@ router.post("/", async (req: Request, res: Response): Promise<any> => {
|
||||
}
|
||||
|
||||
// --- TRANSFORM serviceLines
|
||||
if (
|
||||
!Array.isArray(req.body.serviceLines) ||
|
||||
req.body.serviceLines.length === 0
|
||||
) {
|
||||
return res.status(400).json({
|
||||
message: "At least one service line is required to create a claim",
|
||||
});
|
||||
}
|
||||
|
||||
if (Array.isArray(req.body.serviceLines)) {
|
||||
req.body.serviceLines = req.body.serviceLines.map(
|
||||
(line: InputServiceLine) => ({
|
||||
|
||||
Reference in New Issue
Block a user