Commit c3880d10 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre 🌴

Extract `Projects::Boards::ApplicationController`

parent 57737785
module Projects
module Boards
class ApplicationController < Projects::ApplicationController
respond_to :json
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
private
def record_not_found(exception)
render json: { error: exception.message }, status: :not_found
end
end
end
end
module Projects
module Boards
class IssuesController < Projects::ApplicationController
respond_to :json
class IssuesController < Boards::ApplicationController
before_action :authorize_read_issue!, only: [:index]
before_action :authorize_update_issue!, only: [:update]
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
def index
issues = ::Boards::Issues::ListService.new(project, current_user, filter_params).execute
issues = issues.page(params[:page])
......@@ -47,10 +43,6 @@ module Projects
def move_params
params.permit(:id, :from_list_id, :to_list_id)
end
def record_not_found(exception)
render json: { error: exception.message }, status: :not_found
end
end
end
end
module Projects
module Boards
class ListsController < Projects::ApplicationController
respond_to :json
class ListsController < Boards::ApplicationController
before_action :authorize_admin_list!
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
def create
list = ::Boards::Lists::CreateService.new(project, current_user, list_params).execute
......@@ -60,10 +56,6 @@ module Projects
def move_params
params.require(:list).permit(:position).merge(id: params[:id])
end
def record_not_found(exception)
render json: { error: exception.message }, status: :not_found
end
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment