Chatwoot/app/controllers/api/v1/accounts/kbase/portals_controller.rb
Subin T P 701eccb35c
Feature: Knowledge Base APIs (#1002)
- Introduce models & migrations for portals, categories, folders and articles
- CRUD API for portals
- CRUD API for categories

Addresses: #714

Co-authored-by: Sojan <sojan@pepalo.com>
2020-09-26 02:32:34 +05:30

32 lines
681 B
Ruby

class Api::V1::Accounts::Kbase::PortalsController < Api::V1::Accounts::Kbase::BaseController
before_action :fetch_portal, except: [:index, :create]
def index
@portals = Current.account.kbase_portals
end
def create
@portal = Current.account.kbase_portals.create!(portal_params)
end
def update
@portal.update!(portal_params)
end
def destroy
@portal.destroy
head :ok
end
private
def fetch_portal
@portal = current_account.kbase_portals.find(params[:id])
end
def portal_params
params.require(:portal).permit(
:account_id, :color, :custom_domain, :header_text, :homepage_link, :name, :page_title, :slug
)
end
end