summaryrefslogtreecommitdiff
path: root/app/services/search/snippet_service.rb
blob: 8ca0877321d759efbb7e1e9ec1f3aba6a5b45ac6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Search
  class SnippetService
    attr_accessor :current_user, :params

    def initialize(user, params)
      @current_user, @params = user, params.dup
    end

    def execute
      snippet_ids = Snippet.accessible_to(current_user).pluck(:id)
      Gitlab::SnippetSearchResults.new(snippet_ids, params[:search])
    end
  end
end