feat: Add APIs to create custom views on the dashboard (#2498)

This commit is contained in:
Pranav Raj S
2021-06-29 19:29:57 +05:30
committed by GitHub
parent fa37f8e185
commit 30832d8a34
27 changed files with 654 additions and 9 deletions

View File

@@ -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

View 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

View File

@@ -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