mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Archive, don’t delete contact lists
So we keep a record of who first uploaded a list it’s better to archive a list than completely delete it. The list in the database doesn’t contain any recipient info so this isn’t a change to what data we’re retaining. This means updating the endpoints that get contact lists to exclude ones that are archived.
This commit is contained in:
@@ -135,14 +135,6 @@ def dao_update_job(job):
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def dao_unlink_jobs_from_contact_list_id(contact_list_id):
|
||||
Job.query.filter(
|
||||
Job.contact_list_id == contact_list_id,
|
||||
).update({
|
||||
'contact_list_id': None,
|
||||
})
|
||||
|
||||
|
||||
def dao_get_jobs_older_than_data_retention(notification_types):
|
||||
flexible_data_retention = ServiceDataRetention.query.filter(
|
||||
ServiceDataRetention.notification_type.in_(notification_types)
|
||||
|
||||
@@ -5,7 +5,8 @@ from app.models import ServiceContactList
|
||||
def dao_get_contact_list_by_id(service_id, contact_list_id):
|
||||
contact_list = ServiceContactList.query.filter_by(
|
||||
service_id=service_id,
|
||||
id=contact_list_id
|
||||
id=contact_list_id,
|
||||
archived=False,
|
||||
).one()
|
||||
|
||||
return contact_list
|
||||
@@ -13,7 +14,8 @@ def dao_get_contact_list_by_id(service_id, contact_list_id):
|
||||
|
||||
def dao_get_contact_lists(service_id):
|
||||
contact_lists = ServiceContactList.query.filter_by(
|
||||
service_id=service_id
|
||||
service_id=service_id,
|
||||
archived=False,
|
||||
).order_by(
|
||||
ServiceContactList.created_at.desc()
|
||||
)
|
||||
@@ -25,6 +27,7 @@ def save_service_contact_list(service_contact_list):
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def dao_delete_contact_list(service_contact_list):
|
||||
db.session.delete(service_contact_list)
|
||||
def dao_archive_contact_list(service_contact_list):
|
||||
service_contact_list.archived = True
|
||||
db.session.add(service_contact_list)
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user