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:
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user