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

abuse_report_resolver.rb « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 770409601b92b8c8789ca12c2e346e96c11ef968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Resolvers
  class AbuseReportResolver < BaseResolver
    description 'Retrieve an abuse report'

    type Types::AbuseReportType, null: true

    argument :id, Types::GlobalIDType[AbuseReport], required: true, description: 'ID of the abuse report.'

    def resolve(id:)
      ::AbuseReport.find_by_id(extract_abuse_report_id(id))
    end

    private

    def extract_abuse_report_id(gid)
      GitlabSchema.parse_gid(gid, expected_type: ::AbuseReport).model_id
    end
  end
end