New jobs dao method to get jobs that are older than a certain number of days.

Used in deleting CSV files scheduled task
This commit is contained in:
Martyn Inglis
2016-09-07 15:36:07 +01:00
parent f506f6751e
commit c3657839e4
2 changed files with 24 additions and 2 deletions

View File

@@ -66,3 +66,9 @@ def dao_create_job(job):
def dao_update_job(job):
db.session.add(job)
db.session.commit()
def dao_get_jobs_older_than(limit_days):
return Job.query.filter(
cast(Job.created_at, sql_date) < days_ago(limit_days)
).order_by(desc(Job.created_at)).all()