mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 00:11:16 -05:00
inserted missing codes
This commit is contained in:
@@ -46,7 +46,8 @@ from app.dao.service_whitelist_dao import (
|
|||||||
dao_add_and_commit_whitelisted_contacts,
|
dao_add_and_commit_whitelisted_contacts,
|
||||||
dao_remove_service_whitelist
|
dao_remove_service_whitelist
|
||||||
)
|
)
|
||||||
from app.dao.service_email_reply_to_dao import create_or_update_email_reply_to, dao_get_reply_to_by_service_id
|
from app.dao.service_email_reply_to_dao import create_or_update_email_reply_to, dao_get_reply_to_by_service_id, \
|
||||||
|
add_reply_to_email_address_for_service, update_reply_to_email_address, dao_get_reply_to_by_id
|
||||||
from app.dao.provider_statistics_dao import get_fragment_count
|
from app.dao.provider_statistics_dao import get_fragment_count
|
||||||
from app.dao.users_dao import get_user_by_id
|
from app.dao.users_dao import get_user_by_id
|
||||||
from app.errors import (
|
from app.errors import (
|
||||||
@@ -57,6 +58,7 @@ from app.models import Service, ServiceInboundApi
|
|||||||
from app.schema_validation import validate
|
from app.schema_validation import validate
|
||||||
from app.service import statistics
|
from app.service import statistics
|
||||||
from app.service.service_inbound_api_schema import service_inbound_api, update_service_inbound_api_schema
|
from app.service.service_inbound_api_schema import service_inbound_api, update_service_inbound_api_schema
|
||||||
|
from app.service.service_senders_schema import add_service_email_reply_to_request
|
||||||
from app.service.utils import get_whitelist_objects
|
from app.service.utils import get_whitelist_objects
|
||||||
from app.service.sender import send_notification_to_service_users
|
from app.service.sender import send_notification_to_service_users
|
||||||
from app.service.send_notification import send_one_off_notification
|
from app.service.send_notification import send_one_off_notification
|
||||||
@@ -535,6 +537,35 @@ def get_email_reply_to_addresses(service_id):
|
|||||||
return jsonify([i.serialize() for i in result]), 200
|
return jsonify([i.serialize() for i in result]), 200
|
||||||
|
|
||||||
|
|
||||||
|
@service_blueprint.route('/<uuid:service_id>/email-reply-to/<uuid:reply_to_id>', methods=["GET"])
|
||||||
|
def get_email_reply_to_address(service_id, reply_to_id):
|
||||||
|
result = dao_get_reply_to_by_id(service_id=service_id, reply_to_id=reply_to_id)
|
||||||
|
return jsonify(result.serialize()), 200
|
||||||
|
|
||||||
|
|
||||||
|
@service_blueprint.route('/<uuid:service_id>/email-reply-to', methods=['POST'])
|
||||||
|
def add_service_reply_to_email_address(service_id):
|
||||||
|
# validate the service exists, throws ResultNotFound exception.
|
||||||
|
dao_fetch_service_by_id(service_id)
|
||||||
|
form = validate(request.get_json(), add_service_email_reply_to_request)
|
||||||
|
new_reply_to = add_reply_to_email_address_for_service(service_id=service_id,
|
||||||
|
email_address=form['email_address'],
|
||||||
|
is_default=form.get('is_default', True))
|
||||||
|
return jsonify(data=new_reply_to.serialize()), 201
|
||||||
|
|
||||||
|
|
||||||
|
@service_blueprint.route('/<uuid:service_id>/email-reply-to/<uuid:reply_to_email_id>', methods=['POST'])
|
||||||
|
def update_service_reply_to_email_address(service_id, reply_to_email_id):
|
||||||
|
# validate the service exists, throws ResultNotFound exception.
|
||||||
|
dao_fetch_service_by_id(service_id)
|
||||||
|
form = validate(request.get_json(), add_service_email_reply_to_request)
|
||||||
|
new_reply_to = update_reply_to_email_address(service_id=service_id,
|
||||||
|
reply_to_id=reply_to_email_id,
|
||||||
|
email_address=form['email_address'],
|
||||||
|
is_default=form.get('is_default', True))
|
||||||
|
return jsonify(data=new_reply_to.serialize()), 200
|
||||||
|
|
||||||
|
|
||||||
@service_blueprint.route('/unique', methods=["GET"])
|
@service_blueprint.route('/unique', methods=["GET"])
|
||||||
def is_service_name_unique():
|
def is_service_name_unique():
|
||||||
name, email_from = check_request_args(request)
|
name, email_from = check_request_args(request)
|
||||||
|
|||||||
Reference in New Issue
Block a user