Class: IncidentManagement::Incidents::CreateService
- Inherits:
-
BaseService
- Object
- BaseService
- IncidentManagement::Incidents::CreateService
- Defined in:
- app/services/incident_management/incidents/create_service.rb
Constant Summary collapse
- ISSUE_TYPE =
'incident'
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, current_user, title:, description:) ⇒ CreateService
constructor
A new instance of CreateService.
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
Constructor Details
#initialize(project, current_user, title:, description:) ⇒ CreateService
Returns a new instance of CreateService.
8 9 10 11 12 13 |
# File 'app/services/incident_management/incidents/create_service.rb', line 8 def initialize(project, current_user, title:, description:) super(project, current_user) @title = title @description = description end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/incident_management/incidents/create_service.rb', line 15 def execute issue = Issues::CreateService.new( project, current_user, title: title, description: description, label_ids: [find_or_create_incident_label.id], issue_type: ISSUE_TYPE ).execute return error(issue.errors..to_sentence, issue) unless issue.valid? success(issue) end |