mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Remove create_or_update_email_reply_to and create_or_update_letter_contact - no longer needed.
Remove Services.reply_to_email_address and Services.letter_contact_block
This commit is contained in:
@@ -25,22 +25,6 @@ def dao_get_reply_to_by_id(service_id, reply_to_id):
|
||||
return reply_to
|
||||
|
||||
|
||||
def create_or_update_email_reply_to(service_id, email_address):
|
||||
reply_to = dao_get_reply_to_by_service_id(service_id)
|
||||
if len(reply_to) == 0:
|
||||
reply_to = ServiceEmailReplyTo(service_id=service_id, email_address=email_address)
|
||||
dao_create_reply_to_email_address(reply_to)
|
||||
elif len(reply_to) == 1:
|
||||
reply_to[0].email_address = email_address
|
||||
dao_update_reply_to_email(reply_to[0])
|
||||
else:
|
||||
# Once we move allowing multiple email address this methods will be removed
|
||||
raise InvalidRequest(
|
||||
"Multiple reply to email addresses were found, this method should not be used.",
|
||||
status_code=500
|
||||
)
|
||||
|
||||
|
||||
@transactional
|
||||
def dao_create_reply_to_email_address(reply_to_email):
|
||||
db.session.add(reply_to_email)
|
||||
|
||||
@@ -29,25 +29,6 @@ def dao_get_letter_contact_by_id(service_id, letter_contact_id):
|
||||
return letter_contact
|
||||
|
||||
|
||||
def create_or_update_letter_contact(service_id, contact_block):
|
||||
letter_contacts = dao_get_letter_contacts_by_service_id(service_id)
|
||||
if len(letter_contacts) == 0:
|
||||
letter_contact = ServiceLetterContact(
|
||||
service_id=service_id,
|
||||
contact_block=contact_block
|
||||
)
|
||||
dao_create_letter_contact(letter_contact)
|
||||
elif len(letter_contacts) == 1:
|
||||
letter_contacts[0].contact_block = contact_block
|
||||
dao_update_letter_contact(letter_contacts[0])
|
||||
else:
|
||||
# TODO: Once we move allowing letter contact blocks, this method will be removed
|
||||
raise InvalidRequest(
|
||||
"Multiple letter contacts were found, this method should not be used.",
|
||||
status_code=500
|
||||
)
|
||||
|
||||
|
||||
@transactional
|
||||
def dao_create_letter_contact(letter_contact):
|
||||
db.session.add(letter_contact)
|
||||
|
||||
Reference in New Issue
Block a user