Skip to content

Commit

Permalink
Add StagingController
Browse files Browse the repository at this point in the history
we created this method to not repeat and have different methods to do the same.
  • Loading branch information
David Kang committed Oct 11, 2019
1 parent 1d48d16 commit 4a2eedb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/api/app/controllers/staging/staging_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module Staging
class StagingController < ApplicationController
private

def set_project
@project = Project.get_by_name(params[:staging_workflow_project])
rescue Project::UnknownObjectError
render_error(
status: 404,
errorcode: 'not_found',
message: "Project '#{params[:staging_workflow_project]}' not found."
)
end

def set_staging_workflow
@staging_workflow = @project.staging
return if @staging_workflow

render_error(
status: 404,
errorcode: 'not_found',
message: "Project #{@project} doesn't have an asociated Staging Workflow"
)
end
end
end

0 comments on commit 4a2eedb

Please sign in to comment.