Class: Trackers::StaffService
- Inherits:
-
Object
- Object
- Trackers::StaffService
- Defined in:
- app/services/partner_service/trackers/staff_service.rb
Overview
The StaffService class is responsible for tracking changes related to staff creation and deletion. It records navigation details, timestamps, and change descriptions for better traceability.
Instance Attribute Summary collapse
-
#changes ⇒ Object
Returns the value of attribute changes.
-
#footer_text ⇒ Object
Returns the value of attribute footer_text.
-
#navigation ⇒ Object
Returns the value of attribute navigation.
Instance Method Summary collapse
-
#track_staff_created(staff) ⇒ void
Tracks the creation of a staff member, recording their details and generating a change log.
-
#track_staff_deleted(staff) ⇒ void
Tracks the deletion of a staff member, recording their details and generating a change log.
Instance Attribute Details
#changes ⇒ Object
Returns the value of attribute changes.
5 6 7 |
# File 'app/services/partner_service/trackers/staff_service.rb', line 5 def changes @changes end |
#footer_text ⇒ Object
Returns the value of attribute footer_text.
5 6 7 |
# File 'app/services/partner_service/trackers/staff_service.rb', line 5 def @footer_text end |
#navigation ⇒ Object
Returns the value of attribute navigation.
5 6 7 |
# File 'app/services/partner_service/trackers/staff_service.rb', line 5 def @navigation end |
Instance Method Details
#track_staff_created(staff) ⇒ void
This method returns an undefined value.
Tracks the creation of a staff member, recording their details and generating a change log.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/partner_service/trackers/staff_service.rb', line 11 def track_staff_created(staff) @navigation = 'staffs' @footer_text = Time.zone.now.strftime('%d %B %Y, %H:%M') @changes = { staff: { type: 'staff', staff: { id: staff.id, name: staff.name, email: staff.email, role: 'Staff', }, label: 'user has been created', }, } end |
#track_staff_deleted(staff) ⇒ void
This method returns an undefined value.
Tracks the deletion of a staff member, recording their details and generating a change log.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/services/partner_service/trackers/staff_service.rb', line 32 def track_staff_deleted(staff) @navigation = 'staffs' @footer_text = Time.zone.now.strftime('%d %B %Y, %H:%M') @changes = { staff: { type: 'staff', staff: { id: staff.id, name: staff.name, email: staff.email, role: 'Staff', }, label: 'Staff has been deleted', }, } end |