Restructure omni services and add Chatwoot research snapshot

This commit is contained in:
Ruslan Bakiev
2026-02-21 11:11:27 +07:00
parent edea7a0034
commit b73babbbf6
7732 changed files with 978203 additions and 32 deletions

View File

@@ -0,0 +1,44 @@
# == 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
#
class Channel::Api < ApplicationRecord
include Channelable
self.table_name = 'channel_api'
EDITABLE_ATTRS = [:webhook_url, :hmac_mandatory, { additional_attributes: {} }].freeze
has_secure_token :identifier
has_secure_token :hmac_token
validate :ensure_valid_agent_reply_time_window
validates :webhook_url, length: { maximum: Limits::URL_LENGTH_LIMIT }
def name
'API'
end
private
def ensure_valid_agent_reply_time_window
return if additional_attributes['agent_reply_time_window'].blank?
return if additional_attributes['agent_reply_time_window'].to_i.positive?
errors.add(:agent_reply_time_window, 'agent_reply_time_window must be greater than 0')
end
end