Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tags=["Lists"],
)
+def get_list_from_path(list: str = fastapi.Path(...)) -> lists.List:
+ """
+ Fetches a list by its slug
+ """
+ return backend.lists.get_by_slug(list)
+
@router.get("")
def get_lists() -> typing.List[lists.List]:
return [l for l in backend.lists]
+@router.get("/{list}")
+def get_list(list = fastapi.Depends(get_list_from_path)) -> lists.List:
+ if not list:
+ raise fastapi.HTTPException(404, "Could not find list")
+
+ return list
+
# Include our endpoints
app.include_router(router)
def __str__(self):
return self.name
+ def __bool__(self):
+ return True
+
def __len__(self):
stmt = (
sqlmodel