blob: be4c5a1d5e2f02735962aee79e6f6d80841fafca (
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
|
# frozen_string_literal: true
module Mutations
module Achievements
class DeleteUserAchievement < BaseMutation
graphql_name 'UserAchievementsDelete'
include Gitlab::Graphql::Authorize::AuthorizeResource
field :user_achievement,
::Types::Achievements::UserAchievementType,
null: true,
description: 'Deleted user achievement.'
argument :user_achievement_id, ::Types::GlobalIDType[::Achievements::UserAchievement],
required: true,
description: 'Global ID of the user achievement being deleted.'
authorize :destroy_user_achievement
def resolve(args)
user_achievement = authorized_find!(id: args[:user_achievement_id])
result = ::Achievements::DestroyUserAchievementService.new(current_user, user_achievement).execute
{ user_achievement: result.payload, errors: result.errors }
end
end
end
end
|