Fix backend build against hono 4.13 in finance routes.

Newer hono drops path-param typing on routes with a single untyped
middleware, so c.req.param('id') widens to string | undefined. Assert
the always-present :id param in the affected finance handlers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michilis
2026-10-03 05:11:06 +00:00
co-authored by Claude Opus 5.5
parent b3584e6c4d
commit 88e7325099
2 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -83,7 +83,7 @@ financeGlobalRouter.put('/settings/expense-categories/:id', ADMIN, zValidator('j
});
financeGlobalRouter.delete('/settings/expense-categories/:id', ADMIN, async (c) => {
const id = c.req.param('id');
const id = c.req.param('id')!;
const existing = await dbGet<any>((db as any).select().from(expenseCategories).where(eq((expenseCategories as any).id, id)));
if (!existing) return c.json({ error: 'Category not found' }, 404);
const [usedByExpense, usedByTemplate] = await Promise.all([
@@ -161,7 +161,7 @@ financeGlobalRouter.put('/settings/expense-templates/:id', ADMIN, zValidator('js
});
financeGlobalRouter.delete('/settings/expense-templates/:id', ADMIN, async (c) => {
const id = c.req.param('id');
const id = c.req.param('id')!;
const existing = await dbGet<any>((db as any).select().from(expenseTemplates).where(eq((expenseTemplates as any).id, id)));
if (!existing) return c.json({ error: 'Template not found' }, 404);
const [usedByExpense, usedByPack] = await Promise.all([
@@ -250,7 +250,7 @@ financeGlobalRouter.put('/settings/expense-template-packs/:id', ADMIN, zValidato
});
financeGlobalRouter.delete('/settings/expense-template-packs/:id', ADMIN, async (c) => {
const id = c.req.param('id');
const id = c.req.param('id')!;
const before = (await loadPacks()).find((p) => p.id === id);
if (!before) return c.json({ error: 'Pack not found' }, 404);
await runOps([