-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from hsong-rh/add_relations_in_swagger
Add relations into swagger file
- Loading branch information
Showing
8 changed files
with
173 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module ApproverOperationsMixin | ||
extend ActiveSupport::Concern | ||
|
||
def add_action | ||
stage = Stage.find(params[:stage_id]) | ||
action = stage.actions.create!(action_params) | ||
|
||
json_response(action, :created) | ||
end | ||
|
||
def fetch_action_by_id | ||
action = Action.find(params[:id]) | ||
|
||
json_response(action) | ||
end | ||
|
||
def fetch_actions | ||
actions = Action.all | ||
|
||
json_response(actions) | ||
end | ||
|
||
def fetch_stage_by_id | ||
stage = Stage.find(params[:id]) | ||
|
||
json_response(stage) | ||
end | ||
|
||
def remove_action | ||
Action.find(params[:id]).destroy | ||
|
||
head :no_content | ||
end | ||
|
||
def update_action | ||
Action.find(params[:id]).update(action_params) | ||
|
||
head :no_content | ||
end | ||
|
||
def update_stage | ||
StageUpdateService.new(params[:id]).update(stage_params) | ||
head :no_content | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module UserOperationsMixin | ||
extend ActiveSupport::Concern | ||
|
||
def add_request | ||
req = RequestCreateService.new(params[:workflow_id]).create(request_params) | ||
json_response(req, :created) | ||
end | ||
|
||
def fetch_request_by_id | ||
req = Request.find(params[:id]) | ||
json_response(req) | ||
end | ||
|
||
def fetch_request_stages | ||
req = Request.find(params[:request_id]) | ||
|
||
json_response(req.stages) | ||
end | ||
|
||
private | ||
|
||
def request_params | ||
params.permit(:name, :decision, :state, :requester, :content) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.