import type { Context } from "hono";
import { getMonthlyTotals } from "../expenses.service";

export async function getMonthlyTotalsHandler(c: Context) {
  const year = parseInt(c.req.query("year") ?? String(new Date().getUTCFullYear()), 10);
  const month = parseInt(c.req.query("month") ?? String(new Date().getUTCMonth() + 1), 10);
  const result = await getMonthlyTotals(year, month);
  return c.json(result);
}
