diff --git a/package.json b/package.json index 88a61ab..f779e83 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,6 @@ "astro": "astro", "test": "vitest run", "test:watch": "vitest", - "test": "vitest run", - "test:watch": "vitest", "test:coverage": "vitest run --coverage", "format": "biome format --write .", "lint": "biome lint .", diff --git a/src/types.ts b/src/types.ts index 316a234..389d744 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,5 @@ +import type { Decimal } from '@prisma/client/runtime/library'; + export interface Account { id: string; bankName: string; @@ -6,7 +8,7 @@ export interface Account { type?: string; // CHECKING, SAVINGS, etc. status?: string; // ACTIVE, CLOSED currency?: string; // Default: USD - balance: number; // Current balance + balance: number | Decimal; // Current balance - can be Prisma Decimal or number notes?: string; // Optional notes createdAt?: Date; updatedAt?: Date; @@ -17,7 +19,7 @@ export interface Transaction { accountId: string; date: string | Date; // ISO date string or Date object description: string; - amount: number; + amount: number | Decimal; // Amount - can be Prisma Decimal or number category?: string; // Optional category status?: string; // PENDING, CLEARED type?: string; // DEPOSIT, WITHDRAWAL, TRANSFER @@ -26,3 +28,29 @@ export interface Transaction { createdAt?: Date; updatedAt?: Date; } + +// Type definitions for Transaction status and type enums to match db.service.ts +export enum TransactionStatus { + PENDING = 'PENDING', + CLEARED = 'CLEARED', +} + +export enum TransactionType { + DEPOSIT = 'DEPOSIT', + WITHDRAWAL = 'WITHDRAWAL', + TRANSFER = 'TRANSFER', + UNSPECIFIED = 'UNSPECIFIED', +} + +export enum AccountType { + CHECKING = 'CHECKING', + SAVINGS = 'SAVINGS', + CREDIT_CARD = 'CREDIT_CARD', + INVESTMENT = 'INVESTMENT', + OTHER = 'OTHER', +} + +export enum AccountStatus { + ACTIVE = 'ACTIVE', + CLOSED = 'CLOSED', +} diff --git a/vitest.config.ts b/vitest.config.ts index 0f6bb1d..b06009e 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -11,7 +11,6 @@ export default defineConfig({ passWithNoTests: true, teardownTimeout: 5000, // Testing environment setup - environment: 'jsdom', setupFiles: ['./src/test/setup.ts'], // Ensure we're using the right environment environment: 'node',