mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-17 04:56:40 +07:00
Initial public release
Aurum — a self-hosted personal finance operating system: cash flow, net worth tracking, budgets, goals, recurring payments, reports, proactive alerts, and a compound-interest returns calculator, all bilingual (RU/EN) and mobile-first. Ships as a three-container Docker Compose stack (Postgres + FastAPI + nginx-served React frontend). See README.md for setup and CONTRIBUTING.md for development.
This commit is contained in:
37
frontend/src/api/transactions.ts
Normal file
37
frontend/src/api/transactions.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { api } from "@/api/client";
|
||||
import type { Transaction, TransactionInput, TransactionPage } from "@/types";
|
||||
|
||||
export type TransactionSort = "date_desc" | "amount_desc" | "amount_asc";
|
||||
|
||||
export interface TransactionFilters {
|
||||
year?: number;
|
||||
month?: number;
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
account_id?: number;
|
||||
category_id?: number;
|
||||
type?: string;
|
||||
sort?: TransactionSort;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}
|
||||
|
||||
export function fetchTransactions(filters: TransactionFilters = {}) {
|
||||
const params = new URLSearchParams();
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null) params.set(key, String(value));
|
||||
});
|
||||
return api.get<TransactionPage>(`/transactions?${params.toString()}`);
|
||||
}
|
||||
|
||||
export function createTransaction(input: TransactionInput) {
|
||||
return api.post<Transaction>("/transactions", input);
|
||||
}
|
||||
|
||||
export function updateTransaction(id: number, input: Partial<TransactionInput>) {
|
||||
return api.patch<Transaction>(`/transactions/${id}`, input);
|
||||
}
|
||||
|
||||
export function deleteTransaction(id: number) {
|
||||
return api.delete<void>(`/transactions/${id}`);
|
||||
}
|
||||
Reference in New Issue
Block a user