feat: add api and mcp

This commit is contained in:
hh committed 2026-05-30 01:32:35 +02:00
1 parent 6a5cde6ae4
commit c40e720163
30 files changed
+2354 -31

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import json
from typing import Any
import asyncpg
JOBS_CHANGED_CHANNEL = "jobs_changed"
async def enqueue(
pool: asyncpg.Pool, account_id: int, kind: str, params: dict[str, Any]
) -> int:
job_id = await pool.fetchval(
"INSERT INTO jobs (account_id, kind, params) "
"VALUES ($1, $2, $3::jsonb) RETURNING id",
account_id,
kind,
json.dumps(params),
)
await pool.execute(f"NOTIFY {JOBS_CHANGED_CHANNEL}")
return job_id