blob: 0b510b44b4ef37d89ce9fb79e5bf9b1ccd69592b (
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
|
# frozen_string_literal: true
module Mutations
module Achievements
class Delete < BaseMutation
graphql_name 'AchievementsDelete'
include Gitlab::Graphql::Authorize::AuthorizeResource
field :achievement,
::Types::Achievements::AchievementType,
null: true,
description: 'Achievement.'
argument :achievement_id, ::Types::GlobalIDType[::Achievements::Achievement],
required: true,
description: 'Global ID of the achievement being deleted.'
authorize :admin_achievement
def resolve(args)
achievement = authorized_find!(id: args[:achievement_id])
result = ::Achievements::DestroyService.new(current_user, achievement).execute
{ achievement: result.payload, errors: result.errors }
end
def find_object(id:)
GitlabSchema.object_from_id(id, expected_type: ::Achievements::Achievement)
end
end
end
end
|