Chatwoot/app/models/notification_setting.rb
Sojan Jose 941fbb0d72
Chore: Web widget Inbox Tech Debts (#738)
* Chore: Webwidget Inbox Tech Debts

* Additional customization options creating Web Widget
* Changes to edit Page for Web Widget
* Remove the WebWidget API end points
* Minor chores

Address: #680, #502

Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
2020-04-19 23:40:28 +05:30

34 lines
804 B
Ruby

# == Schema Information
#
# Table name: notification_settings
#
# id :bigint not null, primary key
# email_flags :integer default(0), not null
# created_at :datetime not null
# updated_at :datetime not null
# account_id :integer
# user_id :integer
#
# Indexes
#
# by_account_user (account_id,user_id) UNIQUE
#
class NotificationSetting < ApplicationRecord
# used for single column multi flags
include FlagShihTzu
belongs_to :account
belongs_to :user
DEFAULT_QUERY_SETTING = {
flag_query_mode: :bit_operator
}.freeze
EMAIL_NOTIFICATION_FLAGS = {
1 => :conversation_creation,
2 => :conversation_assignment
}.freeze
has_flags EMAIL_NOTIFICATION_FLAGS.merge(column: 'email_flags').merge(DEFAULT_QUERY_SETTING)
end