blob: 4146bf8fdc8c84c04d262569713bacca3c1463b7 (
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
|
# frozen_string_literal: true
module Mutations
module ResolvesIssuable
extend ActiveSupport::Concern
include Mutations::ResolvesProject
def resolve_issuable(type:, parent_path:, iid:)
parent = resolve_issuable_parent(parent_path)
issuable_resolver(type, parent, context).resolve(iid: iid.to_s)
end
def issuable_resolver(type, parent, context)
resolver_class = "Resolvers::#{type.to_s.classify.pluralize}Resolver".constantize
resolver_class.single.new(object: parent, context: context)
end
def resolve_issuable_parent(parent_path)
resolve_project(full_path: parent_path)
end
end
end
|