🐛 Do not upload transactions that are not booked
All checks were successful
Deploy application / deploy (push) Successful in 8s

This commit is contained in:
2025-02-16 18:22:10 +01:00
parent a0cefcdfa1
commit 080b65854d
2 changed files with 23 additions and 17 deletions

View File

@ -1,10 +1,10 @@
import type { UUID } from "node:crypto"
import dayjs from "dayjs"
import { ACTUAL_ACCOUNT_IDS, BANK_ACCOUNT_IDS } from "@/config.ts"
import logger from "@common/logger.ts"
import { toISODateString } from "@common/date.ts"
import type { SB1Transaction } from "@sb1/types.ts"
import dayjs from "dayjs"
import type { ActualTransaction } from "@common/types.ts"
import type { SB1Transaction } from "@sb1/types.ts"
import type { UUID } from "node:crypto"
export function bankTransactionIntoActualTransaction(
transaction: SB1Transaction,
@ -18,7 +18,6 @@ export function bankTransactionIntoActualTransaction(
amount: Math.floor(transaction.amount * 100),
date: toISODateString(dayjs(transaction.date)),
payee_name: transaction.cleanedDescription,
// TODO if not cleared or nonUniqueId is 0, rerun later
cleared: isCleared(transaction),
}
}
@ -38,9 +37,7 @@ function getActualAccountId(transcation: SB1Transaction): UUID {
return ACTUAL_ACCOUNT_IDS[i] as UUID
}
}
const error = new Error(
throw new Error(
"Failed to find ActualAccountId, length of BANK_ACCOUNT_IDS and ACTUAL_ACCOUNT_IDS must match",
)
logger.error(error)
throw error
}