feat: Portal and Category public APIs (#4946)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
class Public::Api::V1::Portals::CategoriesController < PublicController
|
||||
before_action :set_portal
|
||||
before_action :set_category, only: [:show]
|
||||
|
||||
def index
|
||||
@categories = @portal.categories
|
||||
end
|
||||
|
||||
def show; end
|
||||
|
||||
private
|
||||
|
||||
def set_category
|
||||
@category = @portal.categories.find_by!(slug: params[:slug])
|
||||
end
|
||||
|
||||
def set_portal
|
||||
@portal = ::Portal.find_by!(slug: params[:portal_slug], archived: false)
|
||||
end
|
||||
end
|
||||
11
app/controllers/public/api/v1/portals_controller.rb
Normal file
11
app/controllers/public/api/v1/portals_controller.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class Public::Api::V1::PortalsController < PublicController
|
||||
before_action :set_portal
|
||||
|
||||
def show; end
|
||||
|
||||
private
|
||||
|
||||
def set_portal
|
||||
@portal = ::Portal.find_by!(slug: params[:slug], archived: false)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user