debian-mirror-gitlab/app/graphql/mutations/timelogs/delete.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
753 B
Ruby
Raw Normal View History

2022-07-16 23:28:13 +05:30
# frozen_string_literal: true
module Mutations
module Timelogs
2022-08-27 11:52:29 +05:30
class Delete < Base
2022-07-16 23:28:13 +05:30
graphql_name 'TimelogDelete'
argument :id,
::Types::GlobalIDType[::Timelog],
required: true,
description: 'Global ID of the timelog.'
authorize :admin_timelog
def resolve(id:)
timelog = authorized_find!(id: id)
result = ::Timelogs::DeleteService.new(timelog, current_user).execute
# Return the result payload, not the loaded timelog, so that it returns null in case of unauthorized access
2022-08-27 11:52:29 +05:30
response(result)
2022-07-16 23:28:13 +05:30
end
2022-08-27 11:52:29 +05:30
private
2022-07-16 23:28:13 +05:30
def find_object(id:)
2022-08-27 11:52:29 +05:30
GitlabSchema.object_from_id(id, expected_type: ::Timelog).sync
2022-07-16 23:28:13 +05:30
end
end
end
end