feat: cloud storage updates, claims storage, appointment and insurance routes
This commit is contained in:
@@ -215,7 +215,7 @@ router.post(
|
||||
router.post(
|
||||
"/appointments/check-all-eligibilities",
|
||||
async (req: Request, res: Response): Promise<any> => {
|
||||
// Query param: date=YYYY-MM-DD (required)
|
||||
// Query param: date=YYYY-MM-DD (required), staffIds=1,2,3 (optional)
|
||||
const date = String(req.query.date ?? "").trim();
|
||||
if (!date) {
|
||||
return res
|
||||
@@ -223,6 +223,11 @@ router.post(
|
||||
.json({ error: "Missing date query param (YYYY-MM-DD)" });
|
||||
}
|
||||
|
||||
const staffIdsRaw = String(req.query.staffIds ?? "").trim();
|
||||
const staffIdFilter: Set<number> | null = staffIdsRaw
|
||||
? new Set(staffIdsRaw.split(",").map(Number).filter((n) => !isNaN(n) && n > 0))
|
||||
: null;
|
||||
|
||||
if (!req.user || !req.user.id) {
|
||||
return res.status(401).json({ error: "Unauthorized: user info missing" });
|
||||
}
|
||||
@@ -232,16 +237,21 @@ router.post(
|
||||
|
||||
try {
|
||||
// 1) fetch appointments for the day (reuse your storage API)
|
||||
const dayAppointments = await storage.getAppointmentsByDateForUser(
|
||||
const allDayAppointments = await storage.getAppointmentsByDateForUser(
|
||||
date,
|
||||
req.user.id
|
||||
);
|
||||
if (!Array.isArray(dayAppointments)) {
|
||||
if (!Array.isArray(allDayAppointments)) {
|
||||
return res
|
||||
.status(500)
|
||||
.json({ error: "Failed to load appointments for date" });
|
||||
}
|
||||
|
||||
// Filter by selected staff columns if provided
|
||||
const dayAppointments = staffIdFilter && staffIdFilter.size > 0
|
||||
? allDayAppointments.filter((a) => staffIdFilter.has(Number(a.staffId)))
|
||||
: allDayAppointments;
|
||||
|
||||
const results: Array<any> = [];
|
||||
|
||||
// process sequentially so selenium agent / python semaphore isn't overwhelmed
|
||||
|
||||
Reference in New Issue
Block a user