mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 07:21:13 -05:00
Only return non-archived email reply_to addresses
Updated the DAO methods which return a single email reply_to address and all reply_to addresses to only return the non-archived addresses. Changed the type of error that gets raised when using the Admin interface to be BadRequestError instead of a SQLAlchemyError.
This commit is contained in:
@@ -10,7 +10,8 @@ def dao_get_reply_to_by_service_id(service_id):
|
||||
reply_to = db.session.query(
|
||||
ServiceEmailReplyTo
|
||||
).filter(
|
||||
ServiceEmailReplyTo.service_id == service_id
|
||||
ServiceEmailReplyTo.service_id == service_id,
|
||||
ServiceEmailReplyTo.archived == False # noqa
|
||||
).order_by(desc(ServiceEmailReplyTo.is_default), desc(ServiceEmailReplyTo.created_at)).all()
|
||||
return reply_to
|
||||
|
||||
@@ -20,7 +21,8 @@ def dao_get_reply_to_by_id(service_id, reply_to_id):
|
||||
ServiceEmailReplyTo
|
||||
).filter(
|
||||
ServiceEmailReplyTo.service_id == service_id,
|
||||
ServiceEmailReplyTo.id == reply_to_id
|
||||
ServiceEmailReplyTo.id == reply_to_id,
|
||||
ServiceEmailReplyTo.archived == False # noqa
|
||||
).order_by(ServiceEmailReplyTo.created_at).one()
|
||||
return reply_to
|
||||
|
||||
|
||||
Reference in New Issue
Block a user