summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/ci/job/unschedule.rb
blob: 07b1896bd2ce18d331bc607ce4f7a52b41c9e6dd (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
# frozen_string_literal: true

module Mutations
  module Ci
    module Job
      class Unschedule < Base
        graphql_name 'JobUnschedule'

        field :job,
              Types::Ci::JobType,
              null: true,
              description: 'Job after the mutation.'

        authorize :update_build

        def resolve(id:)
          job = authorized_find!(id: id)

          ::Ci::BuildUnscheduleService.new(job, current_user).execute
          {
            job: job,
            errors: errors_on_object(job)
          }
        end
      end
    end
  end
end