Chatwoot/db/seeds.rb
Sony Mathew 905c93b8f8
Feature: Installation global config (#839) (#840)
* Renamed concern from Feature to Featurable

* Feature: Installation config (#839)
* Added new model installtion config with corresponding migrations and specs
* Created an installation config yml (key value store model)
* Created a config loader module to load the installaltion configs
* Added this to the config loader seeder
* Changed the account before create hook for default feature enabling to use the feature values from installtion config
* Renamed the feature concern to Featurable to follow the naming pattern for concerns
* Added comments and specs for modules and places that deemed necessary

* Refactored config loader to reduce cognitive complexity (#839)
2020-05-10 22:40:36 +05:30

36 lines
1.1 KiB
Ruby

# loading installation configs
ConfigLoader.new.process
account = Account.create!(
name: 'Acme Inc',
domain: 'support.chatwoot.com',
support_email: ENV.fetch('MAILER_SENDER_EMAIL', 'accounts@chatwoot.com')
)
user = User.new(name: 'John', email: 'john@acme.inc', password: '123456')
user.skip_confirmation!
user.save!
AccountUser.create!(
account_id: account.id,
user_id: user.id,
role: :administrator
)
web_widget = Channel::WebWidget.create!(account: account, website_url: 'https://acme.inc')
inbox = Inbox.create!(channel: web_widget, account: account, name: 'Acme Support')
InboxMember.create!(user: user, inbox: inbox)
contact = Contact.create!(name: 'jane', email: 'jane@example.com', phone_number: '0000', account: account)
contact_inbox = ContactInbox.create!(inbox: inbox, contact: contact, source_id: user.id)
conversation = Conversation.create!(
account: account,
inbox: inbox,
status: :open,
assignee: user,
contact: contact,
contact_inbox: contact_inbox,
additional_attributes: {}
)
Message.create!(content: 'Hello', account: account, inbox: inbox, conversation: conversation, message_type: :incoming)