feat: Portal endpoint (#4633)
This commit is contained in:
@@ -51,9 +51,9 @@ class Account < ApplicationRecord
|
||||
has_many :facebook_pages, dependent: :destroy_async, class_name: '::Channel::FacebookPage'
|
||||
has_many :hooks, dependent: :destroy_async, class_name: 'Integrations::Hook'
|
||||
has_many :inboxes, dependent: :destroy_async
|
||||
has_many :kbase_articles, dependent: :destroy_async, class_name: '::Kbase::Article'
|
||||
has_many :kbase_categories, dependent: :destroy_async, class_name: '::Kbase::Category'
|
||||
has_many :kbase_portals, dependent: :destroy_async, class_name: '::Kbase::Portal'
|
||||
has_many :articles, dependent: :destroy_async, class_name: '::Article'
|
||||
has_many :categories, dependent: :destroy_async, class_name: '::Category'
|
||||
has_many :portals, dependent: :destroy_async, class_name: '::Portal'
|
||||
has_many :labels, dependent: :destroy_async
|
||||
has_many :line_channels, dependent: :destroy_async, class_name: '::Channel::Line'
|
||||
has_many :mentions, dependent: :destroy_async
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: kbase_articles
|
||||
# Table name: articles
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# content :text
|
||||
@@ -16,7 +16,7 @@
|
||||
# folder_id :integer
|
||||
# portal_id :integer not null
|
||||
#
|
||||
class Kbase::Article < ApplicationRecord
|
||||
class Article < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :category
|
||||
belongs_to :portal
|
||||
@@ -1,6 +1,6 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: kbase_categories
|
||||
# Table name: categories
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# description :text
|
||||
@@ -14,9 +14,10 @@
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_kbase_categories_on_locale_and_account_id (locale,account_id)
|
||||
# index_categories_on_locale (locale)
|
||||
# index_categories_on_locale_and_account_id (locale,account_id)
|
||||
#
|
||||
class Kbase::Category < ApplicationRecord
|
||||
class Category < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :portal
|
||||
has_many :folders, dependent: :destroy_async
|
||||
@@ -1,6 +1,6 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: kbase_folders
|
||||
# Table name: folders
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string
|
||||
@@ -9,7 +9,7 @@
|
||||
# account_id :integer not null
|
||||
# category_id :integer not null
|
||||
#
|
||||
class Kbase::Folder < ApplicationRecord
|
||||
class Folder < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :category
|
||||
has_many :articles, dependent: :nullify
|
||||
@@ -1,8 +1,9 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: kbase_portals
|
||||
# Table name: portals
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# archived :boolean default(FALSE)
|
||||
# color :string
|
||||
# config :jsonb
|
||||
# custom_domain :string
|
||||
@@ -17,13 +18,14 @@
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_kbase_portals_on_slug (slug) UNIQUE
|
||||
# index_portals_on_slug (slug) UNIQUE
|
||||
#
|
||||
class Kbase::Portal < ApplicationRecord
|
||||
class Portal < ApplicationRecord
|
||||
belongs_to :account
|
||||
has_many :categories, dependent: :destroy_async
|
||||
has_many :folders, through: :categories
|
||||
has_many :articles, dependent: :destroy_async
|
||||
has_many :users, through: :portals_members
|
||||
|
||||
validates :account_id, presence: true
|
||||
validates :name, presence: true
|
||||
@@ -90,6 +90,7 @@ class User < ApplicationRecord
|
||||
has_many :notifications, dependent: :destroy_async
|
||||
has_many :team_members, dependent: :destroy_async
|
||||
has_many :teams, through: :team_members
|
||||
has_many :portals, through: :portals_members
|
||||
|
||||
before_validation :set_password_and_uid, on: :create
|
||||
|
||||
|
||||
Reference in New Issue
Block a user