1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Account::Entry Delegated Type (namespace updates part 7) (#923)

* Initial entryable models

* Update transfer and tests

* Update transaction controllers and tests

* Update sync process to use new entries model

* Get dashboard working again

* Update transfers, imports, and accounts to use Account::Entry

* Update system tests

* Consolidate transaction management into entries controller

* Add permitted partial key helper

* Move account transactions list to entries controller

* Delegate transaction entries search

* Move transfer relation to entry

* Update bulk transaction management flows to use entries

* Remove test code

* Test fix attempt

* Update demo data script

* Consolidate remaining transaction partials to entries

* Consolidate valuations controller to entries controller

* Lint fix

* Remove unused files, additional cleanup

* Add back valuation creation

* Make migrations fully reversible

* Stale routes cleanup

* Migrations reversible fix

* Move types to entryable concern

* Fix search when no entries found

* Remove more unused code
This commit is contained in:
Zach Gollwitzer 2024-07-01 10:49:43 -04:00 committed by GitHub
parent 320954282a
commit c3314e62d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
105 changed files with 2150 additions and 1576 deletions

323
test/fixtures/account/entries.yml vendored Normal file
View file

@ -0,0 +1,323 @@
# Checking account transactions
checking_one:
name: Starbucks
date: <%= 5.days.ago.to_date %>
amount: 10
account: checking
currency: USD
entryable_type: Account::Transaction
entryable: checking_one
checking_two:
name: Chipotle
date: <%= 12.days.ago.to_date %>
amount: 30
account: checking
currency: USD
entryable_type: Account::Transaction
entryable: checking_two
checking_three:
name: Amazon
date: <%= 15.days.ago.to_date %>
amount: 20
account: checking
currency: USD
entryable_type: Account::Transaction
entryable: checking_three
checking_four:
name: Paycheck
date: <%= 22.days.ago.to_date %>
amount: -1075
account: checking
currency: USD
entryable_type: Account::Transaction
entryable: checking_four
checking_five:
name: Netflix
date: <%= 29.days.ago.to_date %>
amount: 15
account: checking
currency: USD
entryable_type: Account::Transaction
entryable: checking_five
checking_six_payment:
name: Payment to Credit Card
date: <%= 29.days.ago.to_date %>
amount: 100
account: checking
currency: USD
entryable_type: Account::Transaction
entryable: checking_six_payment
marked_as_transfer: true
transfer: credit_card_payment
checking_seven_transfer:
name: Transfer to Savings
date: <%= 30.days.ago.to_date %>
amount: 250
account: checking
currency: USD
marked_as_transfer: true
transfer: savings_transfer
entryable_type: Account::Transaction
entryable: checking_seven_transfer
checking_eight_external_payment:
name: Transfer TO external CC account (owned by user but not known to app)
date: <%= 30.days.ago.to_date %>
amount: 800
account: checking
currency: USD
marked_as_transfer: true
entryable_type: Account::Transaction
entryable: checking_eight_external_payment
checking_nine_external_transfer:
name: Transfer FROM external investing account (owned by user but not known to app)
date: <%= 31.days.ago.to_date %>
amount: -200
account: checking
currency: USD
marked_as_transfer: true
entryable_type: Account::Transaction
entryable: checking_nine_external_transfer
savings_one:
name: Interest Received
date: <%= 5.days.ago.to_date %>
amount: -200
account: savings
currency: USD
entryable_type: Account::Transaction
entryable: savings_one
savings_two:
name: Check Deposit
date: <%= 12.days.ago.to_date %>
amount: -50
account: savings
currency: USD
entryable_type: Account::Transaction
entryable: savings_two
savings_three:
name: Withdrawal
date: <%= 18.days.ago.to_date %>
amount: 2000
account: savings
currency: USD
entryable_type: Account::Transaction
entryable: savings_three
savings_four:
name: Check Deposit
date: <%= 29.days.ago.to_date %>
amount: -500
account: savings
currency: USD
entryable_type: Account::Transaction
entryable: savings_four
savings_five_transfer:
name: Received Transfer from Checking Account
date: <%= 31.days.ago.to_date %>
amount: -250
account: savings
currency: USD
marked_as_transfer: true
transfer: savings_transfer
entryable_type: Account::Transaction
entryable: savings_five_transfer
credit_card_one:
name: Starbucks
date: <%= 5.days.ago.to_date %>
amount: 10
account: credit_card
currency: USD
entryable_type: Account::Transaction
entryable: credit_card_one
credit_card_two:
name: Chipotle
date: <%= 12.days.ago.to_date %>
amount: 30
account: credit_card
currency: USD
entryable_type: Account::Transaction
entryable: credit_card_two
credit_card_three:
name: Amazon
date: <%= 15.days.ago.to_date %>
amount: 20
account: credit_card
currency: USD
entryable_type: Account::Transaction
entryable: credit_card_three
credit_card_four_payment:
name: Received CC Payment from Checking Account
date: <%= 31.days.ago.to_date %>
amount: -100
account: credit_card
currency: USD
marked_as_transfer: true
transfer: credit_card_payment
entryable_type: Account::Transaction
entryable: credit_card_four_payment
eur_checking_one:
name: Check
date: <%= 9.days.ago.to_date %>
amount: -50
currency: EUR
account: eur_checking
entryable_type: Account::Transaction
entryable: eur_checking_one
eur_checking_two:
name: Shopping trip
date: <%= 19.days.ago.to_date %>
amount: 100
currency: EUR
account: eur_checking
entryable_type: Account::Transaction
entryable: eur_checking_two
eur_checking_three:
name: Check
date: <%= 31.days.ago.to_date %>
amount: -200
currency: EUR
account: eur_checking
entryable_type: Account::Transaction
entryable: eur_checking_three
multi_currency_one:
name: Outflow 1
date: <%= 4.days.ago.to_date %>
amount: 800
currency: EUR
account: multi_currency
entryable_type: Account::Transaction
entryable: multi_currency_one
multi_currency_two:
name: Inflow 1
date: <%= 9.days.ago.to_date %>
amount: -50
currency: USD
account: multi_currency
entryable_type: Account::Transaction
entryable: multi_currency_two
multi_currency_three:
name: Outflow 2
date: <%= 19.days.ago.to_date %>
amount: 110.85
currency: EUR
account: multi_currency
entryable_type: Account::Transaction
entryable: multi_currency_three
multi_currency_four:
name: Inflow 2
date: <%= 29.days.ago.to_date %>
amount: -200
currency: USD
account: multi_currency
entryable_type: Account::Transaction
entryable: multi_currency_four
collectable_one_valuation:
amount: 550
date: <%= 4.days.ago.to_date %>
account: collectable
currency: USD
entryable_type: Account::Valuation
entryable: collectable_one
collectable_two_valuation:
amount: 700
date: <%= 12.days.ago.to_date %>
account: collectable
currency: USD
entryable_type: Account::Valuation
entryable: collectable_two
collectable_three_valuation:
amount: 400
date: <%= 31.days.ago.to_date %>
account: collectable
currency: USD
entryable_type: Account::Valuation
entryable: collectable_three
iou_one_valuation:
amount: 200
date: <%= 31.days.ago.to_date %>
account: iou
currency: USD
entryable_type: Account::Valuation
entryable: iou_one
multi_currency_one_valuation:
amount: 10200
date: <%= 31.days.ago.to_date %>
account: multi_currency
currency: USD
entryable_type: Account::Valuation
entryable: multi_currency_one
savings_one_valuation:
amount: 19500
date: <%= 12.days.ago.to_date %>
account: savings
currency: USD
entryable_type: Account::Valuation
entryable: savings_one
savings_two_valuation:
amount: 21000
date: <%= 25.days.ago.to_date %>
account: savings
currency: USD
entryable_type: Account::Valuation
entryable: savings_two
brokerage_one_valuation:
amount: 10000
date: <%= 31.days.ago.to_date %>
account: brokerage
currency: USD
entryable_type: Account::Valuation
entryable: brokerage_one
mortgage_loan_one_valuation:
amount: 500000
date: <%= 31.days.ago.to_date %>
account: mortgage_loan
currency: USD
entryable_type: Account::Valuation
entryable: mortgage_loan_one
house_one_valuation:
amount: 550000
date: <%= 31.days.ago.to_date %>
account: house
currency: USD
entryable_type: Account::Valuation
entryable: house_one
car_one_valuation:
amount: 18000
date: <%= 31.days.ago.to_date %>
account: car
currency: USD
entryable_type: Account::Valuation
entryable: car_one

View file

@ -1,200 +1,60 @@
# Checking account transactions
checking_one:
name: Starbucks
date: <%= 5.days.ago.to_date %>
amount: 10
account: checking
category: food_and_drink
currency: USD
checking_two:
name: Chipotle
date: <%= 12.days.ago.to_date %>
amount: 30
account: checking
category: food_and_drink
currency: USD
checking_three:
name: Amazon
date: <%= 15.days.ago.to_date %>
amount: 20
account: checking
currency: USD
merchant: amazon
checking_four:
name: Paycheck
date: <%= 22.days.ago.to_date %>
amount: -1075
account: checking
category: income
currency: USD
checking_five:
name: Netflix
date: <%= 29.days.ago.to_date %>
amount: 15
account: checking
currency: USD
merchant: netflix
checking_six_payment:
name: Payment to Credit Card
date: <%= 29.days.ago.to_date %>
amount: 100
account: checking
currency: USD
marked_as_transfer: true
transfer: credit_card_payment
checking_six_payment: { }
checking_seven_transfer:
name: Transfer to Savings
date: <%= 30.days.ago.to_date %>
amount: 250
account: checking
currency: USD
marked_as_transfer: true
transfer: savings_transfer
checking_seven_transfer: { }
checking_eight_external_payment:
name: Transfer TO external CC account (owned by user but not known to app)
date: <%= 30.days.ago.to_date %>
amount: 800
account: checking
currency: USD
marked_as_transfer: true
checking_eight_external_payment: { }
checking_nine_external_transfer:
name: Transfer FROM external investing account (owned by user but not known to app)
date: <%= 30.days.ago.to_date %>
amount: -200
account: checking
currency: USD
marked_as_transfer: true
checking_nine_external_transfer: { }
# Savings account that has transactions and valuation overrides
savings_one:
name: Interest Received
date: <%= 5.days.ago.to_date %>
amount: -200
account: savings
category: income
currency: USD
savings_two:
name: Check Deposit
date: <%= 12.days.ago.to_date %>
amount: -50
account: savings
category: income
currency: USD
savings_three:
name: Withdrawal
date: <%= 18.days.ago.to_date %>
amount: 2000
account: savings
currency: USD
savings_three: { }
savings_four:
name: Check Deposit
date: <%= 29.days.ago.to_date %>
amount: -500
account: savings
category: income
currency: USD
savings_five_transfer:
name: Received Transfer from Checking Account
date: <%= 30.days.ago.to_date %>
amount: -250
account: savings
currency: USD
marked_as_transfer: true
transfer: savings_transfer
savings_five_transfer: { }
# Credit card account transactions
credit_card_one:
name: Starbucks
date: <%= 5.days.ago.to_date %>
amount: 10
account: credit_card
category: food_and_drink
currency: USD
credit_card_two:
name: Chipotle
date: <%= 12.days.ago.to_date %>
amount: 30
account: credit_card
category: food_and_drink
currency: USD
credit_card_three:
name: Amazon
date: <%= 15.days.ago.to_date %>
amount: 20
account: credit_card
currency: USD
merchant: amazon
credit_card_four_payment:
name: Received CC Payment from Checking Account
date: <%= 30.days.ago.to_date %>
amount: -100
account: credit_card
currency: USD
marked_as_transfer: true
transfer: credit_card_payment
credit_card_four_payment: { }
# eur_checking transactions
eur_checking_one:
name: Check
date: <%= 9.days.ago.to_date %>
amount: -50
currency: EUR
account: eur_checking
eur_checking_two:
name: Shopping trip
date: <%= 19.days.ago.to_date %>
amount: 100
currency: EUR
account: eur_checking
eur_checking_three:
name: Check
date: <%= 30.days.ago.to_date %>
amount: -200
currency: EUR
account: eur_checking
eur_checking_one: { }
eur_checking_two: { }
eur_checking_three: { }
# multi_currency transactions
multi_currency_one:
name: Outflow 1
date: <%= 4.days.ago.to_date %>
amount: 800
currency: EUR
account: multi_currency
multi_currency_two:
name: Inflow 1
date: <%= 9.days.ago.to_date %>
amount: -50
currency: USD
account: multi_currency
multi_currency_three:
name: Outflow 2
date: <%= 19.days.ago.to_date %>
amount: 110.85
currency: EUR
account: multi_currency
multi_currency_four:
name: Inflow 2
date: <%= 29.days.ago.to_date %>
amount: -200
currency: USD
account: multi_currency
multi_currency_one: { }
multi_currency_two: { }
multi_currency_three: { }
multi_currency_four: { }

View file

@ -1,55 +1,18 @@
# For collectable account that only has valuations (no transactions)
collectable_one:
value: 550
date: <%= 4.days.ago.to_date %>
account: collectable
collectable_one: { }
collectable_two: { }
collectable_three: { }
collectable_two:
value: 700
date: <%= 12.days.ago.to_date %>
account: collectable
iou_one: { }
collectable_three:
value: 400
date: <%= 31.days.ago.to_date %>
account: collectable
multi_currency_one: { }
iou_one:
value: 200
date: <%= 31.days.ago.to_date %>
account: iou
savings_one: { }
savings_two: { }
multi_currency_one:
value: 10200
date: <%= 31.days.ago.to_date %>
account: multi_currency
brokerage_one: { }
savings_one:
value: 19500
date: <%= 12.days.ago.to_date %>
account: savings
mortgage_loan_one: { }
savings_two:
value: 21000
date: <%= 25.days.ago.to_date %>
account: savings
house_one: { }
brokerage_one:
value: 10000
date: <%= 31.days.ago.to_date %>
account: brokerage
mortgage_loan_one:
value: 500000
date: <%= 31.days.ago.to_date %>
account: mortgage_loan
house_one:
value: 550000
date: <%= 31.days.ago.to_date %>
account: house
car_one:
value: 18000
date: <%= 31.days.ago.to_date %>
account: car
car_one: { }