letter_job cleanup

This commit is contained in:
stvnrlly
2023-02-15 11:53:52 -05:00
parent b9afd54ce8
commit 4da08adff2
14 changed files with 1 additions and 323 deletions

View File

@@ -20,35 +20,6 @@ def get_notification_by_id(notification_id):
return jsonify(notification.serialize()), 200
# TODO: return deprecation notice
# @v2_notification_blueprint.route('/<notification_id>/pdf', methods=['GET'])
# def get_pdf_for_notification(notification_id):
# _data = {"notification_id": notification_id}
# validate(_data, notification_by_id)
# notification = notifications_dao.get_notification_by_id(
# notification_id, authenticated_service.id, _raise=True
# )
# if notification.notification_type != LETTER_TYPE:
# raise BadRequestError(message="Notification is not a letter")
# if notification.status == NOTIFICATION_VIRUS_SCAN_FAILED:
# raise BadRequestError(message='File did not pass the virus scan')
# if notification.status == NOTIFICATION_TECHNICAL_FAILURE:
# raise BadRequestError(message='PDF not available for letters in status {}'.format(notification.status))
# if notification.status == NOTIFICATION_PENDING_VIRUS_CHECK:
# raise PDFNotReadyError()
# try:
# pdf_data, metadata = get_letter_pdf_and_metadata(notification)
# except Exception:
# raise PDFNotReadyError()
# return send_file(path_or_file=BytesIO(pdf_data), mimetype='application/pdf')
@v2_notification_blueprint.route("", methods=['GET'])
def get_notifications():
_data = request.args.to_dict(flat=False)

View File

@@ -66,41 +66,6 @@ POST_NOTIFICATION_JSON_PARSE_DURATION_SECONDS = Histogram(
)
# TODO: return deprecation message
# @v2_notification_blueprint.route('/{}'.format(LETTER_TYPE), methods=['POST'])
# def post_precompiled_letter_notification():
# request_json = get_valid_json()
# if 'content' not in (request_json or {}):
# return post_notification(LETTER_TYPE)
# form = validate(request_json, post_precompiled_letter_request)
# # Check permission to send letters
# check_service_has_permission(LETTER_TYPE, authenticated_service.permissions)
# check_rate_limiting(authenticated_service, api_user)
# template = get_precompiled_letter_template(authenticated_service.id)
# # For precompiled letters the to field will be set to Provided as PDF until the validation passes,
# # then the address of the letter will be set as the to field
# form['personalisation'] = {
# 'address_line_1': 'Provided as PDF'
# }
# notification = process_letter_notification(
# letter_data=form,
# api_key=api_user,
# service=authenticated_service,
# template=template,
# template_with_content=None, # not required for precompiled
# reply_to_text='', # not required for precompiled
# precompiled=True
# )
# return jsonify(notification), 201
@v2_notification_blueprint.route('/<notification_type>', methods=['POST'])
def post_notification(notification_type):
with POST_NOTIFICATION_JSON_PARSE_DURATION_SECONDS.time():