feat: Fetching the portal data related to a specific custom domain (#5249)

This commit is contained in:
Tejaswini Chile
2022-09-07 12:22:24 +05:30
committed by GitHub
parent 6574407636
commit db73d033b7
11 changed files with 74 additions and 35 deletions

View File

@@ -1,5 +1,7 @@
class Public::Api::V1::Portals::ArticlesController < ApplicationController
class Public::Api::V1::Portals::ArticlesController < PublicController
before_action :ensure_custom_domain_request, only: [:show, :index]
before_action :set_portal
before_action :set_category
before_action :set_article, only: [:show]
def index
@@ -12,11 +14,15 @@ class Public::Api::V1::Portals::ArticlesController < ApplicationController
private
def set_article
@article = @portal.articles.find(params[:id])
@article = @category.articles.find(params[:id])
end
def set_category
@category = @portal.categories.find_by!(slug: params[:category_slug])
end
def set_portal
@portal = ::Portal.find_by!(slug: params[:portal_slug], archived: false)
@portal = @portals.find_by!(slug: params[:slug], archived: false)
end
def list_params