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:29:41 +00:00
parent 80a0cd95a1
commit 208e1fb5bc
+9 -9
View File
@@ -135,10 +135,10 @@ portalRouter.post("/appointments/:id/confirm", async (c) => {
.returning();
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,
});
});
@@ -195,11 +195,11 @@ portalRouter.post("/appointments/:id/cancel", async (c) => {
.returning();
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,
});
});