Skip to content

Commit

Permalink
feat: add route to get image flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Valimp committed Mar 20, 2024
1 parent 835e411 commit ad8b76e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ad8b76e

Please sign in to comment.