# Copyright (c) 2019, InfluxFramework LLC
# License: MIT. See LICENSE

import influxframework
from influxframework.model.document import Document
from influxframework.query_builder import Interval
from influxframework.query_builder.functions import Now


class ScheduledJobLog(Document):
	@staticmethod
	def clear_old_logs(days=90):
		table = influxframework.qb.DocType("Scheduled Job Log")
		influxframework.db.delete(table, filters=(table.modified < (Now() - Interval(days=days))))
