From cc0ba96a9e032f9f6851f8ffd742e389c71a4208 Mon Sep 17 00:00:00 2001 From: ducklet Date: Sun, 11 Jul 2021 17:24:52 +0200 Subject: [PATCH] add route for admins to list all groups --- unwind/web.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unwind/web.py b/unwind/web.py index d5c336a..51543d0 100644 --- a/unwind/web.py +++ b/unwind/web.py @@ -234,6 +234,13 @@ async def load_imdb_user_ratings(request): return JSONResponse({"new_ratings": [asplain(r) for r in ratings]}) +@route("/groups") +@requires(["authenticated", "admin"]) +async def list_groups(request): + groups = await db.get_all(Group) + return JSONResponse([asplain(g) for g in groups]) + + @route("/groups", methods=["POST"]) @requires(["authenticated", "admin"]) async def add_group(request):