🐛 Do not upload transactions that are not booked
All checks were successful
Deploy application / deploy (push) Successful in 8s
All checks were successful
Deploy application / deploy (push) Successful in 8s
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user