Class: WorkItems::DataSync::Handlers::CopyDataHandler
- Inherits:
-
Object
- Object
- WorkItems::DataSync::Handlers::CopyDataHandler
- Defined in:
- app/services/work_items/data_sync/handlers/copy_data_handler.rb
Instance Attribute Summary collapse
-
#create_params ⇒ Object
readonly
Returns the value of attribute create_params.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#target_namespace ⇒ Object
readonly
Returns the value of attribute target_namespace.
-
#target_work_item_type ⇒ Object
readonly
Returns the value of attribute target_work_item_type.
-
#work_item ⇒ Object
readonly
Returns the value of attribute work_item.
Instance Method Summary collapse
-
#execute ⇒ Object
rubocop:enable Layout/LineLength.
-
#initialize(work_item:, target_namespace:, target_work_item_type:, current_user: nil, params: {}, overwritten_params: {}) ⇒ CopyDataHandler
constructor
rubocop:disable Layout/LineLength – Keyword arguments are making the line a bit longer.
Constructor Details
#initialize(work_item:, target_namespace:, target_work_item_type:, current_user: nil, params: {}, overwritten_params: {}) ⇒ CopyDataHandler
rubocop:disable Layout/LineLength – Keyword arguments are making the line a bit longer
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 11 def initialize(work_item:, target_namespace:, target_work_item_type:, current_user: nil, params: {}, overwritten_params: {}) @work_item = work_item @target_namespace = target_namespace @target_work_item_type = target_work_item_type @current_user = current_user @params = params @operation = params.delete(:operation) @create_params = { id: nil, iid: nil, created_at: work_item.created_at, updated_at: work_item.updated_at, updated_by_id: work_item.updated_by_id, state_id: work_item.state_id, closed_at: work_item.closed_at, closed_by_id: work_item.closed_by_id, duplicated_to_id: work_item.duplicated_to_id, moved_to_id: work_item.moved_to_id, promoted_to_epic_id: work_item.promoted_to_epic_id, external_key: work_item.external_key, upvotes_count: work_item.upvotes_count, blocking_issues_count: work_item.blocking_issues_count, work_item_type: target_work_item_type, project_id: project&.id, namespace_id: target_namespace.id, title: work_item.title, author_id: work_item., relative_position: relative_position, confidential: work_item.confidential, cached_markdown_version: work_item.cached_markdown_version, lock_version: work_item.lock_version, service_desk_reply_to: service_desk_reply_to, imported_from: :none }.merge(overwritten_params) end |
Instance Attribute Details
#create_params ⇒ Object (readonly)
Returns the value of attribute create_params.
7 8 9 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 7 def create_params @create_params end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
7 8 9 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 7 def current_user @current_user end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
7 8 9 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 7 def operation @operation end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
7 8 9 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 7 def params @params end |
#target_namespace ⇒ Object (readonly)
Returns the value of attribute target_namespace.
7 8 9 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 7 def target_namespace @target_namespace end |
#target_work_item_type ⇒ Object (readonly)
Returns the value of attribute target_work_item_type.
7 8 9 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 7 def target_work_item_type @target_work_item_type end |
#work_item ⇒ Object (readonly)
Returns the value of attribute work_item.
7 8 9 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 7 def work_item @work_item end |
Instance Method Details
#execute ⇒ Object
rubocop:enable Layout/LineLength
49 50 51 52 53 54 55 56 57 58 |
# File 'app/services/work_items/data_sync/handlers/copy_data_handler.rb', line 49 def execute # create the new work item ::WorkItems::DataSync::BaseCreateService.new( original_work_item: work_item, operation: operation, container: target_namespace, current_user: current_user, params: create_params.merge(params) ).execute(skip_system_notes: skip_system_notes?) end |