1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-31 02:59:39 +02:00
Maybe/app/models/account/syncable.rb
Zach Gollwitzer c6bdf49f10
Account::Sync model and test fixture simplifications (#968)
* Add sync model

* Fresh fixtures for sync tests

* Sync tests overhaul

* Fix entry tests

* Complete remaining model test updates

* Update system tests

* Update demo data task

* Add system tests back to PR checks

* More simplifications, add empty family to fixtures for easier testing
2024-07-10 11:22:59 -04:00

21 lines
425 B
Ruby

module Account::Syncable
extend ActiveSupport::Concern
class_methods do
def sync(start_date: nil)
all.each { |a| a.sync_later(start_date: start_date) }
end
end
def syncing?
syncs.syncing.any?
end
def sync_later(start_date: nil)
AccountSyncJob.perform_later(self, start_date: start_date)
end
def sync(start_date: nil)
Account::Sync.for(self, start_date: start_date).run
end
end