From ad8b76e53bab5d0d22539d08fc180c4552e40f46 Mon Sep 17 00:00:00 2001 From: Valimp Date: Wed, 20 Mar 2024 16:58:20 +0100 Subject: [PATCH] feat: add route to get image flags --- app/api.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/api.py b/app/api.py index de6d6a2..d323b97 100644 --- a/app/api.py +++ b/app/api.py @@ -325,6 +325,24 @@ def get_flags(): return {"flags": list(FlagModel.select().dicts().iterator())} +@api_v1_router.get("/flags/image-moderation") +def get_image_moderation_flags(): + """Get all flags for image moderation. + + This function is used to get all flags for image + moderation by getting all flags of type `image`. + """ + with db: + return { + "flags": list( + FlagModel.select() + .where(FlagModel.type == IssueType.image) + .dicts() + .iterator() + ) + } + + @api_v1_router.get("/flags/{flag_id}") def get_flag(flag_id: int): """Get a flag by ID.