Skip to content

Add effective_date field to transactions and update related logic #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2025

Conversation

jerry-enebeli
Copy link
Collaborator

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:

  • Added EffectiveDate field to RecordTransaction and Transaction structs in api/model/transaction.go and model/transaction.go respectively. [1] [2]
  • Updated ToTransaction method in api/model/model.go to include the EffectiveDate field.
  • Introduced GetEffectiveDate method in model/transaction.go to return the effective date or fall back to the creation date if not set.

Database Changes:

  • Modified SQL queries in database/balance.go to use effective_date if available, otherwise fall back to created_at. [1] [2] [3]
  • Updated RecordTransaction method in database/transaction.go to include effective_date in the insert statement.

Migration Script:

  • Added a new migration script sql/1741007609.sql to add the effective_date column to the transactions table.

Test Updates:

  • Updated test cases in database/transactions_test.go and transaction_test.go to account for the new effective_date field. [1] [2] [3] [4] [5] [6]

@jerry-enebeli jerry-enebeli merged commit 96e51d8 into main Mar 3, 2025
7 checks passed
@jerry-enebeli jerry-enebeli deleted the back-dated-transactions branch March 13, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant