New endpoint to fetch a single reply-to email address by id

This commit is contained in:
Rebecca Law
2017-09-21 17:02:58 +01:00
parent e6d6b6f985
commit 795bd4271c
4 changed files with 49 additions and 2 deletions

View File

@@ -13,6 +13,16 @@ def dao_get_reply_to_by_service_id(service_id):
return reply_to
def dao_get_reply_to_by_id(service_id, reply_to_id):
reply_to = db.session.query(
ServiceEmailReplyTo
).filter(
ServiceEmailReplyTo.service_id == service_id,
ServiceEmailReplyTo.id == reply_to_id
).order_by(ServiceEmailReplyTo.created_at).one()
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: