add filters to maintainers list api
This commit is contained in:
parent
0545863642
commit
5899d5f28f
|
@ -5,6 +5,9 @@ class Api::V1::MaintainersController < Api::V1::BaseController
|
|||
def index
|
||||
@maintainers = BuildList::Package.actual.by_platform(@platform)
|
||||
.includes(:project)
|
||||
.paginate(paginate_params)
|
||||
if name = params[:filter].try(:[], :package_name)
|
||||
@maintainers = @maintainers.like_name(name)
|
||||
end
|
||||
@maintainers = @maintainers.paginate(paginate_params)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class Platforms::MaintainersController < ApplicationController
|
|||
def index
|
||||
@maintainers = BuildList::Package.actual.by_platform(@platform)
|
||||
.includes(:project)
|
||||
@maintainers = @maintainers.where('name ILIKE ?', "%#{params[:q]}%") if params[:q].present?
|
||||
@maintainers = @maintainers.like_name(params[:q]) if params[:q].present?
|
||||
@maintainers = @maintainers.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ class BuildList::Package < ActiveRecord::Base
|
|||
scope :by_platform, lambda {|platform| where(:platform_id => platform) }
|
||||
scope :by_name, lambda {|name| where(:name => name) }
|
||||
scope :by_package_type, lambda {|type| where(:package_type => type) }
|
||||
scope :like_name, lambda {|name| where('name ILIKE ?', "%#{name}%")}
|
||||
|
||||
def assignee
|
||||
project.maintainer
|
||||
|
|
Loading…
Reference in New Issue