Class: IncidentManagement::IssuableEscalationStatuses::CreateService

Inherits:
BaseProjectService show all
Defined in:
app/services/incident_management/issuable_escalation_statuses/create_service.rb

Instance Attribute Summary

Attributes inherited from BaseProjectService

#project

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods inherited from BaseContainerService

#group_container?, #namespace_container?, #project_container?, #project_group

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(issue) ⇒ CreateService

Returns a new instance of CreateService.



6
7
8
9
10
# File 'app/services/incident_management/issuable_escalation_statuses/create_service.rb', line 6

def initialize(issue)
  @issue = issue

  super(project: issue.project)
end

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
# File 'app/services/incident_management/issuable_escalation_statuses/create_service.rb', line 12

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