Files
finance-app/src/app/api/merchants/route.ts
T
siddharthd 278e57354c feat(insights): analytics drill-down, fee tracking, and category improvements
- Monthly spend chart with category breakdown drill-down
- Merchant frequency and spend analytics with per-merchant history
- Subscription detection and recurring charge tracking
- Fee and interest analytics endpoint
- Expanded category list with formatCategory display helper
2026-03-14 20:06:24 +11:00

17 lines
560 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { getMerchantSuggestions, getBankNames } from "@/lib/queries";
export async function GET(req: NextRequest) {
const search = req.nextUrl.searchParams.get("search");
const type = req.nextUrl.searchParams.get("type");
if (type === "banks") {
const banks = await getBankNames();
return NextResponse.json(banks);
}
if (!search) return NextResponse.json([]);
const merchants = await getMerchantSuggestions(search);
return NextResponse.json(merchants.map((m) => m.merchant));
}