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

base_update.rb « lists « boards « mutations « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7962d9c85d484eba1cbc7518997e047d0a72007c (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
36
37
38
39
40
# frozen_string_literal: true

module Mutations
  module Boards
    module Lists
      class BaseUpdate < BaseMutation
        argument :position, GraphQL::Types::Int,
                  required: false,
                  description: 'Position of list within the board.'

        argument :collapsed, GraphQL::Types::Boolean,
                  required: false,
                  description: 'Indicates if the list is collapsed for this user.'

        def resolve(list: nil, **args)
          if list.nil? || !can_read_list?(list)
            raise_resource_not_available_error!
          end

          update_result = update_list(list, args)

          {
            list: update_result.payload[:list],
            errors: update_result.errors
          }
        end

        private

        def update_list(list, args)
          raise NotImplementedError
        end

        def can_read_list?(list)
          raise NotImplementedError
        end
      end
    end
  end
end