refactor: remove category rules and related logic from defaults, types, and services for cleaner codebase
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { prisma } from "@/lib/prisma"
|
||||
import type { BankingData, Account, Transaction, Folder, Category, CategoryRule } from "@/lib/types"
|
||||
import type { BankingData, Account, Transaction, Folder, Category } from "@/lib/types"
|
||||
|
||||
export const bankingService = {
|
||||
async getAllData(): Promise<BankingData> {
|
||||
const [accounts, transactions, folders, categories, categoryRules] = await Promise.all([
|
||||
const [accounts, transactions, folders, categories] = await Promise.all([
|
||||
prisma.account.findMany({
|
||||
include: {
|
||||
folder: true,
|
||||
@@ -17,7 +17,6 @@ export const bankingService = {
|
||||
}),
|
||||
prisma.folder.findMany(),
|
||||
prisma.category.findMany(),
|
||||
prisma.categoryRule.findMany(),
|
||||
])
|
||||
|
||||
// Transform Prisma models to match our types
|
||||
@@ -61,12 +60,6 @@ export const bankingService = {
|
||||
keywords: JSON.parse(c.keywords) as string[],
|
||||
parentId: c.parentId,
|
||||
})),
|
||||
categoryRules: categoryRules.map((r): CategoryRule => ({
|
||||
id: r.id,
|
||||
categoryId: r.categoryId,
|
||||
pattern: r.pattern,
|
||||
isRegex: r.isRegex,
|
||||
})),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user