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 <noreply@paperclip.ing>
This commit is contained in:
Flea Flicker
2026-03-27 13:28:40 +00:00
parent 80b8036741
commit a8bfefe7b5
+9 -9
View File
@@ -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,
});
});