2020-04-30 14:50:26 +00:00
|
|
|
account = Account.create!(
|
|
|
|
name: 'Acme Inc',
|
|
|
|
domain: 'support.chatwoot.com',
|
|
|
|
from_email: ENV.fetch('MAILER_SENDER_EMAIL', 'accounts@chatwoot.com')
|
|
|
|
)
|
2019-08-14 09:48:44 +00:00
|
|
|
|
2020-03-07 06:48:16 +00:00
|
|
|
user = User.new(name: 'John', email: 'john@acme.inc', password: '123456')
|
2019-08-19 08:19:57 +00:00
|
|
|
user.skip_confirmation!
|
|
|
|
user.save!
|
2019-08-14 09:48:44 +00:00
|
|
|
|
2020-03-07 06:48:16 +00:00
|
|
|
AccountUser.create!(
|
|
|
|
account_id: account.id,
|
|
|
|
user_id: user.id,
|
|
|
|
role: :administrator
|
|
|
|
)
|
|
|
|
|
2020-04-19 18:10:28 +00:00
|
|
|
web_widget = Channel::WebWidget.create!(account: account, website_url: 'https://acme.inc')
|
2019-08-19 08:19:57 +00:00
|
|
|
|
2019-10-20 10:49:12 +00:00
|
|
|
inbox = Inbox.create!(channel: web_widget, account: account, name: 'Acme Support')
|
|
|
|
InboxMember.create!(user: user, inbox: inbox)
|
2019-08-19 08:19:57 +00:00
|
|
|
|
2019-11-18 03:27:41 +00:00
|
|
|
contact = Contact.create!(name: 'jane', email: 'jane@example.com', phone_number: '0000', account: account)
|
2020-01-09 07:36:40 +00:00
|
|
|
contact_inbox = ContactInbox.create!(inbox: inbox, contact: contact, source_id: user.id)
|
2020-03-09 04:30:11 +00:00
|
|
|
conversation = Conversation.create!(
|
|
|
|
account: account,
|
|
|
|
inbox: inbox,
|
|
|
|
status: :open,
|
|
|
|
assignee: user,
|
|
|
|
contact: contact,
|
|
|
|
contact_inbox: contact_inbox,
|
|
|
|
additional_attributes: {}
|
|
|
|
)
|
2020-01-09 07:36:40 +00:00
|
|
|
Message.create!(content: 'Hello', account: account, inbox: inbox, conversation: conversation, message_type: :incoming)
|