feat: import transactions from a CSV bank statement

Fourth of the four ideas picked from the Maybe/Sure feature audit, and the
last one queued up. A 3-step wizard (account -> column mapping -> preview)
at /transactions/import, parsed entirely client-side (new lib/csv.ts —
delimiter auto-detect, 5 date formats, thousands/decimal-separator-aware
amounts) and submitted through a new all-or-nothing POST /transactions/bulk
endpoint, mirroring backup restore's validate-everything-before-touching-
anything approach.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ZProger
2026-08-25 02:44:30 +03:00
parent 94782ee073
commit 19f5cfa429
11 changed files with 706 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
bulkCreateTransactions,
createTransaction,
deleteTransaction,
fetchTransactions,
@@ -56,6 +57,14 @@ export function useUpdateTransaction() {
});
}
export function useBulkCreateTransactions() {
const invalidate = useInvalidateAfterTransactionChange();
return useMutation({
mutationFn: (items: TransactionInput[]) => bulkCreateTransactions(items),
onSuccess: invalidate,
});
}
export function useDeleteTransaction() {
const invalidate = useInvalidateAfterTransactionChange();
return useMutation({