Files
sure/app/models/merchant.rb
soky srm e290e3d4a1 Recurring transactions (#271)
* Implement recurring transactions support

* Amount fix

* Hide section when any filter is applied

* Add automatic identify feature

Automatic identification runs after:
  - CSV Import completes (TransactionImport, TradeImport, AccountImport, MintImport)
  - Plaid sync completes
  - SimpleFIN sync completes
  - LunchFlow sync completes
- Any new provider that we create.

* Fix linter and tests

* Fix address review

* FIX proper text sizing

* Fix further linter

Use circular distance to handle month-boundary wrapping

* normalize to a circular representation before computing the median

* Better tests validation

* Added some UI info

Fix pattern identification, last recurrent transaction needs to happened within the last 45 days.

* Fix styling

* Revert text subdued look

* Match structure of the other sections

* Styling

* Restore positive amounts styling

* Shorten label for UI styling

---------

Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2025-11-01 09:12:42 +01:00

12 lines
320 B
Ruby

class Merchant < ApplicationRecord
TYPES = %w[FamilyMerchant ProviderMerchant].freeze
has_many :transactions, dependent: :nullify
has_many :recurring_transactions, dependent: :destroy
validates :name, presence: true
validates :type, inclusion: { in: TYPES }
scope :alphabetically, -> { order(:name) }
end