record soft deletion in audit log for applications and environments

This commit is contained in:
dandds
2019-04-09 15:53:35 -04:00
parent b58aef2c6b
commit 0348af7ce7
4 changed files with 60 additions and 1 deletions

View File

@@ -40,3 +40,12 @@ class Application(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
return "<Application(name='{}', description='{}', portfolio='{}', id='{}')>".format(
self.name, self.description, self.portfolio.name, self.id
)
@property
def history(self):
previous_state = self.get_changes()
change_set = {}
if "deleted" in previous_state:
change_set["deleted"] = previous_state["deleted"]
return change_set

View File

@@ -46,3 +46,12 @@ class Environment(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
self.application.portfolio.name,
self.id,
)
@property
def history(self):
previous_state = self.get_changes()
change_set = {}
if "deleted" in previous_state:
change_set["deleted"] = previous_state["deleted"]
return change_set