New dao and endpoints to create and update service data retention.

This commit is contained in:
Rebecca Law
2018-07-11 17:02:49 +01:00
parent e4cc90e585
commit e2a1dfeb31
7 changed files with 302 additions and 1 deletions

View File

@@ -1859,3 +1859,14 @@ class ServiceDataRetention(db.Model):
__table_args__ = (
UniqueConstraint('service_id', 'notification_type', name='uix_service_data_retention'),
)
def serialize(self):
return {
"id": str(self.id),
"service_id": str(self.service_id),
"service_name": self.service.name,
"notification_type": self.notification_type,
"days_of_retention": self.days_of_retention,
"created_at": self.created_at.strftime(DATETIME_FORMAT),
"updated_at": self.updated_at.strftime(DATETIME_FORMAT) if self.updated_at else None,
}