Add DAO function and endpoint for archiving email reply_to addresses

Added a new DAO function which archives email reply_to addresses by
setting archived to True. This raises a new type of error, an
ArchiveValidationError, if trying to archive a default reply_to address.

Added a new endpoint for archiving email reply_to addresses.
This commit is contained in:
Katie Smith
2018-04-25 16:34:36 +01:00
parent 663021e494
commit 5f43fe23a7
6 changed files with 111 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ from sqlalchemy.orm.exc import NoResultFound
from marshmallow import ValidationError
from jsonschema import ValidationError as JsonSchemaValidationError
from app.authentication.auth import AuthError
from app.exceptions import ArchiveValidationError
class VirusScanError(Exception):
@@ -67,6 +68,11 @@ def register_errors(blueprint):
current_app.logger.info(error)
return jsonify(json.loads(error.message)), 400
@blueprint.errorhandler(ArchiveValidationError)
def archive_validation_error(error):
current_app.logger.info(error)
return jsonify(result='error', message=str(error)), 400
@blueprint.errorhandler(InvalidRequest)
def invalid_data(error):
response = jsonify(error.to_dict())