ci: use local prisma client

This commit is contained in:
Vasily Zubarev
2025-05-03 10:23:13 +02:00
parent 9e6b2f89bf
commit 26991a1520
47 changed files with 66 additions and 60 deletions

View File

@@ -1,14 +1,17 @@
import { Transaction } from "@prisma/client"
import { Transaction } from "@/prisma/client"
export function calcTotalPerCurrency(transactions: Transaction[]): Record<string, number> {
return transactions.reduce((acc, transaction) => {
if (transaction.convertedCurrencyCode) {
acc[transaction.convertedCurrencyCode.toUpperCase()] =
(acc[transaction.convertedCurrencyCode.toUpperCase()] || 0) + (transaction.convertedTotal || 0)
} else if (transaction.currencyCode) {
acc[transaction.currencyCode.toUpperCase()] =
(acc[transaction.currencyCode.toUpperCase()] || 0) + (transaction.total || 0)
}
return acc
}, {} as Record<string, number>)
return transactions.reduce(
(acc, transaction) => {
if (transaction.convertedCurrencyCode) {
acc[transaction.convertedCurrencyCode.toUpperCase()] =
(acc[transaction.convertedCurrencyCode.toUpperCase()] || 0) + (transaction.convertedTotal || 0)
} else if (transaction.currencyCode) {
acc[transaction.currencyCode.toUpperCase()] =
(acc[transaction.currencyCode.toUpperCase()] || 0) + (transaction.total || 0)
}
return acc
},
{} as Record<string, number>
)
}