summaryrefslogtreecommitdiff
path: root/app/services/incident_management/create_incident_label_service.rb
blob: 595f5df184fe5a69742a95c31fb74b58ee5a3d29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module IncidentManagement
  class CreateIncidentLabelService < BaseService
    LABEL_PROPERTIES = {
      title: 'incident',
      color: '#CC0033',
      description: <<~DESCRIPTION.chomp
        Denotes a disruption to IT services and \
        the associated issues require immediate attention
      DESCRIPTION
    }.freeze

    def execute
      label = Labels::FindOrCreateService
        .new(current_user, project, **LABEL_PROPERTIES)
        .execute(skip_authorization: true)

      ServiceResponse.success(payload: { label: label })
    end
  end
end