blob: 7f934e101c818b239db53f61f60ff2c60f2d71ea (
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
|
# frozen_string_literal: true
module Mutations
module Ci
module Catalog
module Resources
class Create < BaseMutation
graphql_name 'CatalogResourcesCreate'
argument :project_path, GraphQL::Types::ID,
required: true,
description: 'Project to convert to a catalog resource.'
authorize :add_catalog_resource
def resolve(project_path:)
project = authorized_find!(project_path: project_path)
response = ::Ci::Catalog::Resources::CreateService.new(project, current_user).execute
errors = response.success? ? [] : [response.message]
{
errors: errors
}
end
private
def find_object(project_path:)
Project.find_by_full_path(project_path)
end
end
end
end
end
end
|