blob: 0d1b204a4c1ade0f0e4961f74dda78258fa815a5 (
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
|
# frozen_string_literal: true
module Mutations
module Organizations
class Create < BaseMutation
graphql_name 'OrganizationCreate'
authorize :create_organization
field :organization,
::Types::Organizations::OrganizationType,
null: true,
description: 'Organization created.'
argument :name, GraphQL::Types::String,
required: true,
description: 'Name for the organization.'
argument :path, GraphQL::Types::String,
required: true,
description: 'Path for the organization.'
def resolve(args)
authorize!(:global)
result = ::Organizations::CreateService.new(
current_user: current_user,
params: args
).execute
{ organization: result.payload, errors: result.errors }
end
end
end
end
|