From a8bfefe7b59910423db74b7fa8b06d48c6923036 Mon Sep 17 00:00:00 2001 From: Flea Flicker Date: Fri, 27 Mar 2026 13:28:40 +0000 Subject: [PATCH] fix(gro-47): add non-null assertions on Drizzle RETURNING results Drizzle's update().returning() types the array element as T | undefined. After the if (!appt) guard, updated is still typed as possibly undefined because RETURNING can succeed with no rows. Add ! assertions since we already guard with the existence check. Co-Authored-By: Paperclip --- apps/api/src/routes/portal.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/api/src/routes/portal.ts b/apps/api/src/routes/portal.ts index f7e1287..a40fd42 100644 --- a/apps/api/src/routes/portal.ts +++ b/apps/api/src/routes/portal.ts @@ -140,10 +140,10 @@ portalRouter.post("/appointments/:id/confirm", async (c) => { } return c.json({ - id: updated.id, - confirmationStatus: updated.confirmationStatus, - confirmedAt: updated.confirmedAt, - updatedAt: updated.updatedAt, + id: updated!.id, + confirmationStatus: updated!.confirmationStatus, + confirmedAt: updated!.confirmedAt, + updatedAt: updated!.updatedAt, }); }); @@ -204,11 +204,11 @@ portalRouter.post("/appointments/:id/cancel", async (c) => { } return c.json({ - id: updated.id, - status: updated.status, - confirmationStatus: updated.confirmationStatus, - cancelledAt: updated.cancelledAt, - updatedAt: updated.updatedAt, + id: updated!.id, + status: updated!.status, + confirmationStatus: updated!.confirmationStatus, + cancelledAt: updated!.cancelledAt, + updatedAt: updated!.updatedAt, }); });