mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Added new endpoints to get service data retention for a service.
This commit is contained in:
@@ -5,11 +5,21 @@ from app.dao.dao_utils import transactional
|
||||
from app.models import ServiceDataRetention
|
||||
|
||||
|
||||
def get_service_data_retention(service_id):
|
||||
data_retention = ServiceDataRetention.query.filter_by(service_id=service_id).all()
|
||||
def fetch_service_data_retention_by_id(service_id, data_retention_id):
|
||||
data_retention = ServiceDataRetention.query.filter_by(service_id=service_id, id=data_retention_id).first()
|
||||
return data_retention
|
||||
|
||||
|
||||
def fetch_service_data_retention(service_id):
|
||||
data_retention_list = ServiceDataRetention.query.filter_by(
|
||||
service_id=service_id
|
||||
).order_by(
|
||||
# in the order that models.notification_types are created (email, sms, letter)
|
||||
ServiceDataRetention.notification_type
|
||||
).all()
|
||||
return data_retention_list
|
||||
|
||||
|
||||
@transactional
|
||||
def insert_service_data_retention(service_id, notification_type, days_of_retention):
|
||||
new_data_retention = ServiceDataRetention(service_id=service_id,
|
||||
|
||||
Reference in New Issue
Block a user