- move templates into src/templates; renumber wiki pages; add app-components page - embed agentic build prompt as a copyable markdown block; add mermaid diagrams - build.py writes <name>/mcp; config static bundle -> standards/mcp - registry reads libraries.json as bytes (committed file was UTF-16LE); normalize to UTF-8 - Dockerfile: drop stale blog copy; per-repo <name>/mcp copies - drop nested standards/mcp/standards duplicate and empty root mcp/
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""# Summary
|
|
|
|
Job route handlers — names must match openapi.yaml operationIds.
|
|
"""
|
|
from fastapi import Request
|
|
from fastapi.responses import JSONResponse
|
|
|
|
from domain.job.models import Job
|
|
|
|
|
|
def svc(request: Request):
|
|
"""Resolve the job CRUD service from app state."""
|
|
return request.app.state.db_resources["job_svc"]
|
|
|
|
|
|
async def create_job(request: Request, body: dict):
|
|
"""Create a job from the request body."""
|
|
data = body.model_dump() if hasattr(body, "model_dump") else dict(body)
|
|
doc = await svc(request).create(Job(**data))
|
|
return JSONResponse(status_code=201, content=doc.model_dump(mode="json", by_alias=True))
|
|
|
|
|
|
async def get_job(request: Request, id: str):
|
|
"""Fetch one job by id."""
|
|
doc = await svc(request).read(id)
|
|
if doc is None:
|
|
return JSONResponse(status_code=404, content={"detail": "job not found"})
|
|
return doc.model_dump(mode="json", by_alias=True)
|
|
|
|
|
|
async def list_jobs(request: Request):
|
|
"""List all jobs."""
|
|
docs = await svc(request).search({})
|
|
return [d.model_dump(mode="json", by_alias=True) for d in docs] |