From 28ed09b33dfbdcddd81ff261caf9a1ec4a289180 Mon Sep 17 00:00:00 2001 From: "groombook-engineer[bot]" <3141748+groombook-engineer[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:44:14 +0000 Subject: [PATCH] fix(api): add 404 guard when logo confirm returns no rows The returning() on the update query can produce undefined when zero rows match. Added explicit 404 if updated is falsy. Co-Authored-By: Paperclip --- apps/api/src/routes/settings.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/api/src/routes/settings.ts b/apps/api/src/routes/settings.ts index 102d015..b08e526 100644 --- a/apps/api/src/routes/settings.ts +++ b/apps/api/src/routes/settings.ts @@ -132,6 +132,10 @@ settingsRouter.post( .where(eq(businessSettings.id, settingsId)) .returning(); + if (!updated) { + return c.json({ error: "Settings not found" }, 404); + } + return c.json({ ok: true, logoKey: updated.logoKey }); } );