Refactor admin/contact_version and admin/domain_version csv generation logic

This commit is contained in:
Thiago Youssef 2022-03-10 16:03:53 +02:00
parent 807419bc3a
commit 9fb4a6d7e6
19 changed files with 117 additions and 156 deletions

View file

@ -4,4 +4,21 @@ class Version::ContactVersion < PaperTrail::Version
self.table_name = :log_contacts
self.sequence_name = :log_contacts_id_seq
def as_csv_row
contact = ObjectVersionsParser.new(self).parse
[
contact.name,
contact.code,
contact.ident_human_description,
contact.registrar,
event,
created_at.to_formatted_s(:db)
]
end
def self.csv_header
['Name', 'ID', 'Ident', 'Registrar', 'Action', 'Created at'].freeze
end
end