mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-07 03:58:25 -04:00
more
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from sqlalchemy import desc
|
||||
from sqlalchemy import desc, select
|
||||
|
||||
from app import db
|
||||
from app.dao.dao_utils import autocommit
|
||||
@@ -62,7 +62,7 @@ def update_reply_to_email_address(service_id, reply_to_id, email_address, is_def
|
||||
"You must have at least one reply to email address as the default.", 400
|
||||
)
|
||||
|
||||
reply_to_update = ServiceEmailReplyTo.query.get(reply_to_id)
|
||||
reply_to_update = db.session.get(ServiceEmailReplyTo, reply_to_id)
|
||||
reply_to_update.email_address = email_address
|
||||
reply_to_update.is_default = is_default
|
||||
db.session.add(reply_to_update)
|
||||
@@ -71,9 +71,13 @@ def update_reply_to_email_address(service_id, reply_to_id, email_address, is_def
|
||||
|
||||
@autocommit
|
||||
def archive_reply_to_email_address(service_id, reply_to_id):
|
||||
reply_to_archive = ServiceEmailReplyTo.query.filter_by(
|
||||
id=reply_to_id, service_id=service_id
|
||||
).one()
|
||||
reply_to_archive = (
|
||||
db.session.execute(
|
||||
select(ServiceEmailReplyTo).filter_by(id=reply_to_id, service_id=service_id)
|
||||
)
|
||||
.scalars()
|
||||
.one()
|
||||
)
|
||||
|
||||
if reply_to_archive.is_default:
|
||||
raise ArchiveValidationError(
|
||||
|
||||
Reference in New Issue
Block a user