discourse/plugins/chat/app/models/incoming_chat_webhook.rb
Roman Rizzi 0a5f548635
DEV: Move discourse-chat to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
2022-11-02 10:41:30 -03:00

32 lines
796 B
Ruby

# frozen_string_literal: true
class IncomingChatWebhook < ActiveRecord::Base
belongs_to :chat_channel
has_many :chat_webhook_events
before_create { self.key = SecureRandom.hex(12) }
def url
"#{Discourse.base_url}/chat/hooks/#{key}.json"
end
end
# == Schema Information
#
# Table name: incoming_chat_webhooks
#
# id :bigint not null, primary key
# name :string not null
# key :string not null
# chat_channel_id :integer not null
# username :string
# description :string
# emoji :string
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_incoming_chat_webhooks_on_key_and_chat_channel_id (key,chat_channel_id)
#