mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-31 02:59:39 +02:00
* 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
21 lines
425 B
Ruby
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
|