diff --git a/.cursor/rules/project-design.mdc b/.cursor/rules/project-design.mdc index 41fa2210..75f09a9c 100644 --- a/.cursor/rules/project-design.mdc +++ b/.cursor/rules/project-design.mdc @@ -116,7 +116,7 @@ The most important type of sync is the account sync. It is orchestrated by the - Auto-matches transfer records for the account - Calculates daily [balance.rb](mdc:app/models/account/balance.rb) records for the account from `account.start_date` to `Date.current` using [base_calculator.rb](mdc:app/models/account/balance/base_calculator.rb) - Balances are dependent on the calculation of [holding.rb](mdc:app/models/account/holding.rb), which uses [base_calculator.rb](mdc:app/models/account/holding/base_calculator.rb) -- Enriches transaction data if enabled by user +- Updates data according to rules created by user An account sync happens every time an [entry.rb](mdc:app/models/account/entry.rb) is updated. diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2b146864..66ff65cc 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -75,7 +75,7 @@ class UsersController < ApplicationController def user_params params.require(:user).permit( :first_name, :last_name, :email, :profile_image, :redirect_to, :delete_profile_image, :onboarded_at, :show_sidebar, :default_period, :show_ai_sidebar, :ai_enabled, - family_attributes: [ :name, :currency, :country, :locale, :date_format, :timezone, :id, :data_enrichment_enabled ] + family_attributes: [ :name, :currency, :country, :locale, :date_format, :timezone, :id ] ) end diff --git a/app/jobs/enrich_transaction_batch_job.rb b/app/jobs/enrich_transaction_batch_job.rb deleted file mode 100644 index 71aac720..00000000 --- a/app/jobs/enrich_transaction_batch_job.rb +++ /dev/null @@ -1,7 +0,0 @@ -class EnrichTransactionBatchJob < ApplicationJob - queue_as :low_priority - - def perform(account, batch_size = 100, offset = 0) - account.enrich_transaction_batch(batch_size, offset) - end -end diff --git a/app/models/account.rb b/app/models/account.rb index 5e1383e4..28cd4e0c 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,5 +1,5 @@ class Account < ApplicationRecord - include Syncable, Monetizable, Chartable, Enrichable, Linkable, Convertible + include Syncable, Monetizable, Chartable, Linkable, Convertible validates :name, :balance, :currency, presence: true @@ -78,11 +78,6 @@ class Account < ApplicationRecord Rails.logger.info("Processing balances (#{linked? ? 'reverse' : 'forward'})") sync_balances - - if enrichable? - Rails.logger.info("Enriching transaction data") - enrich_data - end end def post_sync diff --git a/app/models/demo/generator.rb b/app/models/demo/generator.rb index 9d62e684..a6418c03 100644 --- a/app/models/demo/generator.rb +++ b/app/models/demo/generator.rb @@ -152,7 +152,7 @@ class Demo::Generator Security::Price.destroy_all end - def create_family_and_user!(family_name, user_email, data_enrichment_enabled: false, currency: "USD") + def create_family_and_user!(family_name, user_email, currency: "USD") base_uuid = "d99e3c6e-d513-4452-8f24-dc263f8528c0" id = Digest::UUID.uuid_v5(base_uuid, family_name) @@ -161,7 +161,6 @@ class Demo::Generator name: family_name, currency: currency, stripe_subscription_status: "active", - data_enrichment_enabled: data_enrichment_enabled, locale: "en", country: "US", timezone: "America/New_York", diff --git a/app/models/provider/synth.rb b/app/models/provider/synth.rb index e095d2be..ff75ff49 100644 --- a/app/models/provider/synth.rb +++ b/app/models/provider/synth.rb @@ -159,38 +159,9 @@ class Provider::Synth < Provider end end - # ================================ - # Transactions - # ================================ - - def enrich_transaction(description, amount: nil, date: nil, city: nil, state: nil, country: nil) - with_provider_response do - params = { - description: description, - amount: amount, - date: date, - city: city, - state: state, - country: country - }.compact - - response = client.get("#{base_url}/enrich", params) - - parsed = JSON.parse(response.body) - - TransactionEnrichmentData.new( - name: parsed.dig("merchant"), - icon_url: parsed.dig("icon"), - category: parsed.dig("category") - ) - end - end - private attr_reader :api_key - TransactionEnrichmentData = Data.define(:name, :icon_url, :category) - def base_url ENV["SYNTH_URL"] || "https://api.synthfinance.com" end diff --git a/app/views/settings/preferences/_data_enrichment_settings.html.erb b/app/views/settings/preferences/_data_enrichment_settings.html.erb deleted file mode 100644 index bce47776..00000000 --- a/app/views/settings/preferences/_data_enrichment_settings.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<%# locals: (user:) %> - -
<%= t(".title") %>
-<%= t(".description") %>
- <% if self_hosted? %> -<%= t(".self_host_disclaimer") %>
- <% end %> -