chore: fix lint errors, environment config and missing unit partial
This commit is contained in:
parent
2a144cb2f1
commit
70e8759b5a
@ -1,4 +1,5 @@
|
||||
backend: DISABLE_MINI_PROFILER=true bin/rails s -p 3000
|
||||
# https://github.com/mperham/sidekiq/issues/3090#issuecomment-389748695
|
||||
worker: dotenv bundle exec sidekiq -C config/sidekiq.yml
|
||||
vite: bin/vite build --watch
|
||||
vite: bin/vite dev
|
||||
tunnel: ngrok http --domain=louvenia-pseudoembryonic-joycelyn.ngrok-free.dev 3000
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: captain_tool_configs
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# fallback_message :text
|
||||
# is_enabled :boolean
|
||||
# plug_play_token :string
|
||||
# tool_key :string
|
||||
# webhook_url :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# captain_assistant_id :bigint
|
||||
# inbox_id :bigint
|
||||
# plug_play_id :string
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_captain_tool_configs_on_account_id (account_id)
|
||||
# index_captain_tool_configs_on_assistant_id_and_tool_key (captain_assistant_id,tool_key) UNIQUE
|
||||
# index_captain_tool_configs_on_captain_assistant_id (captain_assistant_id)
|
||||
# index_captain_tool_configs_on_context (account_id,inbox_id,tool_key) UNIQUE
|
||||
# index_captain_tool_configs_on_inbox_id (inbox_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (inbox_id => inboxes.id)
|
||||
#
|
||||
class CaptainToolConfig < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :inbox
|
||||
|
||||
@ -8,6 +8,10 @@
|
||||
# phone_number :string not null
|
||||
# provider :string default("default")
|
||||
# provider_config :jsonb
|
||||
# wuzapi_admin_token :string
|
||||
# wuzapi_admin_token_iv :string
|
||||
# wuzapi_user_token :string
|
||||
# wuzapi_user_token_iv :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
|
||||
@ -2,39 +2,43 @@
|
||||
#
|
||||
# Table name: conversations
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# additional_attributes :jsonb
|
||||
# agent_last_seen_at :datetime
|
||||
# assignee_last_seen_at :datetime
|
||||
# cached_label_list :text
|
||||
# contact_last_seen_at :datetime
|
||||
# custom_attributes :jsonb
|
||||
# first_reply_created_at :datetime
|
||||
# identifier :string
|
||||
# last_activity_at :datetime not null
|
||||
# priority :integer
|
||||
# snoozed_until :datetime
|
||||
# status :integer default("open"), not null
|
||||
# uuid :uuid not null
|
||||
# waiting_since :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# assignee_agent_bot_id :bigint
|
||||
# assignee_id :integer
|
||||
# campaign_id :bigint
|
||||
# contact_id :bigint
|
||||
# contact_inbox_id :bigint
|
||||
# display_id :integer not null
|
||||
# inbox_id :integer not null
|
||||
# sla_policy_id :bigint
|
||||
# team_id :bigint
|
||||
# id :integer not null, primary key
|
||||
# active_scenario_expires_at :datetime
|
||||
# active_scenario_key :string
|
||||
# active_scenario_state :jsonb not null
|
||||
# additional_attributes :jsonb
|
||||
# agent_last_seen_at :datetime
|
||||
# assignee_last_seen_at :datetime
|
||||
# cached_label_list :text
|
||||
# contact_last_seen_at :datetime
|
||||
# custom_attributes :jsonb
|
||||
# first_reply_created_at :datetime
|
||||
# identifier :string
|
||||
# last_activity_at :datetime not null
|
||||
# priority :integer
|
||||
# snoozed_until :datetime
|
||||
# status :integer default("open"), not null
|
||||
# uuid :uuid not null
|
||||
# waiting_since :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# assignee_agent_bot_id :bigint
|
||||
# assignee_id :integer
|
||||
# campaign_id :bigint
|
||||
# contact_id :bigint
|
||||
# contact_inbox_id :bigint
|
||||
# display_id :integer not null
|
||||
# inbox_id :integer not null
|
||||
# sla_policy_id :bigint
|
||||
# team_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# conv_acid_inbid_stat_asgnid_idx (account_id,inbox_id,status,assignee_id)
|
||||
# index_conversations_on_account_id (account_id)
|
||||
# index_conversations_on_account_id_and_display_id (account_id,display_id) UNIQUE
|
||||
# index_conversations_on_active_scenario_key (active_scenario_key)
|
||||
# index_conversations_on_assignee_id_and_account_id (assignee_id,account_id)
|
||||
# index_conversations_on_campaign_id (campaign_id)
|
||||
# index_conversations_on_contact_id (contact_id)
|
||||
|
||||
@ -1,3 +1,40 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: conversation_crm_insights
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# confidence :float
|
||||
# contact_sessions_count :integer default(0), not null
|
||||
# error_message :text
|
||||
# generated_at :datetime
|
||||
# last_contact_at :datetime
|
||||
# model :string
|
||||
# schema_version :string
|
||||
# status :string default("success")
|
||||
# structured_data :jsonb
|
||||
# summary_text :text
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
# contact_id :bigint not null
|
||||
# conversation_id :bigint not null
|
||||
# range_from_message_id :bigint
|
||||
# range_to_message_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# idx_on_conversation_id_generated_at_44d5836366 (conversation_id,generated_at)
|
||||
# index_conversation_crm_insights_on_account_id (account_id)
|
||||
# index_conversation_crm_insights_on_contact_id (contact_id)
|
||||
# index_conversation_crm_insights_on_conversation_id (conversation_id)
|
||||
# index_conversation_crm_insights_on_status (status)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (contact_id => contacts.id)
|
||||
# fk_rails_... (conversation_id => conversations.id)
|
||||
#
|
||||
class ConversationCrmInsight < ApplicationRecord
|
||||
belongs_to :conversation
|
||||
belongs_to :contact
|
||||
|
||||
@ -1,3 +1,24 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: frequent_questions
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# cluster_date :date
|
||||
# label :string
|
||||
# occurrence_count :integer
|
||||
# question_text :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_frequent_questions_on_account_id (account_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
#
|
||||
class FrequentQuestion < ApplicationRecord
|
||||
belongs_to :account
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
# id :integer not null, primary key
|
||||
# allow_messages_after_resolved :boolean default(TRUE)
|
||||
# auto_assignment_config :jsonb
|
||||
# auto_resolve_duration :integer
|
||||
# business_name :string
|
||||
# channel_type :string
|
||||
# csat_config :jsonb not null
|
||||
|
||||
@ -19,7 +19,7 @@ class InstallationConfig < ApplicationRecord
|
||||
# https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
|
||||
# FIX ME : fixes breakage of installation config. we need to migrate.
|
||||
# Fix configuration in application.rb
|
||||
serialize :serialized_value, coder: YAML, type: ActiveSupport::HashWithIndifferentAccess
|
||||
# serialize :serialized_value, type: ActiveSupport::HashWithIndifferentAccess
|
||||
|
||||
before_validation :set_lock
|
||||
validates :name, presence: true
|
||||
@ -39,7 +39,10 @@ class InstallationConfig < ApplicationRecord
|
||||
# It was throwing error as the default value of column '{}' was failing in deserialization.
|
||||
return {}.with_indifferent_access if new_record? && @attributes['serialized_value']&.value_before_type_cast == '{}'
|
||||
|
||||
serialized_value[:value]
|
||||
data = serialized_value
|
||||
data = YAML.safe_load(data, permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol]) if data.is_a?(String)
|
||||
|
||||
data.with_indifferent_access[:value]
|
||||
end
|
||||
|
||||
def value=(value_to_assigned)
|
||||
|
||||
@ -1,3 +1,29 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: jasmine_collections
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# description :text
|
||||
# is_active :boolean default(TRUE)
|
||||
# name :string not null
|
||||
# visibility :integer default("private")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# owner_inbox_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_jasmine_collections_on_account_id (account_id)
|
||||
# index_jasmine_collections_on_account_id_and_owner_inbox_id (account_id,owner_inbox_id)
|
||||
# index_jasmine_collections_on_account_id_and_visibility (account_id,visibility)
|
||||
# index_jasmine_collections_on_owner_inbox_id (owner_inbox_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (owner_inbox_id => inboxes.id)
|
||||
#
|
||||
module Jasmine
|
||||
class Collection < ApplicationRecord
|
||||
self.table_name = 'jasmine_collections'
|
||||
|
||||
@ -1,3 +1,30 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: jasmine_documents
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# content :text
|
||||
# error_message :text
|
||||
# metadata :jsonb
|
||||
# source_type :integer default("manual")
|
||||
# status :integer default("pending")
|
||||
# title :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# collection_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_jasmine_docs_on_acc_coll_status (account_id,collection_id,status)
|
||||
# index_jasmine_documents_on_account_id (account_id)
|
||||
# index_jasmine_documents_on_collection_id (collection_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (collection_id => jasmine_collections.id)
|
||||
#
|
||||
module Jasmine
|
||||
class Document < ApplicationRecord
|
||||
self.table_name = 'jasmine_documents'
|
||||
|
||||
@ -1,3 +1,31 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: jasmine_document_chunks
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# content :text
|
||||
# embedding :vector(1536)
|
||||
# metadata :jsonb
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# collection_id :bigint not null
|
||||
# document_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_jasmine_chunks_on_acc_coll_doc (account_id,collection_id,document_id)
|
||||
# index_jasmine_document_chunks_on_account_id (account_id)
|
||||
# index_jasmine_document_chunks_on_collection_id (collection_id)
|
||||
# index_jasmine_document_chunks_on_document_id (document_id)
|
||||
# index_jasmine_document_chunks_on_embedding (embedding) USING hnsw
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (collection_id => jasmine_collections.id)
|
||||
# fk_rails_... (document_id => jasmine_documents.id)
|
||||
#
|
||||
module Jasmine
|
||||
require 'neighbor'
|
||||
class DocumentChunk < ApplicationRecord
|
||||
|
||||
@ -1,3 +1,31 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: jasmine_inbox_collections
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# is_enabled :boolean default(TRUE)
|
||||
# priority :integer default(0)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# collection_id :bigint not null
|
||||
# inbox_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# idx_on_account_id_collection_id_3011aaebad (account_id,collection_id)
|
||||
# index_jasmine_inbox_collections_on_account_id (account_id)
|
||||
# index_jasmine_inbox_collections_on_account_id_and_inbox_id (account_id,inbox_id)
|
||||
# index_jasmine_inbox_collections_on_collection_id (collection_id)
|
||||
# index_jasmine_inbox_collections_on_inbox_id (inbox_id)
|
||||
# index_jasmine_inbox_collections_uniqueness (account_id,inbox_id,collection_id) UNIQUE
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (collection_id => jasmine_collections.id)
|
||||
# fk_rails_... (inbox_id => inboxes.id)
|
||||
#
|
||||
module Jasmine
|
||||
class InboxCollection < ApplicationRecord
|
||||
self.table_name = 'jasmine_inbox_collections'
|
||||
|
||||
@ -1,3 +1,34 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: jasmine_inbox_settings
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# intent_keywords :jsonb
|
||||
# is_enabled :boolean default(FALSE)
|
||||
# mode :integer default(0)
|
||||
# model :string default("gpt-4o-mini")
|
||||
# name :string default("Jasmine")
|
||||
# playbook_prompt :text
|
||||
# rag_distance_threshold :float default(0.35)
|
||||
# rag_max_results :integer default(3)
|
||||
# system_prompt :text
|
||||
# temperature :float default(0.7)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# inbox_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_jasmine_inbox_settings_on_account_id (account_id)
|
||||
# index_jasmine_inbox_settings_on_account_id_and_inbox_id (account_id,inbox_id) UNIQUE
|
||||
# index_jasmine_inbox_settings_on_inbox_id (inbox_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (inbox_id => inboxes.id)
|
||||
#
|
||||
module Jasmine
|
||||
class InboxConfig < ApplicationRecord
|
||||
self.table_name = 'jasmine_inbox_settings'
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: jasmine_tool_configs
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# is_enabled :boolean default(FALSE), not null
|
||||
# last_test_duration_ms :integer
|
||||
# last_test_error :text
|
||||
# last_test_status :integer
|
||||
# last_tested_at :datetime
|
||||
# plug_play_token :text
|
||||
# tool_key :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# inbox_id :bigint not null
|
||||
# plug_play_id :string
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_jasmine_tool_configs_on_account_id (account_id)
|
||||
# index_jasmine_tool_configs_on_inbox_id (inbox_id)
|
||||
# index_jasmine_tool_configs_on_tool_key (tool_key)
|
||||
# index_jasmine_tools_on_account_inbox_key (account_id,inbox_id,tool_key) UNIQUE
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (inbox_id => inboxes.id)
|
||||
#
|
||||
module Jasmine
|
||||
class ToolConfig < ApplicationRecord
|
||||
self.table_name = 'jasmine_tool_configs'
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
# message_signature :text
|
||||
# name :string not null
|
||||
# otp_backup_codes :text
|
||||
# otp_required_for_login :boolean default(FALSE)
|
||||
# otp_required_for_login :boolean default(FALSE), not null
|
||||
# otp_secret :string
|
||||
# provider :string default("email"), not null
|
||||
# pubsub_token :string
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
# message_signature :text
|
||||
# name :string not null
|
||||
# otp_backup_codes :text
|
||||
# otp_required_for_login :boolean default(FALSE)
|
||||
# otp_required_for_login :boolean default(FALSE), not null
|
||||
# otp_secret :string
|
||||
# provider :string default("email"), not null
|
||||
# pubsub_token :string
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
json.id unit.id
|
||||
json.name unit.name
|
||||
json.status unit.status
|
||||
json.captain_brand_id unit.captain_brand_id
|
||||
json.account_id unit.account_id
|
||||
json.created_at unit.created_at.to_i
|
||||
json.updated_at unit.updated_at.to_i
|
||||
38
progresso/resolucao-ruby34-chatwoot.md
Normal file
38
progresso/resolucao-ruby34-chatwoot.md
Normal file
@ -0,0 +1,38 @@
|
||||
# Nota de Resolução: Configuração de Ambiente Ruby 3.4.4 e Correção de Serialização
|
||||
|
||||
## Objetivo
|
||||
|
||||
Configurar o ambiente de desenvolvimento do Chatwoot para a versão de Ruby exigida e resolver impedimentos de inicialização do banco de dados e servidor.
|
||||
|
||||
## Contexto
|
||||
|
||||
O projeto Chatwoot exige Ruby 3.4.4 e Rails 7.1. Versões anteriores do Ruby ou ferramentas ausentes (Overmind) impossibilitavam a execução de lints e do servidor. Além disso, uma incompatibilidade no modelo `InstallationConfig` causava erros de tipo durante o parse de YAML no Ruby 3.4.
|
||||
|
||||
## Passos Realizados
|
||||
|
||||
1. **Instalação de Ferramentas**:
|
||||
- `brew install ruby-install chruby overmind`
|
||||
- `ruby-install ruby 3.4.4`
|
||||
2. **Configuração de Shell**:
|
||||
- Adicionado `source /opt/homebrew/opt/chruby/share/chruby/chruby.sh` e `source /opt/homebrew/opt/chruby/share/chruby/auto.sh` ao `~/.zshrc` e `~/.bash_profile`.
|
||||
3. **Dependências**:
|
||||
- `gem install bundler:2.5.11`
|
||||
- `bundle install`
|
||||
4. **Correção de Código**:
|
||||
- Alterado [InstallationConfig.rb](file:///Users/user/Dev/Produtos/Chatwoot/chatwoot-develop/app/models/installation_config.rb) para lidar com a coluna `serialized_value` (JSONB) de forma resiliente, permitindo parse de YAML legado caso necessário, mas evitando falhas de tipo no Rails 7.1.
|
||||
|
||||
## Principais Arquivos Alterados
|
||||
|
||||
- [InstallationConfig.rb](file:///Users/user/Dev/Produtos/Chatwoot/chatwoot-develop/app/models/installation_config.rb): Ajuste nos métodos `value` e remoção da macro `serialize` redundante.
|
||||
- `~/.zshrc` / `~/.bash_profile`: Atualização de paths e scripts de ambiente.
|
||||
|
||||
## Como Validar
|
||||
|
||||
1. Execute `source ~/.zshrc`.
|
||||
2. Rode `bundle exec rails db:chatwoot_prepare`.
|
||||
3. Inicie o stack com `make run`.
|
||||
|
||||
## Como Reverter
|
||||
|
||||
1. Remover os `source` do `~/.zshrc`.
|
||||
2. Restaurar o modelo `InstallationConfig.rb` para o estado original (utilizando `serialize ... coder: YAML`).
|
||||
@ -1,5 +1,30 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: account_users
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# active_at :datetime
|
||||
# auto_offline :boolean default(TRUE), not null
|
||||
# availability :integer default("online"), not null
|
||||
# role :integer default("agent")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
# agent_capacity_policy_id :bigint
|
||||
# custom_role_id :bigint
|
||||
# inviter_id :bigint
|
||||
# user_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_account_users_on_account_id (account_id)
|
||||
# index_account_users_on_agent_capacity_policy_id (agent_capacity_policy_id)
|
||||
# index_account_users_on_custom_role_id (custom_role_id)
|
||||
# index_account_users_on_user_id (user_id)
|
||||
# uniq_user_id_per_account_id (account_id,user_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :account_user do
|
||||
account
|
||||
|
||||
@ -1,5 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: accounts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# auto_resolve_duration :integer
|
||||
# custom_attributes :jsonb
|
||||
# domain :string(100)
|
||||
# feature_flags :bigint default(0), not null
|
||||
# internal_attributes :jsonb not null
|
||||
# limits :jsonb
|
||||
# locale :integer default("en")
|
||||
# name :string not null
|
||||
# settings :jsonb
|
||||
# status :integer default("active")
|
||||
# support_email :string(100)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_accounts_on_status (status)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :account do
|
||||
sequence(:name) { |n| "Account #{n}" }
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: agent_bot_inboxes
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# status :integer default("active")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer
|
||||
# agent_bot_id :integer
|
||||
# inbox_id :integer
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :agent_bot_inbox do
|
||||
inbox
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: agent_bots
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# bot_config :jsonb
|
||||
# bot_type :integer default("webhook")
|
||||
# description :string
|
||||
# name :string
|
||||
# outgoing_url :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_agent_bots_on_account_id (account_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :agent_bot do
|
||||
name { 'MyString' }
|
||||
|
||||
@ -1,3 +1,36 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# content :text
|
||||
# description :text
|
||||
# locale :string default("en"), not null
|
||||
# meta :jsonb
|
||||
# position :integer
|
||||
# slug :string not null
|
||||
# status :integer
|
||||
# title :string
|
||||
# views :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# associated_article_id :bigint
|
||||
# author_id :bigint
|
||||
# category_id :integer
|
||||
# folder_id :integer
|
||||
# portal_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_articles_on_account_id (account_id)
|
||||
# index_articles_on_associated_article_id (associated_article_id)
|
||||
# index_articles_on_author_id (author_id)
|
||||
# index_articles_on_portal_id (portal_id)
|
||||
# index_articles_on_slug (slug) UNIQUE
|
||||
# index_articles_on_status (status)
|
||||
# index_articles_on_views (views)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :article, class: 'Article' do
|
||||
account
|
||||
|
||||
@ -1,3 +1,25 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: assignment_policies
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# assignment_order :integer default("round_robin"), not null
|
||||
# conversation_priority :integer default("earliest_created"), not null
|
||||
# description :text
|
||||
# enabled :boolean default(TRUE), not null
|
||||
# fair_distribution_limit :integer default(100), not null
|
||||
# fair_distribution_window :integer default(3600), not null
|
||||
# name :string(255) not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_assignment_policies_on_account_id (account_id)
|
||||
# index_assignment_policies_on_account_id_and_name (account_id,name) UNIQUE
|
||||
# index_assignment_policies_on_enabled (enabled)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :assignment_policy do
|
||||
account
|
||||
|
||||
@ -1,3 +1,22 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: automation_rules
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# actions :jsonb not null
|
||||
# active :boolean default(TRUE), not null
|
||||
# conditions :jsonb not null
|
||||
# description :text
|
||||
# event_name :string not null
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_automation_rules_on_account_id (account_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :automation_rule do
|
||||
account
|
||||
|
||||
@ -1,5 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: campaigns
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# audience :jsonb
|
||||
# campaign_status :integer default("active"), not null
|
||||
# campaign_type :integer default("ongoing"), not null
|
||||
# description :text
|
||||
# enabled :boolean default(TRUE)
|
||||
# message :text not null
|
||||
# scheduled_at :datetime
|
||||
# template_params :jsonb
|
||||
# title :string not null
|
||||
# trigger_only_during_business_hours :boolean default(FALSE)
|
||||
# trigger_rules :jsonb
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# display_id :integer not null
|
||||
# inbox_id :bigint not null
|
||||
# sender_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_campaigns_on_account_id (account_id)
|
||||
# index_campaigns_on_campaign_status (campaign_status)
|
||||
# index_campaigns_on_campaign_type (campaign_type)
|
||||
# index_campaigns_on_inbox_id (inbox_id)
|
||||
# index_campaigns_on_scheduled_at (scheduled_at)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :campaign do
|
||||
sequence(:title) { |n| "Campaign #{n}" }
|
||||
|
||||
@ -1,5 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: canned_responses
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# content :text
|
||||
# short_code :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :canned_response do
|
||||
content { 'Content' }
|
||||
|
||||
@ -1,3 +1,29 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: categories
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# description :text
|
||||
# icon :string default("")
|
||||
# locale :string default("en")
|
||||
# name :string
|
||||
# position :integer
|
||||
# slug :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# associated_category_id :bigint
|
||||
# parent_category_id :bigint
|
||||
# portal_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_categories_on_associated_category_id (associated_category_id)
|
||||
# index_categories_on_locale (locale)
|
||||
# index_categories_on_locale_and_account_id (locale,account_id)
|
||||
# index_categories_on_parent_category_id (parent_category_id)
|
||||
# index_categories_on_slug_and_locale_and_portal_id (slug,locale,portal_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :category, class: 'Category' do
|
||||
portal
|
||||
|
||||
@ -1,5 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_facebook_pages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# page_access_token :string not null
|
||||
# user_access_token :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# instagram_id :string
|
||||
# page_id :string not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_facebook_pages_on_page_id (page_id)
|
||||
# index_channel_facebook_pages_on_page_id_and_account_id (page_id,account_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :channel_facebook_page, class: 'Channel::FacebookPage' do
|
||||
page_access_token { SecureRandom.uuid }
|
||||
|
||||
@ -1,3 +1,26 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_twilio_sms
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# account_sid :string not null
|
||||
# api_key_sid :string
|
||||
# auth_token :string not null
|
||||
# content_templates :jsonb
|
||||
# content_templates_last_updated :datetime
|
||||
# medium :integer default("sms")
|
||||
# messaging_service_sid :string
|
||||
# phone_number :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_twilio_sms_on_account_sid_and_phone_number (account_sid,phone_number) UNIQUE
|
||||
# index_channel_twilio_sms_on_messaging_service_sid (messaging_service_sid) UNIQUE
|
||||
# index_channel_twilio_sms_on_phone_number (phone_number) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :channel_twilio_sms, class: 'Channel::TwilioSms' do
|
||||
auth_token { SecureRandom.uuid }
|
||||
|
||||
@ -1,5 +1,22 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_twitter_profiles
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# tweets_enabled :boolean default(TRUE)
|
||||
# twitter_access_token :string not null
|
||||
# twitter_access_token_secret :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# profile_id :string not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_twitter_profiles_on_account_id_and_profile_id (account_id,profile_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :channel_twitter_profile, class: 'Channel::TwitterProfile' do
|
||||
twitter_access_token { SecureRandom.uuid }
|
||||
|
||||
@ -1,5 +1,43 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: contacts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# additional_attributes :jsonb
|
||||
# blocked :boolean default(FALSE), not null
|
||||
# contact_type :integer default("visitor")
|
||||
# country_code :string default("")
|
||||
# custom_attributes :jsonb
|
||||
# email :string
|
||||
# identifier :string
|
||||
# last_activity_at :datetime
|
||||
# last_name :string default("")
|
||||
# location :string default("")
|
||||
# middle_name :string default("")
|
||||
# name :string default("")
|
||||
# phone_number :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# company_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_contacts_on_account_id (account_id)
|
||||
# index_contacts_on_account_id_and_contact_type (account_id,contact_type)
|
||||
# index_contacts_on_account_id_and_last_activity_at (account_id,last_activity_at DESC NULLS LAST)
|
||||
# index_contacts_on_blocked (blocked)
|
||||
# index_contacts_on_company_id (company_id)
|
||||
# index_contacts_on_lower_email_account_id (lower((email)::text), account_id)
|
||||
# index_contacts_on_name_email_phone_number_identifier (name,email,phone_number,identifier) USING gin
|
||||
# index_contacts_on_nonempty_fields (account_id,email,phone_number,identifier) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
||||
# index_contacts_on_phone_number_and_account_id (phone_number,account_id)
|
||||
# index_resolved_contact_account_id (account_id) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
||||
# uniq_email_per_account_contact (email,account_id) UNIQUE
|
||||
# uniq_identifier_per_account_contact (identifier,account_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :contact do
|
||||
sequence(:name) { |n| "Contact #{n}" }
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: conversation_participants
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# conversation_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_conversation_participants_on_account_id (account_id)
|
||||
# index_conversation_participants_on_conversation_id (conversation_id)
|
||||
# index_conversation_participants_on_user_id (user_id)
|
||||
# index_conversation_participants_on_user_id_and_conversation_id (user_id,conversation_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :conversation_participant do
|
||||
conversation
|
||||
|
||||
@ -1,5 +1,61 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: conversations
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# active_scenario_expires_at :datetime
|
||||
# active_scenario_key :string
|
||||
# active_scenario_state :jsonb not null
|
||||
# additional_attributes :jsonb
|
||||
# agent_last_seen_at :datetime
|
||||
# assignee_last_seen_at :datetime
|
||||
# cached_label_list :text
|
||||
# contact_last_seen_at :datetime
|
||||
# custom_attributes :jsonb
|
||||
# first_reply_created_at :datetime
|
||||
# identifier :string
|
||||
# last_activity_at :datetime not null
|
||||
# priority :integer
|
||||
# snoozed_until :datetime
|
||||
# status :integer default("open"), not null
|
||||
# uuid :uuid not null
|
||||
# waiting_since :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# assignee_agent_bot_id :bigint
|
||||
# assignee_id :integer
|
||||
# campaign_id :bigint
|
||||
# contact_id :bigint
|
||||
# contact_inbox_id :bigint
|
||||
# display_id :integer not null
|
||||
# inbox_id :integer not null
|
||||
# sla_policy_id :bigint
|
||||
# team_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# conv_acid_inbid_stat_asgnid_idx (account_id,inbox_id,status,assignee_id)
|
||||
# index_conversations_on_account_id (account_id)
|
||||
# index_conversations_on_account_id_and_display_id (account_id,display_id) UNIQUE
|
||||
# index_conversations_on_active_scenario_key (active_scenario_key)
|
||||
# index_conversations_on_assignee_id_and_account_id (assignee_id,account_id)
|
||||
# index_conversations_on_campaign_id (campaign_id)
|
||||
# index_conversations_on_contact_id (contact_id)
|
||||
# index_conversations_on_contact_inbox_id (contact_inbox_id)
|
||||
# index_conversations_on_first_reply_created_at (first_reply_created_at)
|
||||
# index_conversations_on_id_and_account_id (account_id,id)
|
||||
# index_conversations_on_identifier_and_account_id (identifier,account_id)
|
||||
# index_conversations_on_inbox_id (inbox_id)
|
||||
# index_conversations_on_priority (priority)
|
||||
# index_conversations_on_status_and_account_id (status,account_id)
|
||||
# index_conversations_on_status_and_priority (status,priority)
|
||||
# index_conversations_on_team_id (team_id)
|
||||
# index_conversations_on_uuid (uuid) UNIQUE
|
||||
# index_conversations_on_waiting_since (waiting_since)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :conversation do
|
||||
status { 'open' }
|
||||
|
||||
@ -1,5 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: csat_survey_responses
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# feedback_message :text
|
||||
# rating :integer not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# assigned_agent_id :bigint
|
||||
# contact_id :bigint not null
|
||||
# conversation_id :bigint not null
|
||||
# message_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_csat_survey_responses_on_account_id (account_id)
|
||||
# index_csat_survey_responses_on_assigned_agent_id (assigned_agent_id)
|
||||
# index_csat_survey_responses_on_contact_id (contact_id)
|
||||
# index_csat_survey_responses_on_conversation_id (conversation_id)
|
||||
# index_csat_survey_responses_on_message_id (message_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :csat_survey_response do
|
||||
rating { 1 }
|
||||
|
||||
@ -1,5 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: custom_attribute_definitions
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# attribute_description :text
|
||||
# attribute_display_name :string
|
||||
# attribute_display_type :integer default("text")
|
||||
# attribute_key :string
|
||||
# attribute_model :integer default("conversation_attribute")
|
||||
# attribute_values :jsonb
|
||||
# default_value :integer
|
||||
# regex_cue :string
|
||||
# regex_pattern :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# attribute_key_model_index (attribute_key,attribute_model,account_id) UNIQUE
|
||||
# index_custom_attribute_definitions_on_account_id (account_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :custom_attribute_definition do
|
||||
sequence(:attribute_display_name) { |n| "Custom Attribute Definition #{n}" }
|
||||
|
||||
@ -1,5 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: custom_filters
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# filter_type :integer default("conversation"), not null
|
||||
# name :string not null
|
||||
# query :jsonb not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_custom_filters_on_account_id (account_id)
|
||||
# index_custom_filters_on_user_id (user_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :custom_filter do
|
||||
sequence(:name) { |n| "Custom Filter #{n}" }
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: folders
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# category_id :integer not null
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :folder, class: 'Folder' do
|
||||
account_id { 1 }
|
||||
|
||||
@ -1,3 +1,18 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: inbox_assignment_policies
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# assignment_policy_id :bigint not null
|
||||
# inbox_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_inbox_assignment_policies_on_assignment_policy_id (assignment_policy_id)
|
||||
# index_inbox_assignment_policies_on_inbox_id (inbox_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :inbox_assignment_policy do
|
||||
inbox
|
||||
|
||||
@ -1,5 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: inbox_members
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# inbox_id :integer not null
|
||||
# user_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_inbox_members_on_inbox_id (inbox_id)
|
||||
# index_inbox_members_on_inbox_id_and_user_id (inbox_id,user_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :inbox_member do
|
||||
user { create(:user, :with_avatar) }
|
||||
|
||||
@ -1,5 +1,44 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: inboxes
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# allow_messages_after_resolved :boolean default(TRUE)
|
||||
# auto_assignment_config :jsonb
|
||||
# auto_resolve_duration :integer
|
||||
# business_name :string
|
||||
# channel_type :string
|
||||
# csat_config :jsonb not null
|
||||
# csat_survey_enabled :boolean default(FALSE)
|
||||
# email_address :string
|
||||
# enable_auto_assignment :boolean default(TRUE)
|
||||
# enable_email_collect :boolean default(TRUE)
|
||||
# greeting_enabled :boolean default(FALSE)
|
||||
# greeting_message :string
|
||||
# lock_to_single_conversation :boolean default(FALSE), not null
|
||||
# name :string not null
|
||||
# out_of_office_message :string
|
||||
# sender_name_type :integer default("friendly"), not null
|
||||
# timezone :string default("UTC")
|
||||
# working_hours_enabled :boolean default(FALSE)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# channel_id :integer not null
|
||||
# portal_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_inboxes_on_account_id (account_id)
|
||||
# index_inboxes_on_channel_id_and_channel_type (channel_id,channel_type)
|
||||
# index_inboxes_on_portal_id (portal_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (portal_id => portals.id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :inbox do
|
||||
account
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: integrations_hooks
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# access_token :string
|
||||
# hook_type :integer default("account")
|
||||
# settings :jsonb
|
||||
# status :integer default("enabled")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer
|
||||
# app_id :string
|
||||
# inbox_id :integer
|
||||
# reference_id :string
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :integrations_hook, class: 'Integrations::Hook' do
|
||||
app_id { 'slack' }
|
||||
|
||||
@ -1,5 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: labels
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# color :string default("#1f93ff"), not null
|
||||
# description :text
|
||||
# show_on_sidebar :boolean
|
||||
# title :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_labels_on_account_id (account_id)
|
||||
# index_labels_on_title_and_account_id (title,account_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :label do
|
||||
account
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: macros
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# actions :jsonb not null
|
||||
# name :string not null
|
||||
# visibility :integer default("personal")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# created_by_id :bigint
|
||||
# updated_by_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_macros_on_account_id (account_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :macro do
|
||||
account
|
||||
|
||||
@ -1,5 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: mentions
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# mentioned_at :datetime not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# conversation_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_mentions_on_account_id (account_id)
|
||||
# index_mentions_on_conversation_id (conversation_id)
|
||||
# index_mentions_on_user_id (user_id)
|
||||
# index_mentions_on_user_id_and_conversation_id (user_id,conversation_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :mention do
|
||||
mentioned_at { Time.current }
|
||||
|
||||
@ -1,5 +1,44 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: messages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# additional_attributes :jsonb
|
||||
# content :text
|
||||
# content_attributes :json
|
||||
# content_type :integer default("text"), not null
|
||||
# external_source_ids :jsonb
|
||||
# message_type :integer not null
|
||||
# private :boolean default(FALSE), not null
|
||||
# processed_message_content :text
|
||||
# sender_type :string
|
||||
# sentiment :jsonb
|
||||
# status :integer default("sent")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# conversation_id :integer not null
|
||||
# inbox_id :integer not null
|
||||
# sender_id :bigint
|
||||
# source_id :text
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# idx_messages_account_content_created (account_id,content_type,created_at)
|
||||
# index_messages_on_account_created_type (account_id,created_at,message_type)
|
||||
# index_messages_on_account_id (account_id)
|
||||
# index_messages_on_account_id_and_inbox_id (account_id,inbox_id)
|
||||
# index_messages_on_additional_attributes_campaign_id (((additional_attributes -> 'campaign_id'::text))) USING gin
|
||||
# index_messages_on_content (content) USING gin
|
||||
# index_messages_on_conversation_account_type_created (conversation_id,account_id,message_type,created_at)
|
||||
# index_messages_on_conversation_id (conversation_id)
|
||||
# index_messages_on_created_at (created_at)
|
||||
# index_messages_on_inbox_id (inbox_id)
|
||||
# index_messages_on_sender_type_and_sender_id (sender_type,sender_id)
|
||||
# index_messages_on_source_id (source_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :message do
|
||||
content { 'Incoming Message' }
|
||||
|
||||
@ -1,5 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: notes
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# content :text not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# contact_id :bigint not null
|
||||
# user_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_notes_on_account_id (account_id)
|
||||
# index_notes_on_contact_id (contact_id)
|
||||
# index_notes_on_user_id (user_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :note do
|
||||
content { 'Hey welcome to chatwoot' }
|
||||
|
||||
@ -1,5 +1,22 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: notification_subscriptions
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# identifier :text
|
||||
# subscription_attributes :jsonb not null
|
||||
# subscription_type :integer not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_notification_subscriptions_on_identifier (identifier) UNIQUE
|
||||
# index_notification_subscriptions_on_user_id (user_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :notification_subscription do
|
||||
user
|
||||
|
||||
@ -1,5 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: notifications
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# last_activity_at :datetime
|
||||
# meta :jsonb
|
||||
# notification_type :integer not null
|
||||
# primary_actor_type :string not null
|
||||
# read_at :datetime
|
||||
# secondary_actor_type :string
|
||||
# snoozed_until :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# primary_actor_id :bigint not null
|
||||
# secondary_actor_id :bigint
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# idx_notifications_performance (user_id,account_id,snoozed_until,read_at)
|
||||
# index_notifications_on_account_id (account_id)
|
||||
# index_notifications_on_last_activity_at (last_activity_at)
|
||||
# index_notifications_on_user_id (user_id)
|
||||
# uniq_primary_actor_per_account_notifications (primary_actor_type,primary_actor_id)
|
||||
# uniq_secondary_actor_per_account_notifications (secondary_actor_type,secondary_actor_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :notification do
|
||||
primary_actor { create(:conversation, account: account) }
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: platform_apps
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :platform_app do
|
||||
name { Faker::Book.name }
|
||||
|
||||
@ -1,3 +1,29 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: portals
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# archived :boolean default(FALSE)
|
||||
# color :string
|
||||
# config :jsonb
|
||||
# custom_domain :string
|
||||
# header_text :text
|
||||
# homepage_link :string
|
||||
# name :string not null
|
||||
# page_title :string
|
||||
# slug :string not null
|
||||
# ssl_settings :jsonb not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# channel_web_widget_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_portals_on_channel_web_widget_id (channel_web_widget_id)
|
||||
# index_portals_on_custom_domain (custom_domain) UNIQUE
|
||||
# index_portals_on_slug (slug) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :portal, class: 'Portal' do
|
||||
account
|
||||
|
||||
@ -1,3 +1,18 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: related_categories
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# category_id :bigint
|
||||
# related_category_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_related_categories_on_category_id_and_related_category_id (category_id,related_category_id) UNIQUE
|
||||
# index_related_categories_on_related_category_id_and_category_id (related_category_id,category_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :related_category do
|
||||
category
|
||||
|
||||
@ -1,3 +1,30 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: reporting_events
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# event_end_time :datetime
|
||||
# event_start_time :datetime
|
||||
# name :string
|
||||
# value :float
|
||||
# value_in_business_hours :float
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer
|
||||
# conversation_id :integer
|
||||
# inbox_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_reporting_events_on_account_id (account_id)
|
||||
# index_reporting_events_on_conversation_id (conversation_id)
|
||||
# index_reporting_events_on_created_at (created_at)
|
||||
# index_reporting_events_on_inbox_id (inbox_id)
|
||||
# index_reporting_events_on_name (name)
|
||||
# index_reporting_events_on_user_id (user_id)
|
||||
# reporting_events__account_id__name__created_at (account_id,name,created_at)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :reporting_event do
|
||||
name { 'first_response' }
|
||||
|
||||
@ -1,3 +1,49 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: users
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# availability :integer default("online")
|
||||
# confirmation_sent_at :datetime
|
||||
# confirmation_token :string
|
||||
# confirmed_at :datetime
|
||||
# consumed_timestep :integer
|
||||
# current_sign_in_at :datetime
|
||||
# current_sign_in_ip :string
|
||||
# custom_attributes :jsonb
|
||||
# display_name :string
|
||||
# email :string
|
||||
# encrypted_password :string default(""), not null
|
||||
# last_sign_in_at :datetime
|
||||
# last_sign_in_ip :string
|
||||
# message_signature :text
|
||||
# name :string not null
|
||||
# otp_backup_codes :text
|
||||
# otp_required_for_login :boolean default(FALSE), not null
|
||||
# otp_secret :string
|
||||
# provider :string default("email"), not null
|
||||
# pubsub_token :string
|
||||
# remember_created_at :datetime
|
||||
# reset_password_sent_at :datetime
|
||||
# reset_password_token :string
|
||||
# sign_in_count :integer default(0), not null
|
||||
# tokens :json
|
||||
# type :string
|
||||
# ui_settings :jsonb
|
||||
# uid :string default(""), not null
|
||||
# unconfirmed_email :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_users_on_email (email)
|
||||
# index_users_on_otp_required_for_login (otp_required_for_login)
|
||||
# index_users_on_otp_secret (otp_secret) UNIQUE
|
||||
# index_users_on_pubsub_token (pubsub_token) UNIQUE
|
||||
# index_users_on_reset_password_token (reset_password_token) UNIQUE
|
||||
# index_users_on_uid_and_provider (uid,provider) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :super_admin do
|
||||
name { Faker::Name.name }
|
||||
|
||||
@ -1,5 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: team_members
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# team_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_team_members_on_team_id (team_id)
|
||||
# index_team_members_on_team_id_and_user_id (team_id,user_id) UNIQUE
|
||||
# index_team_members_on_user_id (user_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :team_member do
|
||||
user
|
||||
|
||||
@ -1,3 +1,20 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: teams
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# allow_auto_assign :boolean default(TRUE)
|
||||
# description :text
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_teams_on_account_id (account_id)
|
||||
# index_teams_on_name_and_account_id (name,account_id) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :team do
|
||||
sequence(:name) { |n| "Team #{n}" }
|
||||
|
||||
@ -1,5 +1,51 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: users
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# availability :integer default("online")
|
||||
# confirmation_sent_at :datetime
|
||||
# confirmation_token :string
|
||||
# confirmed_at :datetime
|
||||
# consumed_timestep :integer
|
||||
# current_sign_in_at :datetime
|
||||
# current_sign_in_ip :string
|
||||
# custom_attributes :jsonb
|
||||
# display_name :string
|
||||
# email :string
|
||||
# encrypted_password :string default(""), not null
|
||||
# last_sign_in_at :datetime
|
||||
# last_sign_in_ip :string
|
||||
# message_signature :text
|
||||
# name :string not null
|
||||
# otp_backup_codes :text
|
||||
# otp_required_for_login :boolean default(FALSE), not null
|
||||
# otp_secret :string
|
||||
# provider :string default("email"), not null
|
||||
# pubsub_token :string
|
||||
# remember_created_at :datetime
|
||||
# reset_password_sent_at :datetime
|
||||
# reset_password_token :string
|
||||
# sign_in_count :integer default(0), not null
|
||||
# tokens :json
|
||||
# type :string
|
||||
# ui_settings :jsonb
|
||||
# uid :string default(""), not null
|
||||
# unconfirmed_email :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_users_on_email (email)
|
||||
# index_users_on_otp_required_for_login (otp_required_for_login)
|
||||
# index_users_on_otp_secret (otp_secret) UNIQUE
|
||||
# index_users_on_pubsub_token (pubsub_token) UNIQUE
|
||||
# index_users_on_reset_password_token (reset_password_token) UNIQUE
|
||||
# index_users_on_uid_and_provider (uid,provider) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :user do
|
||||
transient do
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: webhooks
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# subscriptions :jsonb
|
||||
# url :string
|
||||
# webhook_type :integer default("account_type")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer
|
||||
# inbox_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_webhooks_on_account_id_and_url (account_id,url) UNIQUE
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :webhook do
|
||||
account_id { 1 }
|
||||
|
||||
@ -1,5 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: working_hours
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# close_hour :integer
|
||||
# close_minutes :integer
|
||||
# closed_all_day :boolean default(FALSE)
|
||||
# day_of_week :integer not null
|
||||
# open_all_day :boolean default(FALSE)
|
||||
# open_hour :integer
|
||||
# open_minutes :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
# inbox_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_working_hours_on_account_id (account_id)
|
||||
# index_working_hours_on_inbox_id (inbox_id)
|
||||
#
|
||||
FactoryBot.define do
|
||||
factory :working_hour do
|
||||
inbox
|
||||
|
||||
23
spec/fixtures/accounts.yml
vendored
23
spec/fixtures/accounts.yml
vendored
@ -1,5 +1,28 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: accounts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# auto_resolve_duration :integer
|
||||
# custom_attributes :jsonb
|
||||
# domain :string(100)
|
||||
# feature_flags :bigint default(0), not null
|
||||
# internal_attributes :jsonb not null
|
||||
# limits :jsonb
|
||||
# locale :integer default("en")
|
||||
# name :string not null
|
||||
# settings :jsonb
|
||||
# status :integer default("active")
|
||||
# support_email :string(100)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_accounts_on_status (status)
|
||||
#
|
||||
one:
|
||||
name: MyString
|
||||
|
||||
|
||||
22
spec/fixtures/attachments.yml
vendored
22
spec/fixtures/attachments.yml
vendored
@ -4,6 +4,28 @@
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: attachments
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# coordinates_lat :float default(0.0)
|
||||
# coordinates_long :float default(0.0)
|
||||
# extension :string
|
||||
# external_url :string
|
||||
# fallback_title :string
|
||||
# file_type :integer default("image")
|
||||
# meta :jsonb
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# message_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_attachments_on_account_id (account_id)
|
||||
# index_attachments_on_message_id (message_id)
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
|
||||
11
spec/fixtures/canned_responses.yml
vendored
11
spec/fixtures/canned_responses.yml
vendored
@ -1,5 +1,16 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: canned_responses
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# content :text
|
||||
# short_code :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
#
|
||||
one:
|
||||
account_id: 1
|
||||
short_code: MyString
|
||||
|
||||
38
spec/fixtures/contacts.yml
vendored
38
spec/fixtures/contacts.yml
vendored
@ -1,5 +1,43 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: contacts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# additional_attributes :jsonb
|
||||
# blocked :boolean default(FALSE), not null
|
||||
# contact_type :integer default("visitor")
|
||||
# country_code :string default("")
|
||||
# custom_attributes :jsonb
|
||||
# email :string
|
||||
# identifier :string
|
||||
# last_activity_at :datetime
|
||||
# last_name :string default("")
|
||||
# location :string default("")
|
||||
# middle_name :string default("")
|
||||
# name :string default("")
|
||||
# phone_number :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# company_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_contacts_on_account_id (account_id)
|
||||
# index_contacts_on_account_id_and_contact_type (account_id,contact_type)
|
||||
# index_contacts_on_account_id_and_last_activity_at (account_id,last_activity_at DESC NULLS LAST)
|
||||
# index_contacts_on_blocked (blocked)
|
||||
# index_contacts_on_company_id (company_id)
|
||||
# index_contacts_on_lower_email_account_id (lower((email)::text), account_id)
|
||||
# index_contacts_on_name_email_phone_number_identifier (name,email,phone_number,identifier) USING gin
|
||||
# index_contacts_on_nonempty_fields (account_id,email,phone_number,identifier) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
||||
# index_contacts_on_phone_number_and_account_id (phone_number,account_id)
|
||||
# index_resolved_contact_account_id (account_id) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
||||
# uniq_email_per_account_contact (email,account_id) UNIQUE
|
||||
# uniq_identifier_per_account_contact (identifier,account_id) UNIQUE
|
||||
#
|
||||
one:
|
||||
name: MyString
|
||||
email: MyString
|
||||
|
||||
56
spec/fixtures/conversations.yml
vendored
56
spec/fixtures/conversations.yml
vendored
@ -1,5 +1,61 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: conversations
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# active_scenario_expires_at :datetime
|
||||
# active_scenario_key :string
|
||||
# active_scenario_state :jsonb not null
|
||||
# additional_attributes :jsonb
|
||||
# agent_last_seen_at :datetime
|
||||
# assignee_last_seen_at :datetime
|
||||
# cached_label_list :text
|
||||
# contact_last_seen_at :datetime
|
||||
# custom_attributes :jsonb
|
||||
# first_reply_created_at :datetime
|
||||
# identifier :string
|
||||
# last_activity_at :datetime not null
|
||||
# priority :integer
|
||||
# snoozed_until :datetime
|
||||
# status :integer default("open"), not null
|
||||
# uuid :uuid not null
|
||||
# waiting_since :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# assignee_agent_bot_id :bigint
|
||||
# assignee_id :integer
|
||||
# campaign_id :bigint
|
||||
# contact_id :bigint
|
||||
# contact_inbox_id :bigint
|
||||
# display_id :integer not null
|
||||
# inbox_id :integer not null
|
||||
# sla_policy_id :bigint
|
||||
# team_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# conv_acid_inbid_stat_asgnid_idx (account_id,inbox_id,status,assignee_id)
|
||||
# index_conversations_on_account_id (account_id)
|
||||
# index_conversations_on_account_id_and_display_id (account_id,display_id) UNIQUE
|
||||
# index_conversations_on_active_scenario_key (active_scenario_key)
|
||||
# index_conversations_on_assignee_id_and_account_id (assignee_id,account_id)
|
||||
# index_conversations_on_campaign_id (campaign_id)
|
||||
# index_conversations_on_contact_id (contact_id)
|
||||
# index_conversations_on_contact_inbox_id (contact_inbox_id)
|
||||
# index_conversations_on_first_reply_created_at (first_reply_created_at)
|
||||
# index_conversations_on_id_and_account_id (account_id,id)
|
||||
# index_conversations_on_identifier_and_account_id (identifier,account_id)
|
||||
# index_conversations_on_inbox_id (inbox_id)
|
||||
# index_conversations_on_priority (priority)
|
||||
# index_conversations_on_status_and_account_id (status,account_id)
|
||||
# index_conversations_on_status_and_priority (status,priority)
|
||||
# index_conversations_on_team_id (team_id)
|
||||
# index_conversations_on_uuid (uuid) UNIQUE
|
||||
# index_conversations_on_waiting_since (waiting_since)
|
||||
#
|
||||
one:
|
||||
account_id: 1
|
||||
channel_id: 1
|
||||
|
||||
15
spec/fixtures/inbox_members.yml
vendored
15
spec/fixtures/inbox_members.yml
vendored
@ -1,5 +1,20 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: inbox_members
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# inbox_id :integer not null
|
||||
# user_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_inbox_members_on_inbox_id (inbox_id)
|
||||
# index_inbox_members_on_inbox_id_and_user_id (inbox_id,user_id) UNIQUE
|
||||
#
|
||||
one:
|
||||
user_id: 1
|
||||
inbox_id: 1
|
||||
|
||||
39
spec/fixtures/inboxes.yml
vendored
39
spec/fixtures/inboxes.yml
vendored
@ -1,5 +1,44 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: inboxes
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# allow_messages_after_resolved :boolean default(TRUE)
|
||||
# auto_assignment_config :jsonb
|
||||
# auto_resolve_duration :integer
|
||||
# business_name :string
|
||||
# channel_type :string
|
||||
# csat_config :jsonb not null
|
||||
# csat_survey_enabled :boolean default(FALSE)
|
||||
# email_address :string
|
||||
# enable_auto_assignment :boolean default(TRUE)
|
||||
# enable_email_collect :boolean default(TRUE)
|
||||
# greeting_enabled :boolean default(FALSE)
|
||||
# greeting_message :string
|
||||
# lock_to_single_conversation :boolean default(FALSE), not null
|
||||
# name :string not null
|
||||
# out_of_office_message :string
|
||||
# sender_name_type :integer default("friendly"), not null
|
||||
# timezone :string default("UTC")
|
||||
# working_hours_enabled :boolean default(FALSE)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# channel_id :integer not null
|
||||
# portal_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_inboxes_on_account_id (account_id)
|
||||
# index_inboxes_on_channel_id_and_channel_type (channel_id,channel_type)
|
||||
# index_inboxes_on_portal_id (portal_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (portal_id => portals.id)
|
||||
#
|
||||
one:
|
||||
channel_id: 1
|
||||
account_id: 1
|
||||
|
||||
46
spec/fixtures/users.yml
vendored
46
spec/fixtures/users.yml
vendored
@ -4,6 +4,52 @@
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: users
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# availability :integer default("online")
|
||||
# confirmation_sent_at :datetime
|
||||
# confirmation_token :string
|
||||
# confirmed_at :datetime
|
||||
# consumed_timestep :integer
|
||||
# current_sign_in_at :datetime
|
||||
# current_sign_in_ip :string
|
||||
# custom_attributes :jsonb
|
||||
# display_name :string
|
||||
# email :string
|
||||
# encrypted_password :string default(""), not null
|
||||
# last_sign_in_at :datetime
|
||||
# last_sign_in_ip :string
|
||||
# message_signature :text
|
||||
# name :string not null
|
||||
# otp_backup_codes :text
|
||||
# otp_required_for_login :boolean default(FALSE), not null
|
||||
# otp_secret :string
|
||||
# provider :string default("email"), not null
|
||||
# pubsub_token :string
|
||||
# remember_created_at :datetime
|
||||
# reset_password_sent_at :datetime
|
||||
# reset_password_token :string
|
||||
# sign_in_count :integer default(0), not null
|
||||
# tokens :json
|
||||
# type :string
|
||||
# ui_settings :jsonb
|
||||
# uid :string default(""), not null
|
||||
# unconfirmed_email :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_users_on_email (email)
|
||||
# index_users_on_otp_required_for_login (otp_required_for_login)
|
||||
# index_users_on_otp_secret (otp_secret) UNIQUE
|
||||
# index_users_on_pubsub_token (pubsub_token) UNIQUE
|
||||
# index_users_on_reset_password_token (reset_password_token) UNIQUE
|
||||
# index_users_on_uid_and_provider (uid,provider) UNIQUE
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
|
||||
@ -1,5 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: accounts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# auto_resolve_duration :integer
|
||||
# custom_attributes :jsonb
|
||||
# domain :string(100)
|
||||
# feature_flags :bigint default(0), not null
|
||||
# internal_attributes :jsonb not null
|
||||
# limits :jsonb
|
||||
# locale :integer default("en")
|
||||
# name :string not null
|
||||
# settings :jsonb
|
||||
# status :integer default("active")
|
||||
# support_email :string(100)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_accounts_on_status (status)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Account do
|
||||
|
||||
@ -1,5 +1,30 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: account_users
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# active_at :datetime
|
||||
# auto_offline :boolean default(TRUE), not null
|
||||
# availability :integer default("online"), not null
|
||||
# role :integer default("agent")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
# agent_capacity_policy_id :bigint
|
||||
# custom_role_id :bigint
|
||||
# inviter_id :bigint
|
||||
# user_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_account_users_on_account_id (account_id)
|
||||
# index_account_users_on_agent_capacity_policy_id (agent_capacity_policy_id)
|
||||
# index_account_users_on_custom_role_id (custom_role_id)
|
||||
# index_account_users_on_user_id (user_id)
|
||||
# uniq_user_id_per_account_id (account_id,user_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountUser do
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: agent_bot_inboxes
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# status :integer default("active")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer
|
||||
# agent_bot_id :integer
|
||||
# inbox_id :integer
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AgentBotInbox do
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: agent_bots
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# bot_config :jsonb
|
||||
# bot_type :integer default("webhook")
|
||||
# description :string
|
||||
# name :string
|
||||
# outgoing_url :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_agent_bots_on_account_id (account_id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/access_tokenable_shared.rb'
|
||||
require Rails.root.join 'spec/models/concerns/avatarable_shared.rb'
|
||||
|
||||
@ -1,3 +1,36 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# content :text
|
||||
# description :text
|
||||
# locale :string default("en"), not null
|
||||
# meta :jsonb
|
||||
# position :integer
|
||||
# slug :string not null
|
||||
# status :integer
|
||||
# title :string
|
||||
# views :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# associated_article_id :bigint
|
||||
# author_id :bigint
|
||||
# category_id :integer
|
||||
# folder_id :integer
|
||||
# portal_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_articles_on_account_id (account_id)
|
||||
# index_articles_on_associated_article_id (associated_article_id)
|
||||
# index_articles_on_author_id (author_id)
|
||||
# index_articles_on_portal_id (portal_id)
|
||||
# index_articles_on_slug (slug) UNIQUE
|
||||
# index_articles_on_status (status)
|
||||
# index_articles_on_views (views)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Article do
|
||||
|
||||
@ -1,3 +1,25 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: assignment_policies
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# assignment_order :integer default("round_robin"), not null
|
||||
# conversation_priority :integer default("earliest_created"), not null
|
||||
# description :text
|
||||
# enabled :boolean default(TRUE), not null
|
||||
# fair_distribution_limit :integer default(100), not null
|
||||
# fair_distribution_window :integer default(3600), not null
|
||||
# name :string(255) not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_assignment_policies_on_account_id (account_id)
|
||||
# index_assignment_policies_on_account_id_and_name (account_id,name) UNIQUE
|
||||
# index_assignment_policies_on_enabled (enabled)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AssignmentPolicy do
|
||||
|
||||
@ -1,3 +1,25 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: attachments
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# coordinates_lat :float default(0.0)
|
||||
# coordinates_long :float default(0.0)
|
||||
# extension :string
|
||||
# external_url :string
|
||||
# fallback_title :string
|
||||
# file_type :integer default("image")
|
||||
# meta :jsonb
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# message_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_attachments_on_account_id (account_id)
|
||||
# index_attachments_on_message_id (message_id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Attachment do
|
||||
|
||||
@ -1,3 +1,22 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: automation_rules
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# actions :jsonb not null
|
||||
# active :boolean default(TRUE), not null
|
||||
# conditions :jsonb not null
|
||||
# description :text
|
||||
# event_name :string not null
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_automation_rules_on_account_id (account_id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/reauthorizable_shared.rb'
|
||||
|
||||
|
||||
@ -1,5 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: campaigns
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# audience :jsonb
|
||||
# campaign_status :integer default("active"), not null
|
||||
# campaign_type :integer default("ongoing"), not null
|
||||
# description :text
|
||||
# enabled :boolean default(TRUE)
|
||||
# message :text not null
|
||||
# scheduled_at :datetime
|
||||
# template_params :jsonb
|
||||
# title :string not null
|
||||
# trigger_only_during_business_hours :boolean default(FALSE)
|
||||
# trigger_rules :jsonb
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# display_id :integer not null
|
||||
# inbox_id :bigint not null
|
||||
# sender_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_campaigns_on_account_id (account_id)
|
||||
# index_campaigns_on_campaign_status (campaign_status)
|
||||
# index_campaigns_on_campaign_type (campaign_type)
|
||||
# index_campaigns_on_inbox_id (inbox_id)
|
||||
# index_campaigns_on_scheduled_at (scheduled_at)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Campaign do
|
||||
|
||||
@ -1,3 +1,29 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: categories
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# description :text
|
||||
# icon :string default("")
|
||||
# locale :string default("en")
|
||||
# name :string
|
||||
# position :integer
|
||||
# slug :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# associated_category_id :bigint
|
||||
# parent_category_id :bigint
|
||||
# portal_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_categories_on_associated_category_id (associated_category_id)
|
||||
# index_categories_on_locale (locale)
|
||||
# index_categories_on_locale_and_account_id (locale,account_id)
|
||||
# index_categories_on_parent_category_id (parent_category_id)
|
||||
# index_categories_on_slug_and_locale_and_portal_id (slug,locale,portal_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Category do
|
||||
|
||||
@ -1,5 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_api
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# additional_attributes :jsonb
|
||||
# hmac_mandatory :boolean default(FALSE)
|
||||
# hmac_token :string
|
||||
# identifier :string
|
||||
# webhook_url :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_api_on_hmac_token (hmac_token) UNIQUE
|
||||
# index_channel_api_on_identifier (identifier) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Channel::Api do
|
||||
|
||||
@ -1,5 +1,40 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_email
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# email :string not null
|
||||
# forward_to_email :string not null
|
||||
# imap_address :string default("")
|
||||
# imap_enable_ssl :boolean default(TRUE)
|
||||
# imap_enabled :boolean default(FALSE)
|
||||
# imap_login :string default("")
|
||||
# imap_password :string default("")
|
||||
# imap_port :integer default(0)
|
||||
# provider :string
|
||||
# provider_config :jsonb
|
||||
# smtp_address :string default("")
|
||||
# smtp_authentication :string default("login")
|
||||
# smtp_domain :string default("")
|
||||
# smtp_enable_ssl_tls :boolean default(FALSE)
|
||||
# smtp_enable_starttls_auto :boolean default(TRUE)
|
||||
# smtp_enabled :boolean default(FALSE)
|
||||
# smtp_login :string default("")
|
||||
# smtp_openssl_verify_mode :string default("none")
|
||||
# smtp_password :string default("")
|
||||
# smtp_port :integer default(0)
|
||||
# verified_for_sending :boolean default(FALSE), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_email_on_email (email) UNIQUE
|
||||
# index_channel_email_on_forward_to_email (forward_to_email) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/reauthorizable_shared.rb'
|
||||
|
||||
|
||||
@ -1,5 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_facebook_pages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# page_access_token :string not null
|
||||
# user_access_token :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# instagram_id :string
|
||||
# page_id :string not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_facebook_pages_on_page_id (page_id)
|
||||
# index_channel_facebook_pages_on_page_id_and_account_id (page_id,account_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/reauthorizable_shared.rb'
|
||||
|
||||
|
||||
@ -1,5 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_instagram
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# access_token :string not null
|
||||
# expires_at :datetime not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# instagram_id :string not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_instagram_on_instagram_id (instagram_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/reauthorizable_shared.rb'
|
||||
|
||||
|
||||
@ -1,3 +1,18 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_telegram
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# bot_name :string
|
||||
# bot_token :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_telegram_on_bot_token (bot_token) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Channel::Telegram do
|
||||
|
||||
@ -1,5 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_twilio_sms
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# account_sid :string not null
|
||||
# api_key_sid :string
|
||||
# auth_token :string not null
|
||||
# content_templates :jsonb
|
||||
# content_templates_last_updated :datetime
|
||||
# medium :integer default("sms")
|
||||
# messaging_service_sid :string
|
||||
# phone_number :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_twilio_sms_on_account_sid_and_phone_number (account_sid,phone_number) UNIQUE
|
||||
# index_channel_twilio_sms_on_messaging_service_sid (messaging_service_sid) UNIQUE
|
||||
# index_channel_twilio_sms_on_phone_number (phone_number) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Channel::TwilioSms do
|
||||
|
||||
@ -1,5 +1,32 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_web_widgets
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# allowed_domains :text default("")
|
||||
# continuity_via_email :boolean default(TRUE), not null
|
||||
# feature_flags :integer default(7), not null
|
||||
# hmac_mandatory :boolean default(FALSE)
|
||||
# hmac_token :string
|
||||
# pre_chat_form_enabled :boolean default(FALSE)
|
||||
# pre_chat_form_options :jsonb
|
||||
# reply_time :integer default("in_a_few_minutes")
|
||||
# website_token :string
|
||||
# website_url :string
|
||||
# welcome_tagline :string
|
||||
# welcome_title :string
|
||||
# widget_color :string default("#1f93ff")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_web_widgets_on_hmac_token (hmac_token) UNIQUE
|
||||
# index_channel_web_widgets_on_website_token (website_token) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Channel::WebWidget do
|
||||
|
||||
@ -1,5 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: channel_whatsapp
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# message_templates :jsonb
|
||||
# message_templates_last_updated :datetime
|
||||
# phone_number :string not null
|
||||
# provider :string default("default")
|
||||
# provider_config :jsonb
|
||||
# wuzapi_admin_token :string
|
||||
# wuzapi_admin_token_iv :string
|
||||
# wuzapi_user_token :string
|
||||
# wuzapi_user_token_iv :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_channel_whatsapp_on_phone_number (phone_number) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/reauthorizable_shared.rb'
|
||||
|
||||
|
||||
@ -1,5 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: contact_inboxes
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# hmac_verified :boolean default(FALSE)
|
||||
# pubsub_token :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# contact_id :bigint
|
||||
# inbox_id :bigint
|
||||
# source_id :text not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_contact_inboxes_on_contact_id (contact_id)
|
||||
# index_contact_inboxes_on_inbox_id (inbox_id)
|
||||
# index_contact_inboxes_on_inbox_id_and_source_id (inbox_id,source_id) UNIQUE
|
||||
# index_contact_inboxes_on_pubsub_token (pubsub_token) UNIQUE
|
||||
# index_contact_inboxes_on_source_id (source_id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ContactInbox do
|
||||
|
||||
@ -1,5 +1,43 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: contacts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# additional_attributes :jsonb
|
||||
# blocked :boolean default(FALSE), not null
|
||||
# contact_type :integer default("visitor")
|
||||
# country_code :string default("")
|
||||
# custom_attributes :jsonb
|
||||
# email :string
|
||||
# identifier :string
|
||||
# last_activity_at :datetime
|
||||
# last_name :string default("")
|
||||
# location :string default("")
|
||||
# middle_name :string default("")
|
||||
# name :string default("")
|
||||
# phone_number :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# company_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_contacts_on_account_id (account_id)
|
||||
# index_contacts_on_account_id_and_contact_type (account_id,contact_type)
|
||||
# index_contacts_on_account_id_and_last_activity_at (account_id,last_activity_at DESC NULLS LAST)
|
||||
# index_contacts_on_blocked (blocked)
|
||||
# index_contacts_on_company_id (company_id)
|
||||
# index_contacts_on_lower_email_account_id (lower((email)::text), account_id)
|
||||
# index_contacts_on_name_email_phone_number_identifier (name,email,phone_number,identifier) USING gin
|
||||
# index_contacts_on_nonempty_fields (account_id,email,phone_number,identifier) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
||||
# index_contacts_on_phone_number_and_account_id (phone_number,account_id)
|
||||
# index_resolved_contact_account_id (account_id) WHERE (((email)::text <> ''::text) OR ((phone_number)::text <> ''::text) OR ((identifier)::text <> ''::text))
|
||||
# uniq_email_per_account_contact (email,account_id) UNIQUE
|
||||
# uniq_identifier_per_account_contact (identifier,account_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
require Rails.root.join 'spec/models/concerns/avatarable_shared.rb'
|
||||
|
||||
@ -1,5 +1,61 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: conversations
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# active_scenario_expires_at :datetime
|
||||
# active_scenario_key :string
|
||||
# active_scenario_state :jsonb not null
|
||||
# additional_attributes :jsonb
|
||||
# agent_last_seen_at :datetime
|
||||
# assignee_last_seen_at :datetime
|
||||
# cached_label_list :text
|
||||
# contact_last_seen_at :datetime
|
||||
# custom_attributes :jsonb
|
||||
# first_reply_created_at :datetime
|
||||
# identifier :string
|
||||
# last_activity_at :datetime not null
|
||||
# priority :integer
|
||||
# snoozed_until :datetime
|
||||
# status :integer default("open"), not null
|
||||
# uuid :uuid not null
|
||||
# waiting_since :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# assignee_agent_bot_id :bigint
|
||||
# assignee_id :integer
|
||||
# campaign_id :bigint
|
||||
# contact_id :bigint
|
||||
# contact_inbox_id :bigint
|
||||
# display_id :integer not null
|
||||
# inbox_id :integer not null
|
||||
# sla_policy_id :bigint
|
||||
# team_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# conv_acid_inbid_stat_asgnid_idx (account_id,inbox_id,status,assignee_id)
|
||||
# index_conversations_on_account_id (account_id)
|
||||
# index_conversations_on_account_id_and_display_id (account_id,display_id) UNIQUE
|
||||
# index_conversations_on_active_scenario_key (active_scenario_key)
|
||||
# index_conversations_on_assignee_id_and_account_id (assignee_id,account_id)
|
||||
# index_conversations_on_campaign_id (campaign_id)
|
||||
# index_conversations_on_contact_id (contact_id)
|
||||
# index_conversations_on_contact_inbox_id (contact_inbox_id)
|
||||
# index_conversations_on_first_reply_created_at (first_reply_created_at)
|
||||
# index_conversations_on_id_and_account_id (account_id,id)
|
||||
# index_conversations_on_identifier_and_account_id (identifier,account_id)
|
||||
# index_conversations_on_inbox_id (inbox_id)
|
||||
# index_conversations_on_priority (priority)
|
||||
# index_conversations_on_status_and_account_id (status,account_id)
|
||||
# index_conversations_on_status_and_priority (status,priority)
|
||||
# index_conversations_on_team_id (team_id)
|
||||
# index_conversations_on_uuid (uuid) UNIQUE
|
||||
# index_conversations_on_waiting_since (waiting_since)
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/assignment_handler_shared.rb'
|
||||
require Rails.root.join 'spec/models/concerns/auto_assignment_handler_shared.rb'
|
||||
|
||||
@ -1,3 +1,26 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: csat_survey_responses
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# feedback_message :text
|
||||
# rating :integer not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# assigned_agent_id :bigint
|
||||
# contact_id :bigint not null
|
||||
# conversation_id :bigint not null
|
||||
# message_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_csat_survey_responses_on_account_id (account_id)
|
||||
# index_csat_survey_responses_on_assigned_agent_id (assigned_agent_id)
|
||||
# index_csat_survey_responses_on_contact_id (contact_id)
|
||||
# index_csat_survey_responses_on_conversation_id (conversation_id)
|
||||
# index_csat_survey_responses_on_message_id (message_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CsatSurveyResponse do
|
||||
|
||||
@ -1,5 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: custom_attribute_definitions
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# attribute_description :text
|
||||
# attribute_display_name :string
|
||||
# attribute_display_type :integer default("text")
|
||||
# attribute_key :string
|
||||
# attribute_model :integer default("conversation_attribute")
|
||||
# attribute_values :jsonb
|
||||
# default_value :integer
|
||||
# regex_cue :string
|
||||
# regex_pattern :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# attribute_key_model_index (attribute_key,attribute_model,account_id) UNIQUE
|
||||
# index_custom_attribute_definitions_on_account_id (account_id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CustomAttributeDefinition do
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: data_imports
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# data_type :string not null
|
||||
# processed_records :integer
|
||||
# processing_errors :text
|
||||
# status :integer default("pending"), not null
|
||||
# total_records :integer
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_data_imports_on_account_id (account_id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DataImport do
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: folders
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# category_id :integer not null
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Folder do
|
||||
|
||||
@ -1,5 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: inbox_members
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# inbox_id :integer not null
|
||||
# user_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_inbox_members_on_inbox_id (inbox_id)
|
||||
# index_inbox_members_on_inbox_id_and_user_id (inbox_id,user_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe InboxMember do
|
||||
|
||||
@ -1,5 +1,44 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: inboxes
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# allow_messages_after_resolved :boolean default(TRUE)
|
||||
# auto_assignment_config :jsonb
|
||||
# auto_resolve_duration :integer
|
||||
# business_name :string
|
||||
# channel_type :string
|
||||
# csat_config :jsonb not null
|
||||
# csat_survey_enabled :boolean default(FALSE)
|
||||
# email_address :string
|
||||
# enable_auto_assignment :boolean default(TRUE)
|
||||
# enable_email_collect :boolean default(TRUE)
|
||||
# greeting_enabled :boolean default(FALSE)
|
||||
# greeting_message :string
|
||||
# lock_to_single_conversation :boolean default(FALSE), not null
|
||||
# name :string not null
|
||||
# out_of_office_message :string
|
||||
# sender_name_type :integer default("friendly"), not null
|
||||
# timezone :string default("UTC")
|
||||
# working_hours_enabled :boolean default(FALSE)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# channel_id :integer not null
|
||||
# portal_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_inboxes_on_account_id (account_id)
|
||||
# index_inboxes_on_channel_id_and_channel_type (channel_id,channel_type)
|
||||
# index_inboxes_on_portal_id (portal_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (portal_id => portals.id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/out_of_offisable_shared.rb'
|
||||
require Rails.root.join 'spec/models/concerns/avatarable_shared.rb'
|
||||
|
||||
@ -1,5 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: installation_configs
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# locked :boolean default(TRUE), not null
|
||||
# name :string not null
|
||||
# serialized_value :jsonb not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_installation_configs_on_name (name) UNIQUE
|
||||
# index_installation_configs_on_name_and_created_at (name,created_at) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe InstallationConfig do
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: integrations_hooks
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# access_token :string
|
||||
# hook_type :integer default("account")
|
||||
# settings :jsonb
|
||||
# status :integer default("enabled")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer
|
||||
# app_id :string
|
||||
# inbox_id :integer
|
||||
# reference_id :string
|
||||
#
|
||||
require 'rails_helper'
|
||||
require Rails.root.join 'spec/models/concerns/reauthorizable_shared.rb'
|
||||
|
||||
|
||||
@ -1,3 +1,31 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: jasmine_inbox_collections
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# is_enabled :boolean default(TRUE)
|
||||
# priority :integer default(0)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# collection_id :bigint not null
|
||||
# inbox_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# idx_on_account_id_collection_id_3011aaebad (account_id,collection_id)
|
||||
# index_jasmine_inbox_collections_on_account_id (account_id)
|
||||
# index_jasmine_inbox_collections_on_account_id_and_inbox_id (account_id,inbox_id)
|
||||
# index_jasmine_inbox_collections_on_collection_id (collection_id)
|
||||
# index_jasmine_inbox_collections_on_inbox_id (inbox_id)
|
||||
# index_jasmine_inbox_collections_uniqueness (account_id,inbox_id,collection_id) UNIQUE
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (account_id => accounts.id)
|
||||
# fk_rails_... (collection_id => jasmine_collections.id)
|
||||
# fk_rails_... (inbox_id => inboxes.id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Jasmine::InboxCollection do
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: labels
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# color :string default("#1f93ff"), not null
|
||||
# description :text
|
||||
# show_on_sidebar :boolean
|
||||
# title :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_labels_on_account_id (account_id)
|
||||
# index_labels_on_title_and_account_id (title,account_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Label do
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: macros
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# actions :jsonb not null
|
||||
# name :string not null
|
||||
# visibility :integer default("personal")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# created_by_id :bigint
|
||||
# updated_by_id :bigint
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_macros_on_account_id (account_id)
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Macro do
|
||||
|
||||
@ -1,5 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: mentions
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# mentioned_at :datetime not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# conversation_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_mentions_on_account_id (account_id)
|
||||
# index_mentions_on_conversation_id (conversation_id)
|
||||
# index_mentions_on_user_id (user_id)
|
||||
# index_mentions_on_user_id_and_conversation_id (user_id,conversation_id) UNIQUE
|
||||
#
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Mention do
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user