mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 21:52:40 +00:00
feat(frontend): adapt to composite key transaction structure
- Update Transaction interface to include stable transaction_id field - Modify TransactionsList to use stable transaction_id for React keys - Update API models to handle new transactionId field from database - Fix API routes to properly map transaction_id in responses - Update test mocks to include transactionId field - Ensure backward compatibility with internal_transaction_id This adapts the frontend to work with the new composite primary key (accountId, transactionId) structure that prevents duplicate transactions.
This commit is contained in:
@@ -267,10 +267,7 @@ export default function TransactionsList() {
|
||||
|
||||
return (
|
||||
<div
|
||||
key={
|
||||
transaction.internal_transaction_id ||
|
||||
`${transaction.account_id}-${transaction.transaction_date}-${transaction.transaction_value}`
|
||||
}
|
||||
key={`${transaction.account_id}-${transaction.transaction_id}`}
|
||||
className="p-6 hover:bg-gray-50 transition-colors"
|
||||
>
|
||||
<div className="flex items-start justify-between">
|
||||
@@ -365,7 +362,7 @@ export default function TransactionsList() {
|
||||
isOpen={showRawModal}
|
||||
onClose={handleCloseModal}
|
||||
rawTransaction={selectedTransaction?.raw_transaction}
|
||||
transactionId={selectedTransaction?.internal_transaction_id || "unknown"}
|
||||
transactionId={selectedTransaction?.transaction_id || "unknown"}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -56,7 +56,8 @@ export interface RawTransactionData {
|
||||
}
|
||||
|
||||
export interface Transaction {
|
||||
internal_transaction_id: string | null;
|
||||
transaction_id: string; // NEW: stable bank-provided transaction ID
|
||||
internal_transaction_id: string | null; // OLD: unstable GoCardless ID
|
||||
account_id: string;
|
||||
transaction_value: number;
|
||||
transaction_currency: string;
|
||||
|
||||
Reference in New Issue
Block a user