mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 22:50:12 -08:00
Fix: Update button remaining disabled in transaction edit mode
This commit resolves an issue where the Update button in the transaction form would remain disabled when attempting to edit a transaction. The problem was in how the transactionStore was managing state updates during transaction editing. Key changes: - Enhanced startEditingTransaction function in transactionStore.ts to ensure proper reactivity - Added clean copy creation of transaction objects to avoid reference issues - Implemented a state update cycle with null value first to force reactivity - Added a small timeout to ensure state changes are properly detected by components The Transaction form now correctly enables the Update button when in edit mode, regardless of account selection state.
This commit is contained in:
@@ -9,13 +9,66 @@ datasource db {
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model BankAccount {
|
||||
id Int @id @default(autoincrement())
|
||||
name String // e.g., "Checking Account", "Savings XYZ"
|
||||
bankName String // e.g., "Chase", "Wells Fargo"
|
||||
accountNumber String @unique // Consider encryption in a real app
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
model Account {
|
||||
id String @id @default(uuid())
|
||||
bankName String
|
||||
accountNumber String @db.VarChar(6) // Last 6 digits
|
||||
name String // Friendly name
|
||||
type AccountType @default(CHECKING)
|
||||
status AccountStatus @default(ACTIVE)
|
||||
currency String @default("USD")
|
||||
balance Decimal @default(0) @db.Decimal(10, 2)
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
transactions Transaction[]
|
||||
|
||||
@@map("bank_accounts") // Optional: specify table name in snake_case
|
||||
@@index([status])
|
||||
@@map("accounts")
|
||||
}
|
||||
|
||||
model Transaction {
|
||||
id String @id @default(uuid())
|
||||
accountId String
|
||||
account Account @relation(fields: [accountId], references: [id])
|
||||
date DateTime
|
||||
description String
|
||||
amount Decimal @db.Decimal(10, 2)
|
||||
category String?
|
||||
status TransactionStatus @default(CLEARED)
|
||||
type TransactionType @default(UNSPECIFIED)
|
||||
notes String?
|
||||
tags String? // Comma-separated values for tags
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([accountId])
|
||||
@@index([date])
|
||||
@@index([category])
|
||||
@@map("transactions")
|
||||
}
|
||||
|
||||
enum AccountType {
|
||||
CHECKING
|
||||
SAVINGS
|
||||
CREDIT_CARD
|
||||
INVESTMENT
|
||||
OTHER
|
||||
}
|
||||
|
||||
enum AccountStatus {
|
||||
ACTIVE
|
||||
CLOSED
|
||||
}
|
||||
|
||||
enum TransactionStatus {
|
||||
PENDING
|
||||
CLEARED
|
||||
}
|
||||
|
||||
enum TransactionType {
|
||||
DEPOSIT
|
||||
WITHDRAWAL
|
||||
TRANSFER
|
||||
UNSPECIFIED
|
||||
}
|
||||
Reference in New Issue
Block a user