chore: standardize quotes in pnpm-lock.yaml and clean up formatting in various files for improved readability

This commit is contained in:
Julien Froidefond
2025-12-06 12:38:45 +01:00
parent ad8b936c7a
commit a7f3433f5f
11 changed files with 4385 additions and 2512 deletions

View File

@@ -154,10 +154,7 @@ export const bankingService = {
if (categoryIds && categoryIds.length > 0) {
if (includeUncategorized) {
categoryFilter.push({
OR: [
{ categoryId: { in: categoryIds } },
{ categoryId: null },
],
OR: [{ categoryId: { in: categoryIds } }, { categoryId: null }],
});
} else {
categoryFilter.push({ categoryId: { in: categoryIds } });
@@ -311,7 +308,9 @@ export const bankingService = {
};
},
async getCategoryStats(): Promise<Record<string, { count: number; total: number }>> {
async getCategoryStats(): Promise<
Record<string, { count: number; total: number }>
> {
// Get stats for all categories in one query using aggregation
// We need to sum absolute values, so we'll do it in two steps
const stats = await prisma.transaction.groupBy({
@@ -325,7 +324,7 @@ export const bankingService = {
});
const statsMap: Record<string, { count: number; total: number }> = {};
// Get uncategorized count
const uncategorizedCount = await prisma.transaction.count({
where: { categoryId: null },
@@ -342,7 +341,7 @@ export const bankingService = {
where: { categoryId: stat.categoryId },
select: { amount: true },
});
const total = categoryTransactions.reduce(
(sum, t) => sum + Math.abs(t.amount),
0,
@@ -380,21 +379,19 @@ export const bankingService = {
countMap.set(tc.accountId, tc._count.id);
});
return accounts.map(
(a): Account & { transactionCount: number } => ({
id: a.id,
name: a.name,
bankId: a.bankId,
accountNumber: a.accountNumber,
type: a.type as Account["type"],
folderId: a.folderId,
balance: a.balance,
initialBalance: a.initialBalance,
currency: a.currency,
lastImport: a.lastImport,
externalUrl: a.externalUrl,
transactionCount: countMap.get(a.id) || 0,
}),
);
return accounts.map((a): Account & { transactionCount: number } => ({
id: a.id,
name: a.name,
bankId: a.bankId,
accountNumber: a.accountNumber,
type: a.type as Account["type"],
folderId: a.folderId,
balance: a.balance,
initialBalance: a.initialBalance,
currency: a.currency,
lastImport: a.lastImport,
externalUrl: a.externalUrl,
transactionCount: countMap.get(a.id) || 0,
}));
},
};