Add effective_date field to transactions and update related logic #102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces the concept of an "effective date" for transactions, which is used to determine the actual date a transaction should be considered effective, falling back to the creation date if not specified. This change impacts multiple files across the codebase, including models, database interactions, and tests.
Key changes include:
Model Updates:
EffectiveDate
field toRecordTransaction
andTransaction
structs inapi/model/transaction.go
andmodel/transaction.go
respectively. [1] [2]ToTransaction
method inapi/model/model.go
to include theEffectiveDate
field.GetEffectiveDate
method inmodel/transaction.go
to return the effective date or fall back to the creation date if not set.Database Changes:
database/balance.go
to useeffective_date
if available, otherwise fall back tocreated_at
. [1] [2] [3]RecordTransaction
method indatabase/transaction.go
to includeeffective_date
in the insert statement.Migration Script:
sql/1741007609.sql
to add theeffective_date
column to thetransactions
table.Test Updates:
database/transactions_test.go
andtransaction_test.go
to account for the neweffective_date
field. [1] [2] [3] [4] [5] [6]