feat(finance): Phase 5 — Rules Engine

Add rules engine with CRUD API, condition/action evaluation, and apply-all endpoint.
UI: rule builder form with field/operator/value conditions, tag multi-select, apply button with result stats.
This commit is contained in:
2026-03-08 16:56:13 +11:00
parent 93450f7caa
commit 31cffbe1bb
9 changed files with 653 additions and 8 deletions
+6 -2
View File
@@ -1,16 +1,20 @@
import { NextRequest, NextResponse } from "next/server";
import { getCurrentUser } from "@/lib/auth";
import { getTransactions } from "@/lib/queries";
export async function GET(req: NextRequest) {
const sp = req.nextUrl.searchParams;
const user = await getCurrentUser(req);
if (!user) return NextResponse.json({ error: "Unauthorized" }, { status: 403 });
const result = await getTransactions({
const sp = req.nextUrl.searchParams;
const result = await getTransactions(user.id, {
from: sp.get("from") || undefined,
to: sp.get("to") || undefined,
category: sp.get("category") || undefined,
bank_name: sp.get("bank_name") || undefined,
search: sp.get("search") || undefined,
statement_id: sp.get("statement_id") || undefined,
tag_id: sp.get("tag_id") || undefined,
sort_by: sp.get("sort_by") || undefined,
sort_dir: sp.get("sort_dir") || undefined,
limit: sp.get("limit") ? Number(sp.get("limit")) : undefined,