feat: Add APIs to create custom views on the dashboard (#2498)
This commit is contained in:
@@ -59,6 +59,7 @@ class Account < ApplicationRecord
|
||||
has_many :kbase_categories, dependent: :destroy, class_name: '::Kbase::Category'
|
||||
has_many :kbase_articles, dependent: :destroy, class_name: '::Kbase::Article'
|
||||
has_many :teams, dependent: :destroy
|
||||
has_many :custom_filters, dependent: :destroy
|
||||
has_flags ACCOUNT_SETTINGS_FLAGS.merge(column: 'settings_flags').merge(DEFAULT_QUERY_SETTING)
|
||||
|
||||
enum locale: LANGUAGES_CONFIG.map { |key, val| [val[:iso_639_1_code], key] }.to_h
|
||||
|
||||
24
app/models/custom_filter.rb
Normal file
24
app/models/custom_filter.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: custom_filters
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# filter_type :integer default("conversation"), not null
|
||||
# name :string not null
|
||||
# query :jsonb not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :bigint not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_custom_filters_on_account_id (account_id)
|
||||
# index_custom_filters_on_user_id (user_id)
|
||||
#
|
||||
class CustomFilter < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :account
|
||||
|
||||
enum filter_type: { conversation: 0, contact: 1, report: 2 }
|
||||
end
|
||||
@@ -83,6 +83,7 @@ class User < ApplicationRecord
|
||||
has_many :team_members, dependent: :destroy
|
||||
has_many :teams, through: :team_members
|
||||
has_many :notes, dependent: :nullify
|
||||
has_many :custom_filters, dependent: :destroy
|
||||
|
||||
before_validation :set_password_and_uid, on: :create
|
||||
|
||||
|
||||
Reference in New Issue
Block a user