Files
khata-ui/src/features/report/useReport.ts

29 lines
689 B
TypeScript

import { useResourceByName } from "../../../react-openapi";
export interface ReportParams {
periods?: ("weekly" | "monthly" | "yearly" | "fyly" | "full")[];
rolling?: boolean;
report_date?: string;
group_by?: ("payee" | "tags")[];
ignore_self?: boolean;
include_transactions?: boolean;
start_date?: string;
end_date?: string;
flow?: "expense" | "income";
payee?: string[];
account?: string[];
tags?: string[];
min_amount?: number;
max_amount?: number;
}
export function useReport(params: ReportParams) {
const { useList } = useResourceByName("reports");
return useList({
...params,
periods: params.periods,
group_by: params.group_by,
});
}