mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Remove letters-related code (#175)
This deletes a big ol' chunk of code related to letters. It's not everything—there are still a few things that might be tied to sms/email—but it's the the heart of letters function. SMS and email function should be untouched by this. Areas affected: - Things obviously about letters - PDF tasks, used for precompiling letters - Virus scanning, used for those PDFs - FTP, used to send letters to the printer - Postage stuff
This commit is contained in:
@@ -9,8 +9,6 @@ from app.dao.fact_notification_status_dao import (
|
||||
fetch_notification_statuses_for_job,
|
||||
)
|
||||
from app.dao.jobs_dao import (
|
||||
can_letter_job_be_cancelled,
|
||||
dao_cancel_letter_job,
|
||||
dao_create_job,
|
||||
dao_get_future_scheduled_job_by_id_and_service_id,
|
||||
dao_get_job_by_service_id_and_job_id,
|
||||
@@ -30,7 +28,6 @@ from app.models import (
|
||||
JOB_STATUS_CANCELLED,
|
||||
JOB_STATUS_PENDING,
|
||||
JOB_STATUS_SCHEDULED,
|
||||
LETTER_TYPE,
|
||||
)
|
||||
from app.schemas import (
|
||||
job_schema,
|
||||
@@ -66,17 +63,6 @@ def cancel_job(service_id, job_id):
|
||||
return get_job_by_service_and_job_id(service_id, job_id)
|
||||
|
||||
|
||||
@job_blueprint.route('/<job_id>/cancel-letter-job', methods=['POST'])
|
||||
def cancel_letter_job(service_id, job_id):
|
||||
job = dao_get_job_by_service_id_and_job_id(service_id, job_id)
|
||||
can_we_cancel, errors = can_letter_job_be_cancelled(job)
|
||||
if can_we_cancel:
|
||||
data = dao_cancel_letter_job(job)
|
||||
return jsonify(data), 200
|
||||
else:
|
||||
return jsonify(message=errors), 400
|
||||
|
||||
|
||||
@job_blueprint.route('/<job_id>/notifications', methods=['GET'])
|
||||
def get_all_notifications_for_service_job(service_id, job_id):
|
||||
data = notifications_filter_schema.load(request.args)
|
||||
@@ -160,9 +146,6 @@ def create_job(service_id):
|
||||
data['template'] = data.pop('template_id')
|
||||
template = dao_get_template_by_id(data['template'])
|
||||
|
||||
if template.template_type == LETTER_TYPE and service.restricted:
|
||||
raise InvalidRequest("Create letter job is not allowed for service in trial mode ", 403)
|
||||
|
||||
if data.get('valid') != 'True':
|
||||
raise InvalidRequest("File is not valid, can't create job", 400)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user