import type { Context } from "hono";
import { updateExpense, updateExpenseSchema } from "../expenses.service";

export async function updateExpenseHandler(c: Context) {
  const id = Number(c.req.param("id"));
  const body = await c.req.json();
  const parsed = updateExpenseSchema.parse(body);
  const result = await updateExpense(id, parsed);
  return c.json(result);
}
