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({
|
return c.json({
|
||||||
id: updated.id,
|
id: updated!.id,
|
||||||
confirmationStatus: updated.confirmationStatus,
|
confirmationStatus: updated!.confirmationStatus,
|
||||||
confirmedAt: updated.confirmedAt,
|
confirmedAt: updated!.confirmedAt,
|
||||||
updatedAt: updated.updatedAt,
|
updatedAt: updated!.updatedAt,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -204,11 +204,11 @@ portalRouter.post("/appointments/:id/cancel", async (c) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return c.json({
|
return c.json({
|
||||||
id: updated.id,
|
id: updated!.id,
|
||||||
status: updated.status,
|
status: updated!.status,
|
||||||
confirmationStatus: updated.confirmationStatus,
|
confirmationStatus: updated!.confirmationStatus,
|
||||||
cancelledAt: updated.cancelledAt,
|
cancelledAt: updated!.cancelledAt,
|
||||||
updatedAt: updated.updatedAt,
|
updatedAt: updated!.updatedAt,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user