Skip to content

Commit

Permalink
add external_service parameter to thread API
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Dec 14, 2017
1 parent b84da88 commit 9f6d9b0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/api/route/thread_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ThreadApi < Base
optional :issue_id, type: Integer, desc: 'ID of issue'
optional :order_by, type: Symbol, values:%i( created_at id ), desc: 'Order of returned issues.'
optional :order, type: Symbol, values:%i(asc desc), default: :asc
optional :external_service, type: String, desc: 'Filter by external service short name'
end

helpers do
Expand All @@ -19,6 +20,7 @@ def post_or_get_thread
end
scope = scope.order(params[:order_by] => params[:order]) if params[:order_by]
scope = scope.where(issue_id: params[:issue_id]) if params[:issue_id]
scope = scope.joins(:external_service).where('external_services.short_name' => params[:external_service]) if params[:external_service]
scope = paginate scope
end
end
Expand Down

0 comments on commit 9f6d9b0

Please sign in to comment.