import type { Context } from "hono";
import { updatePeriodicExpense, updatePeriodicExpenseSchema } from "../expenses.service";

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