]> git.ipfire.org Git - pbs.git/commitdiff
API: Build out returning a build
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 15 Jun 2025 14:02:09 +0000 (14:02 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 15 Jun 2025 14:02:09 +0000 (14:02 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/api/builds.py

index f519329bb198e370c8507ed2108c073c94c64c67..f93fab7b987042fa2ab139b802989273e6a89170 100644 (file)
 #                                                                             #
 ###############################################################################
 
+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