Skip to content

Commit

Permalink
Fixes #24358 - filter cv filter rules by name and errata_id
Browse files Browse the repository at this point in the history
  • Loading branch information
sean797 authored and jlsherrill committed Jul 26, 2018
1 parent 5c41cef commit d24c501
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ class Api::V2::ContentViewFilterRulesController < Api::V2::ApiController

api :GET, "/content_view_filters/:content_view_filter_id/rules", N_("List filter rules")
param :content_view_filter_id, :number, :desc => N_("filter identifier"), :required => true
param :name, String, :desc => N_("name of the content view filter rule"), :required => false
param :errata_id, String, :desc => N_("errata_id of the content view filter rule"), :required => false
param_group :search, Api::V2::ApiController
def index
respond(collection: scoped_search(index_relation, :id, :asc, resource_class: ContentViewFilter.rule_class_for(@filter)))
end

def index_relation
query = ContentViewFilter.rule_class_for(@filter).where(content_view_filter_id: @filter.id)
query = query.where(:name => params[:name]) if params[:name]
query = query.where(:errata_id => params[:errata_id]) if params[:errata_id]
query
end

Expand Down

0 comments on commit d24c501

Please sign in to comment.