Class: Users::MigrateRecordsToGhostUserService

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::Concern
Defined in:
app/services/users/migrate_records_to_ghost_user_service.rb

Constant Summary collapse

DestroyError =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, initiator_user, execution_tracker) ⇒ MigrateRecordsToGhostUserService

Returns a new instance of MigrateRecordsToGhostUserService.



17
18
19
20
21
22
# File 'app/services/users/migrate_records_to_ghost_user_service.rb', line 17

def initialize(user, initiator_user, execution_tracker)
  @user = user
  @initiator_user = initiator_user
  @execution_tracker = execution_tracker
  @ghost_user = Users::Internal.ghost
end

Instance Attribute Details

#ghost_userObject (readonly)

Returns the value of attribute ghost_user.



15
16
17
# File 'app/services/users/migrate_records_to_ghost_user_service.rb', line 15

def ghost_user
  @ghost_user
end

#hard_deleteObject (readonly)

Returns the value of attribute hard_delete.



15
16
17
# File 'app/services/users/migrate_records_to_ghost_user_service.rb', line 15

def hard_delete
  @hard_delete
end

#initiator_userObject (readonly)

Returns the value of attribute initiator_user.



15
16
17
# File 'app/services/users/migrate_records_to_ghost_user_service.rb', line 15

def initiator_user
  @initiator_user
end

#userObject (readonly)

Returns the value of attribute user.



15
16
17
# File 'app/services/users/migrate_records_to_ghost_user_service.rb', line 15

def user
  @user
end

Instance Method Details

#execute(hard_delete: false) ⇒ Object



24
25
26
27
28
29
# File 'app/services/users/migrate_records_to_ghost_user_service.rb', line 24

def execute(hard_delete: false)
  @hard_delete = hard_delete

  migrate_records
  post_migrate_records
end