18 lines
471 B
Python
18 lines
471 B
Python
from fastapi import APIRouter, HTTPException, status
|
|
|
|
from app.models.jobs import JobResponse
|
|
from app.services.jobs import get_job
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/{job_id}", response_model=JobResponse)
|
|
def read(job_id: str) -> JobResponse:
|
|
job = get_job(job_id)
|
|
if job is None:
|
|
raise HTTPException(
|
|
status_code=status.HTTP_404_NOT_FOUND,
|
|
detail={"code": "JOB_NOT_FOUND", "detail": "Job not found"},
|
|
)
|
|
return job
|