Files
sure/app/models/family/lunchflow_connectable.rb
soky srm be0b20dfd9 Lunchflow settings family (#363)
* Move provider config to family

* remove global settings

* Remove turbo auto  submit

* Fix flash location

* Fix mssing syncer for lunchflow

* Update schema.rb

* FIX tests and encryption config

* FIX make rabbit happy

* FIX run migration in SQL

* FIX turbo frame modal

* Branding fixes

* FIX rabbit

* OCD with product names

* More OCD

* No other console.log|warn in codebase

---------

Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2025-11-22 02:14:29 +01:00

29 lines
625 B
Ruby

module Family::LunchflowConnectable
extend ActiveSupport::Concern
included do
has_many :lunchflow_items, dependent: :destroy
end
def can_connect_lunchflow?
# Families can now configure their own Lunchflow credentials
true
end
def create_lunchflow_item!(api_key:, base_url: nil, item_name: nil)
lunchflow_item = lunchflow_items.create!(
name: item_name || "Lunch Flow Connection",
api_key: api_key,
base_url: base_url
)
lunchflow_item.sync_later
lunchflow_item
end
def has_lunchflow_credentials?
lunchflow_items.where.not(api_key: nil).exists?
end
end