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

update_diff_image_position_input_type.rb « notes « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1b915b65ae9fdccfbb92ab7ec673071dd14a0308 (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
# frozen_string_literal: true

module Types
  module Notes
    # InputType used for updateImageDiffNote mutation.
    #
    # rubocop: disable Graphql/AuthorizeTypes
    class UpdateDiffImagePositionInputType < BaseInputObject
      graphql_name 'UpdateDiffImagePositionInput'

      argument :x, GraphQL::INT_TYPE,
               required: false,
               description: copy_field_description(Types::Notes::DiffPositionType, :x)

      argument :y, GraphQL::INT_TYPE,
               required: false,
               description: copy_field_description(Types::Notes::DiffPositionType, :y)

      argument :width, GraphQL::INT_TYPE,
               required: false,
               description: copy_field_description(Types::Notes::DiffPositionType, :width)

      argument :height, GraphQL::INT_TYPE,
               required: false,
               description: copy_field_description(Types::Notes::DiffPositionType, :height)

      def prepare
        to_h.compact.tap do |properties|
          if properties.empty?
            raise GraphQL::ExecutionError, "At least one property of `#{self.class.graphql_name}` must be set"
          end
        end
      end
    end
    # rubocop: enable Graphql/AuthorizeTypes
  end
end