Welcome to mirror list, hosted at ThFree Co, Russian Federation.

board_list_resolver.rb « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d853846b674ec88c787e234c82be725d14378fa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

module Resolvers
  class BoardListResolver < BaseResolver.single
    include Gitlab::Graphql::Authorize::AuthorizeResource
    include BoardItemFilterable

    type Types::BoardListType, null: true
    description 'Find an issue board list.'

    authorize :read_issue_board_list

    argument :id, Types::GlobalIDType[List],
             required: true,
             description: 'Global ID of the list.'

    argument :issue_filters, Types::Boards::BoardIssueInputType,
             required: false,
             description: 'Filters applied when getting issue metadata in the board list.'

    def resolve(id: nil, issue_filters: {})
      context.scoped_set!(:issue_filters, item_filters(issue_filters))

      Gitlab::Graphql::Lazy.with_value(find_list(id: id)) do |list|
        list if authorized_resource?(list)
      end
    end

    private

    def find_list(id:)
      GitlabSchema.object_from_id(id, expected_type: ::List)
    end
  end
end