mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 22:50:12 -08:00
Update types.ts to support Prisma database integration
- Add support for Prisma Decimal type in numeric fields - Update interfaces to handle both number and Decimal types - Add proper handling for null values in optional fields - Define explicit enum types for transaction and account statuses - Ensure type compatibility between TypeScript interfaces and Prisma models - Improve type safety throughout database interactions
This commit is contained in:
@@ -9,7 +9,7 @@ export interface Account {
|
|||||||
status?: string; // ACTIVE, CLOSED
|
status?: string; // ACTIVE, CLOSED
|
||||||
currency?: string; // Default: USD
|
currency?: string; // Default: USD
|
||||||
balance: number | Decimal; // Current balance - can be Prisma Decimal or number
|
balance: number | Decimal; // Current balance - can be Prisma Decimal or number
|
||||||
notes?: string; // Optional notes
|
notes?: string | null; // Optional notes - accepts null for Prisma compatibility
|
||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
}
|
}
|
||||||
@@ -20,11 +20,11 @@ export interface Transaction {
|
|||||||
date: string | Date; // ISO date string or Date object
|
date: string | Date; // ISO date string or Date object
|
||||||
description: string;
|
description: string;
|
||||||
amount: number | Decimal; // Amount - can be Prisma Decimal or number
|
amount: number | Decimal; // Amount - can be Prisma Decimal or number
|
||||||
category?: string; // Optional category
|
category?: string | null; // Optional category - accepts null for Prisma compatibility
|
||||||
status?: string; // PENDING, CLEARED
|
status?: string; // PENDING, CLEARED
|
||||||
type?: string; // DEPOSIT, WITHDRAWAL, TRANSFER
|
type?: string; // DEPOSIT, WITHDRAWAL, TRANSFER
|
||||||
notes?: string; // Optional notes
|
notes?: string | null; // Optional notes - accepts null for Prisma compatibility
|
||||||
tags?: string; // Optional comma-separated tags
|
tags?: string | null; // Optional comma-separated tags - accepts null for Prisma compatibility
|
||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user