Enforce positive=CREDIT for all BANK account uploads
Instead of relying on per-profile invertAmountSign settings, the upload route now overrides invertAmountSign: true for any BANK account using Strategy A. This ensures positive CSV amounts always map to CREDIT (deposits) regardless of which bank or whether profile was auto-detected. Credit card logic is unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,12 @@ export async function POST(req: Request) {
|
||||
config = result.data
|
||||
}
|
||||
|
||||
// For all BANK accounts using a single amount column, positive = deposit (CREDIT),
|
||||
// negative = withdrawal (DEBIT). Override whatever the profile or manual mapping says.
|
||||
if (account.type === 'BANK' && config.strategy === 'A') {
|
||||
config = { ...config, invertAmountSign: true }
|
||||
}
|
||||
|
||||
const normalized = normalizeRows(allRows, accountId, config)
|
||||
|
||||
// Apply transfer rules first, then budget rules (transfer takes priority)
|
||||
|
||||
@@ -53,7 +53,7 @@ export const bankProfiles: BankProfile[] = [
|
||||
descriptionColumn: 'Description',
|
||||
amountColumn: 'Amount',
|
||||
invertAmountSign: true, // negative = DEBIT (withdrawal), positive = CREDIT (deposit)
|
||||
detectColumns: ['Date', 'Description', 'Amount'],
|
||||
detectColumns: ['Date', 'Description', 'Amount', 'Split', 'Tags'],
|
||||
},
|
||||
{
|
||||
id: 'fidelity',
|
||||
|
||||
Reference in New Issue
Block a user