diff --git a/src/app/(app)/budgets/page.tsx b/src/app/(app)/budgets/page.tsx index 2de49f5..6c0ecc5 100644 --- a/src/app/(app)/budgets/page.tsx +++ b/src/app/(app)/budgets/page.tsx @@ -31,7 +31,10 @@ export default async function BudgetsPage({ searchParams }: { searchParams: Sear JOIN "Account" a ON t."accountId" = a.id WHERE a."userId" = ${userId} AND t."budgetId" IS NOT NULL - AND t.type = 'DEBIT' + AND ( + (a.type = 'CREDIT_CARD' AND t.type = 'CREDIT') + OR (a.type != 'CREDIT_CARD' AND t.type = 'DEBIT') + ) AND t.date >= ${start} AND t.date <= ${end} GROUP BY t."budgetId" diff --git a/src/app/(app)/dashboard/page.tsx b/src/app/(app)/dashboard/page.tsx index 3c92947..7b00f0d 100644 --- a/src/app/(app)/dashboard/page.tsx +++ b/src/app/(app)/dashboard/page.tsx @@ -46,7 +46,10 @@ export default async function DashboardPage({ searchParams }: { searchParams: Se JOIN "Account" a ON t."accountId" = a.id WHERE a."userId" = ${userId} AND t."budgetId" IS NOT NULL - AND t.type = 'DEBIT' + AND ( + (a.type = 'CREDIT_CARD' AND t.type = 'CREDIT') + OR (a.type != 'CREDIT_CARD' AND t.type = 'DEBIT') + ) AND t.date >= ${start} AND t.date <= ${end} GROUP BY t."budgetId"