mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Move job processing into celery
- brings boto S3 into new AWS folder - CSV processing utils method Rejigs the jobs rest endpoint - removes some now unused endpoints, Calls to the task with the job, job processing in task, delegating SMS calls to the sms task
This commit is contained in:
@@ -2,24 +2,23 @@ from app import db
|
||||
from app.models import Job
|
||||
|
||||
|
||||
def save_job(job, update_dict={}):
|
||||
if update_dict:
|
||||
update_dict.pop('id', None)
|
||||
update_dict.pop('service', None)
|
||||
update_dict.pop('template', None)
|
||||
Job.query.filter_by(id=job.id).update(update_dict)
|
||||
else:
|
||||
db.session.add(job)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def get_job(service_id, job_id):
|
||||
def dao_get_job_by_service_id_and_job_id(service_id, job_id):
|
||||
return Job.query.filter_by(service_id=service_id, id=job_id).first()
|
||||
|
||||
|
||||
def get_jobs_by_service(service_id):
|
||||
def dao_get_jobs_by_service_id(service_id):
|
||||
return Job.query.filter_by(service_id=service_id).all()
|
||||
|
||||
|
||||
def _get_jobs():
|
||||
return Job.query.all()
|
||||
def dao_get_job_by_id(job_id):
|
||||
return Job.query.filter_by(id=job_id).first()
|
||||
|
||||
|
||||
def dao_create_job(job):
|
||||
db.session.add(job)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def dao_update_job(job):
|
||||
db.session.add(job)
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user