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,36 @@
# == 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)
#
class Note < ApplicationRecord
before_validation :ensure_account_id
validates :content, presence: true
validates :account_id, presence: true
validates :contact_id, presence: true
belongs_to :account
belongs_to :contact
belongs_to :user, optional: true
scope :latest, -> { order(created_at: :desc) }
private
def ensure_account_id
self.account_id = contact&.account_id
end
end