mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 22:50:12 -08:00
transitioned from astro to react
This commit is contained in:
56
server/types.ts
Normal file
56
server/types.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import type { Decimal } from '@prisma/client/runtime/library';
|
||||
|
||||
export interface Account {
|
||||
id: string;
|
||||
bankName: string;
|
||||
accountNumber: string; // Last 6 digits
|
||||
name: string; // Friendly name
|
||||
type?: string; // CHECKING, SAVINGS, etc.
|
||||
status?: string; // ACTIVE, CLOSED
|
||||
currency?: string; // Default: USD
|
||||
balance: number | Decimal; // Current balance - can be Prisma Decimal or number
|
||||
notes?: string | null; // Optional notes - accepts null for Prisma compatibility
|
||||
createdAt?: Date;
|
||||
updatedAt?: Date;
|
||||
}
|
||||
|
||||
export interface Transaction {
|
||||
id: string;
|
||||
accountId: string;
|
||||
date: string | Date; // ISO date string or Date object
|
||||
description: string;
|
||||
amount: number | Decimal; // Amount - can be Prisma Decimal or number
|
||||
category?: string | null; // Optional category - accepts null for Prisma compatibility
|
||||
status?: string; // PENDING, CLEARED
|
||||
type?: string; // DEPOSIT, WITHDRAWAL, TRANSFER
|
||||
notes?: string | null; // Optional notes - accepts null for Prisma compatibility
|
||||
tags?: string | null; // Optional comma-separated tags - accepts null for Prisma compatibility
|
||||
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',
|
||||
}
|
||||
Reference in New Issue
Block a user