From: Michael Tremer Date: Sun, 15 Jun 2025 14:02:09 +0000 (+0000) Subject: API: Build out returning a build X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=783245a1cfc06c0a90374e496e6acf976cf04bc8;p=pbs.git API: Build out returning a build Signed-off-by: Michael Tremer --- diff --git a/src/api/builds.py b/src/api/builds.py index f519329b..f93fab7b 100644 --- a/src/api/builds.py +++ b/src/api/builds.py @@ -18,8 +18,18 @@ # # ############################################################################### +import fastapi +import uuid + from .app import app +from . import backend @app.get("/builds/{build_id}") -async def get(build_id: str): - return { "GOT" : "HERE" } +async def get(build_id: uuid.UUID): + build = await backend.builds.get_by_uuid(build_id) + + # Raise 404 if the build could not be found + if not build: + raise fastapi.HTTPException(404, "Build not found") + + return build