diff options
Diffstat (limited to 'app/services/audit_event_service.rb')
-rw-r--r-- | app/services/audit_event_service.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb index ad733c455a9..97debccfb18 100644 --- a/app/services/audit_event_service.rb +++ b/app/services/audit_event_service.rb @@ -14,14 +14,16 @@ class AuditEventService # @param [Hash] details extra data of audit event # @param [Symbol] save_type the type to save the event # Can be selected from the following, :database, :stream, :database_and_stream . + # @params [DateTime] created_at the time the action occured # # @return [AuditEventService] - def initialize(author, entity, details = {}, save_type = :database_and_stream) + def initialize(author, entity, details = {}, save_type = :database_and_stream, created_at = DateTime.current) @author = build_author(author) @entity = entity @details = details @ip_address = resolve_ip_address(@author) @save_type = save_type + @created_at = created_at end # Builds the @details attribute for authentication @@ -79,7 +81,8 @@ class AuditEventService author_id: @author.id, author_name: @author.name, entity_id: @entity.id, - entity_type: @entity.class.name + entity_type: @entity.class.name, + created_at: @created_at } end |