feat: convert to self-hosted version

This commit is contained in:
Jayden Pyles
2024-07-06 22:40:47 -05:00
parent 8808b493e6
commit 2bfc751d01
24 changed files with 1073 additions and 222 deletions

26
api/backend/job.py Normal file
View File

@@ -0,0 +1,26 @@
# STL
import logging
from typing import Any
# LOCAL
from api.backend.database import get_job_collection
LOG = logging.getLogger(__name__)
async def insert(item: dict[str, Any]) -> None:
collection = get_job_collection()
i = await collection.insert_one(item)
LOG.info(f"Inserted item: {i}")
async def query(filter: dict[str, Any]) -> list[dict[str, Any]]:
collection = get_job_collection()
cursor = collection.find(filter)
results: list[dict[str, Any]] = []
async for document in cursor:
del document["_id"]
results.append(document)
return results