Add DAO function and endpoint for archiving letter contact blocks

Added a new DAO function which archives letter contact blocks by
setting archived to True. This raises an ArchiveValidationError if
trying to archive the default letter block for a service or the default
letter contact block for a template.

Added a new endpoint for archiving letter contact blocks.
This commit is contained in:
Katie Smith
2018-04-26 10:00:11 +01:00
parent 472b86f3f4
commit f2d4bc795e
4 changed files with 120 additions and 2 deletions

View File

@@ -59,6 +59,7 @@ from app.dao.service_email_reply_to_dao import (
update_reply_to_email_address
)
from app.dao.service_letter_contact_dao import (
archive_letter_contact,
dao_get_letter_contacts_by_service_id,
dao_get_letter_contact_by_id,
add_letter_contact_for_service,
@@ -638,6 +639,13 @@ def update_service_letter_contact(service_id, letter_contact_id):
return jsonify(data=new_reply_to.serialize()), 200
@service_blueprint.route('/<uuid:service_id>/letter-contact/<uuid:letter_contact_id>/archive', methods=['POST'])
def delete_service_letter_contact(service_id, letter_contact_id):
archived_letter_contact = archive_letter_contact(service_id, letter_contact_id)
return jsonify(data=archived_letter_contact.serialize()), 200
@service_blueprint.route('/<uuid:service_id>/sms-sender', methods=['POST'])
def add_service_sms_sender(service_id):
dao_fetch_service_by_id(service_id)