feat: Portal endpoint (#4633)

This commit is contained in:
Tejaswini Chile
2022-05-16 13:59:59 +05:30
committed by GitHub
parent 6535624cd6
commit 938fb887c4
39 changed files with 198 additions and 132 deletions

View File

@@ -0,0 +1,5 @@
class ChangeKbasePortalsToPortals < ActiveRecord::Migration[6.1]
def change
rename_table :kbase_portals, :portals
end
end

View File

@@ -0,0 +1,9 @@
class CreatePortalsMembersJoinTable < ActiveRecord::Migration[6.1]
def change
create_join_table :portals, :users, table_name: :portals_members do |t|
t.index :portal_id
t.index :user_id
t.index [:portal_id, :user_id], unique: true
end
end
end

View File

@@ -0,0 +1,5 @@
class ChangeKbaseCategoriesToCategories < ActiveRecord::Migration[6.1]
def change
rename_table :kbase_categories, :categories
end
end

View File

@@ -0,0 +1,5 @@
class ChangeKbaseFoldersToFolders < ActiveRecord::Migration[6.1]
def change
rename_table :kbase_folders, :folders
end
end

View File

@@ -0,0 +1,5 @@
class ChangeKbaseArticlesToArticles < ActiveRecord::Migration[6.1]
def change
rename_table :kbase_articles, :articles
end
end

View File

@@ -0,0 +1,5 @@
class AddArchiveColumnToPortal < ActiveRecord::Migration[6.1]
def change
add_column :portals, :archived, :boolean, default: false
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2022_05_06_163839) do
ActiveRecord::Schema.define(version: 2022_05_11_072655) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
@@ -111,6 +111,21 @@ ActiveRecord::Schema.define(version: 2022_05_06_163839) do
t.index ["account_id"], name: "index_agent_bots_on_account_id"
end
create_table "articles", force: :cascade do |t|
t.integer "account_id", null: false
t.integer "portal_id", null: false
t.integer "category_id"
t.integer "folder_id"
t.integer "author_id"
t.string "title"
t.text "description"
t.text "content"
t.integer "status"
t.integer "views"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "attachments", id: :serial, force: :cascade do |t|
t.integer "file_type", default: 0
t.string "external_url"
@@ -169,6 +184,19 @@ ActiveRecord::Schema.define(version: 2022_05_06_163839) do
t.datetime "updated_at", null: false
end
create_table "categories", force: :cascade do |t|
t.integer "account_id", null: false
t.integer "portal_id", null: false
t.string "name"
t.text "description"
t.integer "position"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.string "locale", default: "en"
t.index ["locale", "account_id"], name: "index_categories_on_locale_and_account_id"
t.index ["locale"], name: "index_categories_on_locale"
end
create_table "channel_api", force: :cascade do |t|
t.integer "account_id", null: false
t.string "webhook_url"
@@ -434,6 +462,14 @@ ActiveRecord::Schema.define(version: 2022_05_06_163839) do
t.index ["name", "account_id"], name: "index_email_templates_on_name_and_account_id", unique: true
end
create_table "folders", force: :cascade do |t|
t.integer "account_id", null: false
t.integer "category_id", null: false
t.string "name"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "inbox_members", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
t.integer "inbox_id", null: false
@@ -486,56 +522,6 @@ ActiveRecord::Schema.define(version: 2022_05_06_163839) do
t.jsonb "settings", default: {}
end
create_table "kbase_articles", force: :cascade do |t|
t.integer "account_id", null: false
t.integer "portal_id", null: false
t.integer "category_id"
t.integer "folder_id"
t.integer "author_id"
t.string "title"
t.text "description"
t.text "content"
t.integer "status"
t.integer "views"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "kbase_categories", force: :cascade do |t|
t.integer "account_id", null: false
t.integer "portal_id", null: false
t.string "name"
t.text "description"
t.integer "position"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.string "locale", default: "en"
t.index ["locale", "account_id"], name: "index_kbase_categories_on_locale_and_account_id"
end
create_table "kbase_folders", force: :cascade do |t|
t.integer "account_id", null: false
t.integer "category_id", null: false
t.string "name"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
create_table "kbase_portals", force: :cascade do |t|
t.integer "account_id", null: false
t.string "name", null: false
t.string "slug", null: false
t.string "custom_domain"
t.string "color"
t.string "homepage_link"
t.string "page_title"
t.text "header_text"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.jsonb "config", default: {"allowed_locales"=>["en"]}
t.index ["slug"], name: "index_kbase_portals_on_slug", unique: true
end
create_table "labels", force: :cascade do |t|
t.string "title"
t.text "description"
@@ -653,6 +639,30 @@ ActiveRecord::Schema.define(version: 2022_05_06_163839) do
t.datetime "updated_at", precision: 6, null: false
end
create_table "portals", force: :cascade do |t|
t.integer "account_id", null: false
t.string "name", null: false
t.string "slug", null: false
t.string "custom_domain"
t.string "color"
t.string "homepage_link"
t.string "page_title"
t.text "header_text"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.jsonb "config", default: {"allowed_locales"=>["en"]}
t.boolean "archived", default: false
t.index ["slug"], name: "index_portals_on_slug", unique: true
end
create_table "portals_members", id: false, force: :cascade do |t|
t.bigint "portal_id", null: false
t.bigint "user_id", null: false
t.index ["portal_id", "user_id"], name: "index_portals_members_on_portal_id_and_user_id", unique: true
t.index ["portal_id"], name: "index_portals_members_on_portal_id"
t.index ["user_id"], name: "index_portals_members_on_user_id"
end
create_table "reporting_events", force: :cascade do |t|
t.string "name"
t.float "value"