mirror of
https://github.com/we-promise/sure.git
synced 2026-04-14 01:24:06 +00:00
* Move provider config to family * Update schema.rb * Add provier generator * Add table creation also * FIX generator namespace * Add support for global providers also * Remove over-engineered stuff * FIX parser * FIX linter * Some generator fixes * Update generator with fixes * Update item_model.rb.tt * Add missing linkable concern * Add missing routes * Update adapter.rb.tt * Update connectable_concern.rb.tt * Update unlinking_concern.rb.tt * Update family_generator.rb * Update family_generator.rb * Delete .claude/settings.local.json Signed-off-by: soky srm <sokysrm@gmail.com> * Move docs under API related folder * Rename Rails generator doc * Light edits to LLM generated doc * Small Lunch Flow config panel regressions. --------- Signed-off-by: soky srm <sokysrm@gmail.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
class <%= class_name %>Item < ApplicationRecord
|
|
include Syncable, Provided
|
|
|
|
enum :status, { good: "good", requires_update: "requires_update" }, default: :good
|
|
|
|
validates :name, presence: true
|
|
|
|
belongs_to :family
|
|
has_one_attached :logo
|
|
|
|
has_many :<%= file_name %>_accounts, dependent: :destroy
|
|
has_many :accounts, through: :<%= file_name %>_accounts
|
|
|
|
scope :active, -> { where(scheduled_for_deletion: false) }
|
|
scope :ordered, -> { order(created_at: :desc) }
|
|
scope :needs_update, -> { where(status: :requires_update) }
|
|
|
|
def destroy_later
|
|
update!(scheduled_for_deletion: true)
|
|
DestroyJob.perform_later(self)
|
|
end
|
|
|
|
# NOTE: This is a GLOBAL provider
|
|
# Credentials are configured globally in /settings/providers (self-hosted mode)
|
|
# or via environment variables
|
|
# This model stores the per-family connection, but not credentials
|
|
|
|
# TODO: Implement provider-specific methods
|
|
# - import_latest_<%= file_name %>_data
|
|
# - process_accounts
|
|
# - schedule_account_syncs
|
|
# - See <%= class_name %>Item::Provided for provider instantiation
|
|
end
|