fix(GRO-765): portal appointments crash — incomplete service data + response shape #322

Closed
groombook-engineer[bot] wants to merge 3 commits from fix/gro-765-portal-appointments-service into main
Showing only changes of commit dcb929be5b - Show all commits
-4
View File
@@ -40,7 +40,6 @@ portalRouter.get("/appointments", async (c) => {
const db = getDb();
const clientId = c.get("portalClientId");
const now = new Date();
const allAppts = await db
.select({
id: appointments.id,
@@ -83,9 +82,6 @@ portalRouter.get("/appointments", async (c) => {
staff: a.staffId ? { id: staffMap[a.staffId]?.id, name: staffMap[a.staffId]?.name } : null,
}));
const upcoming = appts.filter(a => a.startTime > now && a.status !== "cancelled");
const past = appts.filter(a => a.startTime <= now || a.status === "cancelled");
return c.json({ appointments: appts });
});