mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Account:: namespace simplifications and cleanup (#2110)
* Flatten Holding model * Flatten balance model * Entries domain renames * Fix valuations reference * Fix trades stream * Fix brakeman warnings * Fix tests * Replace existing entryable type references in DB
This commit is contained in:
parent
f181ba941f
commit
e657c40d19
172 changed files with 1297 additions and 1258 deletions
|
@ -1,28 +1,5 @@
|
|||
{
|
||||
"ignored_warnings": [
|
||||
{
|
||||
"warning_type": "Mass Assignment",
|
||||
"warning_code": 105,
|
||||
"fingerprint": "5bfdb129316655dc4e02f3a599156660414a6562212a5f61057d376f6888f078",
|
||||
"check_name": "PermitAttributes",
|
||||
"message": "Potentially dangerous key allowed for mass assignment",
|
||||
"file": "app/controllers/concerns/entryable_resource.rb",
|
||||
"line": 124,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/mass_assignment/",
|
||||
"code": "params.require(:account_entry).permit(:account_id, :name, :enriched_name, :date, :amount, :currency, :excluded, :notes, :nature, :entryable_attributes => self.class.permitted_entryable_attributes)",
|
||||
"render_path": null,
|
||||
"location": {
|
||||
"type": "method",
|
||||
"class": "EntryableResource",
|
||||
"method": "entry_params"
|
||||
},
|
||||
"user_input": ":account_id",
|
||||
"confidence": "High",
|
||||
"cwe_id": [
|
||||
915
|
||||
],
|
||||
"note": ""
|
||||
},
|
||||
{
|
||||
"warning_type": "Mass Assignment",
|
||||
"warning_code": 105,
|
||||
|
@ -46,40 +23,6 @@
|
|||
],
|
||||
"note": ""
|
||||
},
|
||||
{
|
||||
"warning_type": "Cross-Site Scripting",
|
||||
"warning_code": 2,
|
||||
"fingerprint": "b1f821a5c03b8aa348fb21b9297081a3bf9e954244290e7e511c67213d35f3dc",
|
||||
"check_name": "CrossSiteScripting",
|
||||
"message": "Unescaped model attribute",
|
||||
"file": "app/views/pages/changelog.html.erb",
|
||||
"line": 18,
|
||||
"link": "https://brakemanscanner.org/docs/warning_types/cross_site_scripting",
|
||||
"code": "Provider::Github.new.fetch_latest_release_notes[:body]",
|
||||
"render_path": [
|
||||
{
|
||||
"type": "controller",
|
||||
"class": "PagesController",
|
||||
"method": "changelog",
|
||||
"line": 15,
|
||||
"file": "app/controllers/pages_controller.rb",
|
||||
"rendered": {
|
||||
"name": "pages/changelog",
|
||||
"file": "app/views/pages/changelog.html.erb"
|
||||
}
|
||||
}
|
||||
],
|
||||
"location": {
|
||||
"type": "template",
|
||||
"template": "pages/changelog"
|
||||
},
|
||||
"user_input": null,
|
||||
"confidence": "High",
|
||||
"cwe_id": [
|
||||
79
|
||||
],
|
||||
"note": ""
|
||||
},
|
||||
{
|
||||
"warning_type": "Dangerous Eval",
|
||||
"warning_code": 13,
|
||||
|
@ -139,5 +82,5 @@
|
|||
"note": ""
|
||||
}
|
||||
],
|
||||
"brakeman_version": "7.0.0"
|
||||
"brakeman_version": "7.0.2"
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ en:
|
|||
activerecord:
|
||||
errors:
|
||||
models:
|
||||
account/entry:
|
||||
entry:
|
||||
attributes:
|
||||
base:
|
||||
invalid_sell_quantity: cannot sell %{sell_qty} shares of %{ticker} because
|
|
@ -1,15 +0,0 @@
|
|||
---
|
||||
en:
|
||||
account:
|
||||
entries:
|
||||
create:
|
||||
success: Entry created
|
||||
destroy:
|
||||
success: Entry deleted
|
||||
empty:
|
||||
description: Try adding an entry, editing filters or refining your search
|
||||
title: No entries found
|
||||
loading:
|
||||
loading: Loading entries...
|
||||
update:
|
||||
success: Entry updated
|
|
@ -1,38 +0,0 @@
|
|||
---
|
||||
en:
|
||||
account:
|
||||
holdings:
|
||||
cash:
|
||||
brokerage_cash: Brokerage cash
|
||||
destroy:
|
||||
success: Holding deleted
|
||||
holding:
|
||||
per_share: per share
|
||||
shares: "%{qty} shares"
|
||||
index:
|
||||
cost: cost
|
||||
holdings: Holdings
|
||||
name: name
|
||||
new_holding: New transaction
|
||||
no_holdings: No holdings to show.
|
||||
return: total return
|
||||
weight: weight
|
||||
missing_price_tooltip:
|
||||
description: This investment has missing values and we could not calculate
|
||||
its returns or value.
|
||||
missing_data: Missing data
|
||||
show:
|
||||
avg_cost_label: Average Cost
|
||||
current_market_price_label: Current Market Price
|
||||
delete: Delete
|
||||
delete_subtitle: This will delete the holding and all your associated trades
|
||||
on this account. This action cannot be undone.
|
||||
delete_title: Delete holding
|
||||
history: History
|
||||
overview: Overview
|
||||
portfolio_weight_label: Portfolio Weight
|
||||
settings: Settings
|
||||
ticker_label: Ticker
|
||||
trade_history_entry: "%{qty} shares of %{security} at %{price}"
|
||||
trend_label: Trend
|
||||
unknown: Unknown
|
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
en:
|
||||
account:
|
||||
trades:
|
||||
form:
|
||||
account: Transfer account (optional)
|
||||
account_prompt: Search account
|
||||
amount: Amount
|
||||
holding: Ticker symbol
|
||||
price: Price per share
|
||||
qty: Quantity
|
||||
submit: Add transaction
|
||||
ticker_placeholder: AAPL
|
||||
type: Type
|
||||
header:
|
||||
buy: Buy
|
||||
current_market_price_label: Current Market Price
|
||||
overview: Overview
|
||||
purchase_price_label: Purchase Price
|
||||
purchase_qty_label: Purchase Quantity
|
||||
sell: Sell
|
||||
symbol_label: Symbol
|
||||
total_return_label: Unrealized gain/loss
|
||||
new:
|
||||
title: New transaction
|
||||
show:
|
||||
additional: Additional
|
||||
cost_per_share_label: Cost per Share
|
||||
date_label: Date
|
||||
delete: Delete
|
||||
delete_subtitle: This action cannot be undone
|
||||
delete_title: Delete Trade
|
||||
details: Details
|
||||
exclude_subtitle: This trade will not be included in reports and calculations
|
||||
exclude_title: Exclude from analytics
|
||||
note_label: Note
|
||||
note_placeholder: Add any additional notes here...
|
||||
quantity_label: Quantity
|
||||
settings: Settings
|
|
@ -1,64 +0,0 @@
|
|||
---
|
||||
en:
|
||||
account:
|
||||
transactions:
|
||||
bulk_delete:
|
||||
success: "%{count} transactions deleted"
|
||||
bulk_edit:
|
||||
cancel: Cancel
|
||||
category_label: Category
|
||||
category_placeholder: Select a category
|
||||
date_label: Date
|
||||
details: Details
|
||||
merchant_label: Merchant
|
||||
merchant_placeholder: Select a merchant
|
||||
none: (none)
|
||||
note_label: Notes
|
||||
note_placeholder: Enter a note that will be applied to selected transactions
|
||||
overview: Overview
|
||||
save: Save
|
||||
tag_label: Tags
|
||||
bulk_update:
|
||||
success: "%{count} transactions updated"
|
||||
form:
|
||||
account: Account
|
||||
account_prompt: Select an Account
|
||||
amount: Amount
|
||||
category: Category
|
||||
category_prompt: Select a Category
|
||||
date: Date
|
||||
description: Description
|
||||
description_placeholder: Describe transaction
|
||||
expense: Expense
|
||||
income: Income
|
||||
none: (none)
|
||||
note_label: Notes
|
||||
note_placeholder: Enter a note
|
||||
submit: Add transaction
|
||||
tags_label: Tags
|
||||
transfer: Transfer
|
||||
new:
|
||||
new_transaction: New transaction
|
||||
show:
|
||||
account_label: Account
|
||||
amount: Amount
|
||||
category_label: Category
|
||||
date_label: Date
|
||||
delete: Delete
|
||||
delete_subtitle: This permanently deletes the transaction, affects your historical
|
||||
balances, and cannot be undone.
|
||||
delete_title: Delete transaction
|
||||
details: Details
|
||||
merchant_label: Merchant
|
||||
name_label: Name
|
||||
nature: Type
|
||||
none: "(none)"
|
||||
note_label: Notes
|
||||
note_placeholder: Enter a note
|
||||
overview: Overview
|
||||
settings: Settings
|
||||
tags_label: Tags
|
||||
uncategorized: "(uncategorized)"
|
||||
transfer_matches:
|
||||
create:
|
||||
success: Transfer created
|
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
en:
|
||||
account:
|
||||
valuations:
|
||||
form:
|
||||
amount: Amount
|
||||
submit: Add balance update
|
||||
header:
|
||||
balance: Balance
|
||||
index:
|
||||
change: change
|
||||
date: date
|
||||
new_entry: New entry
|
||||
no_valuations: No valuations for this account yet
|
||||
valuations: Value
|
||||
value: value
|
||||
new:
|
||||
title: New balance
|
||||
show:
|
||||
amount: Amount
|
||||
date_label: Date
|
||||
delete: Delete
|
||||
delete_subtitle: This action cannot be undone
|
||||
delete_title: Delete Entry
|
||||
details: Details
|
||||
name_label: Name
|
||||
name_placeholder: Enter a name for this entry
|
||||
note_label: Notes
|
||||
note_placeholder: Add any additional details about this entry
|
||||
overview: Overview
|
||||
settings: Settings
|
14
config/locales/views/entries/en.yml
Normal file
14
config/locales/views/entries/en.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
en:
|
||||
entries:
|
||||
create:
|
||||
success: Entry created
|
||||
destroy:
|
||||
success: Entry deleted
|
||||
empty:
|
||||
description: Try adding an entry, editing filters or refining your search
|
||||
title: No entries found
|
||||
loading:
|
||||
loading: Loading entries...
|
||||
update:
|
||||
success: Entry updated
|
37
config/locales/views/holdings/en.yml
Normal file
37
config/locales/views/holdings/en.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
en:
|
||||
holdings:
|
||||
cash:
|
||||
brokerage_cash: Brokerage cash
|
||||
destroy:
|
||||
success: Holding deleted
|
||||
holding:
|
||||
per_share: per share
|
||||
shares: "%{qty} shares"
|
||||
index:
|
||||
cost: cost
|
||||
holdings: Holdings
|
||||
name: name
|
||||
new_holding: New transaction
|
||||
no_holdings: No holdings to show.
|
||||
return: total return
|
||||
weight: weight
|
||||
missing_price_tooltip:
|
||||
description: This investment has missing values and we could not calculate
|
||||
its returns or value.
|
||||
missing_data: Missing data
|
||||
show:
|
||||
avg_cost_label: Average Cost
|
||||
current_market_price_label: Current Market Price
|
||||
delete: Delete
|
||||
delete_subtitle: This will delete the holding and all your associated trades
|
||||
on this account. This action cannot be undone.
|
||||
delete_title: Delete holding
|
||||
history: History
|
||||
overview: Overview
|
||||
portfolio_weight_label: Portfolio Weight
|
||||
settings: Settings
|
||||
ticker_label: Ticker
|
||||
trade_history_entry: "%{qty} shares of %{security} at %{price}"
|
||||
trend_label: Trend
|
||||
unknown: Unknown
|
38
config/locales/views/trades/en.yml
Normal file
38
config/locales/views/trades/en.yml
Normal file
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
en:
|
||||
trades:
|
||||
form:
|
||||
account: Transfer account (optional)
|
||||
account_prompt: Search account
|
||||
amount: Amount
|
||||
holding: Ticker symbol
|
||||
price: Price per share
|
||||
qty: Quantity
|
||||
submit: Add transaction
|
||||
ticker_placeholder: AAPL
|
||||
type: Type
|
||||
header:
|
||||
buy: Buy
|
||||
current_market_price_label: Current Market Price
|
||||
overview: Overview
|
||||
purchase_price_label: Purchase Price
|
||||
purchase_qty_label: Purchase Quantity
|
||||
sell: Sell
|
||||
symbol_label: Symbol
|
||||
total_return_label: Unrealized gain/loss
|
||||
new:
|
||||
title: New transaction
|
||||
show:
|
||||
additional: Additional
|
||||
cost_per_share_label: Cost per Share
|
||||
date_label: Date
|
||||
delete: Delete
|
||||
delete_subtitle: This action cannot be undone
|
||||
delete_title: Delete Trade
|
||||
details: Details
|
||||
exclude_subtitle: This trade will not be included in reports and calculations
|
||||
exclude_title: Exclude from analytics
|
||||
note_label: Note
|
||||
note_placeholder: Add any additional notes here...
|
||||
quantity_label: Quantity
|
||||
settings: Settings
|
|
@ -1,6 +1,45 @@
|
|||
---
|
||||
en:
|
||||
transactions:
|
||||
form:
|
||||
account: Account
|
||||
account_prompt: Select an Account
|
||||
amount: Amount
|
||||
category: Category
|
||||
category_prompt: Select a Category
|
||||
date: Date
|
||||
description: Description
|
||||
description_placeholder: Describe transaction
|
||||
expense: Expense
|
||||
income: Income
|
||||
none: (none)
|
||||
note_label: Notes
|
||||
note_placeholder: Enter a note
|
||||
submit: Add transaction
|
||||
tags_label: Tags
|
||||
transfer: Transfer
|
||||
new:
|
||||
new_transaction: New transaction
|
||||
show:
|
||||
account_label: Account
|
||||
amount: Amount
|
||||
category_label: Category
|
||||
date_label: Date
|
||||
delete: Delete
|
||||
delete_subtitle: This permanently deletes the transaction, affects your historical
|
||||
balances, and cannot be undone.
|
||||
delete_title: Delete transaction
|
||||
details: Details
|
||||
merchant_label: Merchant
|
||||
name_label: Name
|
||||
nature: Type
|
||||
none: "(none)"
|
||||
note_label: Notes
|
||||
note_placeholder: Enter a note
|
||||
overview: Overview
|
||||
settings: Settings
|
||||
tags_label: Tags
|
||||
uncategorized: "(uncategorized)"
|
||||
header:
|
||||
edit_categories: Edit categories
|
||||
edit_imports: Edit imports
|
||||
|
|
30
config/locales/views/valuations/en.yml
Normal file
30
config/locales/views/valuations/en.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
en:
|
||||
valuations:
|
||||
form:
|
||||
amount: Amount
|
||||
submit: Add balance update
|
||||
header:
|
||||
balance: Balance
|
||||
index:
|
||||
change: change
|
||||
date: date
|
||||
new_entry: New entry
|
||||
no_valuations: No valuations for this account yet
|
||||
valuations: Value
|
||||
value: value
|
||||
new:
|
||||
title: New balance
|
||||
show:
|
||||
amount: Amount
|
||||
date_label: Date
|
||||
delete: Delete
|
||||
delete_subtitle: This action cannot be undone
|
||||
delete_title: Delete Entry
|
||||
details: Details
|
||||
name_label: Name
|
||||
name_placeholder: Enter a name for this entry
|
||||
note_label: Notes
|
||||
note_placeholder: Add any additional details about this entry
|
||||
overview: Overview
|
||||
settings: Settings
|
|
@ -95,7 +95,7 @@ Rails.application.routes.draw do
|
|||
resources :mappings, only: :update, module: :import
|
||||
end
|
||||
|
||||
resources :accounts, only: %i[index new] do
|
||||
resources :accounts, only: %i[index new], shallow: true do
|
||||
collection do
|
||||
post :sync_all
|
||||
end
|
||||
|
@ -107,42 +107,34 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :accountable_sparklines, only: :show, param: :accountable_type
|
||||
resources :holdings, only: %i[index new show destroy]
|
||||
resources :trades, only: %i[show new create update destroy]
|
||||
resources :valuations, only: %i[show new create update destroy]
|
||||
|
||||
namespace :account do
|
||||
resources :holdings, only: %i[index new show destroy]
|
||||
|
||||
resources :transactions, only: %i[show new create update destroy] do
|
||||
resource :transfer_match, only: %i[new create]
|
||||
resource :category, only: :update, controller: :transaction_categories
|
||||
|
||||
collection do
|
||||
post "bulk_delete"
|
||||
get "bulk_edit"
|
||||
post "bulk_update"
|
||||
post "mark_transfers"
|
||||
post "unmark_transfers"
|
||||
end
|
||||
end
|
||||
|
||||
resources :valuations, only: %i[show new create update destroy]
|
||||
resources :trades, only: %i[show new create update destroy]
|
||||
namespace :transactions do
|
||||
resource :bulk_deletion, only: :create
|
||||
resource :bulk_update, only: %i[new create]
|
||||
end
|
||||
|
||||
direct :account_entry do |entry, options|
|
||||
if entry.new_record?
|
||||
route_for "account_#{entry.entryable_name.pluralize}", options
|
||||
else
|
||||
route_for entry.entryable_name, entry, options
|
||||
end
|
||||
end
|
||||
resources :transactions, only: %i[index new create show update destroy] do
|
||||
resource :transfer_match, only: %i[new create]
|
||||
resource :category, only: :update, controller: :transaction_categories
|
||||
|
||||
resources :transactions, only: :index do
|
||||
collection do
|
||||
delete :clear_filter
|
||||
end
|
||||
end
|
||||
|
||||
resources :accountable_sparklines, only: :show, param: :accountable_type
|
||||
|
||||
direct :entry do |entry, options|
|
||||
if entry.new_record?
|
||||
route_for entry.entryable_name.pluralize, options
|
||||
else
|
||||
route_for entry.entryable_name, entry, options
|
||||
end
|
||||
end
|
||||
|
||||
# Convenience routes for polymorphic paths
|
||||
# Example: account_path(Account.new(accountable: Depository.new)) => /depositories/123
|
||||
direct :account do |model, options|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue