# frozen_string_literal: true
module ESM
class CommunityDefault < ApplicationRecord
# =============================================================================
# INITIALIZE
# =============================================================================
# =============================================================================
# DATA STRUCTURE
# =============================================================================
attribute :community_id, :integer
attribute :server_id, :integer
attribute :channel_id, :string
attribute :created_at, :datetime
attribute :updated_at, :datetime
# =============================================================================
# ASSOCIATIONS
# =============================================================================
belongs_to :community
belongs_to :server
# =============================================================================
# VALIDATIONS
# =============================================================================
# =============================================================================
# CALLBACKS
# =============================================================================
# =============================================================================
# SCOPES
# =============================================================================
# =============================================================================
# CLASS METHODS
# =============================================================================
def self.global
where(channel_id: nil).first
end
def self.for_channel(channel)
where(channel_id: channel.id.to_s).first
end
# =============================================================================
# INSTANCE METHODS
# =============================================================================
end
end