refactor: standardize quotation marks across all files and improve code consistency

This commit is contained in:
Julien Froidefond
2025-11-27 11:40:30 +01:00
parent cc1e8c20a6
commit b2efade4d5
107 changed files with 9471 additions and 5952 deletions

View File

@@ -1,5 +1,11 @@
import { prisma } from "@/lib/prisma"
import type { BankingData, Account, Transaction, Folder, Category } from "@/lib/types"
import { prisma } from "@/lib/prisma";
import type {
BankingData,
Account,
Transaction,
Folder,
Category,
} from "@/lib/types";
export const bankingService = {
async getAllData(): Promise<BankingData> {
@@ -17,50 +23,57 @@ export const bankingService = {
}),
prisma.folder.findMany(),
prisma.category.findMany(),
])
]);
// Transform Prisma models to match our types
return {
accounts: accounts.map((a): Account => ({
id: a.id,
name: a.name,
bankId: a.bankId,
accountNumber: a.accountNumber,
type: a.type as Account["type"],
folderId: a.folderId,
balance: a.balance,
currency: a.currency,
lastImport: a.lastImport,
})),
transactions: transactions.map((t): Transaction => ({
id: t.id,
accountId: t.accountId,
date: t.date,
amount: t.amount,
description: t.description,
type: t.type as Transaction["type"],
categoryId: t.categoryId,
isReconciled: t.isReconciled,
fitId: t.fitId,
memo: t.memo ?? undefined,
checkNum: t.checkNum ?? undefined,
})),
folders: folders.map((f): Folder => ({
id: f.id,
name: f.name,
parentId: f.parentId,
color: f.color,
icon: f.icon,
})),
categories: categories.map((c): Category => ({
id: c.id,
name: c.name,
color: c.color,
icon: c.icon,
keywords: JSON.parse(c.keywords) as string[],
parentId: c.parentId,
})),
}
accounts: accounts.map(
(a): Account => ({
id: a.id,
name: a.name,
bankId: a.bankId,
accountNumber: a.accountNumber,
type: a.type as Account["type"],
folderId: a.folderId,
balance: a.balance,
currency: a.currency,
lastImport: a.lastImport,
}),
),
transactions: transactions.map(
(t): Transaction => ({
id: t.id,
accountId: t.accountId,
date: t.date,
amount: t.amount,
description: t.description,
type: t.type as Transaction["type"],
categoryId: t.categoryId,
isReconciled: t.isReconciled,
fitId: t.fitId,
memo: t.memo ?? undefined,
checkNum: t.checkNum ?? undefined,
}),
),
folders: folders.map(
(f): Folder => ({
id: f.id,
name: f.name,
parentId: f.parentId,
color: f.color,
icon: f.icon,
}),
),
categories: categories.map(
(c): Category => ({
id: c.id,
name: c.name,
color: c.color,
icon: c.icon,
keywords: JSON.parse(c.keywords) as string[],
parentId: c.parentId,
}),
),
};
},
}
};