Welcome to mirror list, hosted at ThFree Co, Russian Federation.

create_service.rb « issuable_escalation_statuses « incident_management « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b22fb97e0d3255e6f4441862f7211f238326f29 (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
# frozen_string_literal: true

module IncidentManagement
  module IssuableEscalationStatuses
    class CreateService < ::BaseProjectService
      def initialize(issue)
        @issue = issue

        super(project: issue.project)
      end

      def execute
        escalation_status = BuildService.new(issue).execute

        if escalation_status.save
          ServiceResponse.success(payload: { escalation_status: escalation_status })
        else
          ServiceResponse.error(message: escalation_status.errors&.full_messages)
        end
      end

      private

      attr_reader :issue
    end
  end
end