CC account value consistency
This commit is contained in:
@@ -74,7 +74,13 @@ export async function POST(req: Request) {
|
||||
config = result.data
|
||||
}
|
||||
|
||||
const normalized = normalizeRows(allRows, accountId, config)
|
||||
const rawNormalized = normalizeRows(allRows, accountId, config)
|
||||
|
||||
// Credit card CSVs have inverted sign semantics: CREDIT = charge, DEBIT = refund.
|
||||
// Flip types so the rest of the app can treat DEBIT = spending universally.
|
||||
const normalized = account.type === 'CREDIT_CARD'
|
||||
? rawNormalized.map((r) => ({ ...r, type: r.type === 'CREDIT' ? 'DEBIT' as const : 'CREDIT' as const }))
|
||||
: rawNormalized
|
||||
|
||||
// Apply budget auto-assign rules (first match wins)
|
||||
const budgetRules = await prisma.budgetRule.findMany({
|
||||
|
||||
Reference in New Issue
Block a user