feat: add admin media label search
This commit is contained in:
@@ -38,6 +38,7 @@ def admin_media_catalog(
|
||||
entity_type: str | None = Query(None, pattern="^(fish|waterbody|tackle|reference)$"),
|
||||
status: str | None = Query(None, pattern="^(approved|upgrade_queued|upgrade_stored)$"),
|
||||
media_role: str | None = Query(None, pattern="^(waterbody_cover|waterbody_map|waterbody_depth_map|waterbody_screenshot|tackle_card|tackle_detail|rig_diagram|tackle_screenshot)$"),
|
||||
q: str | None = Query(None, max_length=100),
|
||||
limit: int = Query(50, ge=1, le=100),
|
||||
offset: int = Query(0, ge=0),
|
||||
) -> list[AdminMediaReviewOut]:
|
||||
@@ -45,7 +46,7 @@ def admin_media_catalog(
|
||||
raise HTTPException(status_code=422, detail="unknown media role")
|
||||
if media_role and (not entity_type or media_role not in MEDIA_ROLES_BY_ENTITY.get(entity_type, set())):
|
||||
raise HTTPException(status_code=422, detail="media role is incompatible with entity type")
|
||||
return review_assets(entity_type, status, media_role)[offset:offset + limit]
|
||||
return review_assets(entity_type, status, media_role, q.strip() if q else None)[offset:offset + limit]
|
||||
|
||||
|
||||
@router.get("/api/v1/admin/media/assets/{digest}", response_class=FileResponse)
|
||||
|
||||
Reference in New Issue
Block a user