mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 22:39:43 -04:00
Add an endpoint to delete a contact list
This was one of things we de-scoped when we first shipped this feature. In order to safely delete a list, we first need to make sure any jobs aren’t referencing it.
This commit is contained in:
@@ -135,6 +135,14 @@ 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)
|
||||
|
||||
@@ -23,3 +23,8 @@ def dao_get_contact_lists(service_id):
|
||||
def save_service_contact_list(service_contact_list):
|
||||
db.session.add(service_contact_list)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def dao_delete_contact_list(service_contact_list):
|
||||
db.session.delete(service_contact_list)
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user