This commit is contained in:
JiriUhlir
2026-06-15 12:04:59 +02:00
parent be2e71c7d0
commit 39d9ed394d
5 changed files with 200 additions and 1 deletions
+23
View File
@@ -292,6 +292,29 @@ def get_jobs(
return [dict(row) for row in rows]
def get_jobs_by_types(job_types, limit: int = 20):
run_migrations()
job_types = list(job_types)
if not job_types:
return []
con = get_connection()
placeholders = ",".join("?" for _ in job_types)
rows = con.execute(
f"""
SELECT *
FROM jobs
WHERE type IN ({placeholders})
ORDER BY id DESC
LIMIT ?
""",
(*job_types, limit),
).fetchall()
con.close()
return [dict(row) for row in rows]
def count_jobs(
status: str | None = None,
job_type: str | None = None,