Feature: Admin Action-Items-Karte über Tabs, SW by-v587
This commit is contained in:
parent
fb7bbe5ccc
commit
d04110c2ae
4 changed files with 98 additions and 2 deletions
|
|
@ -97,6 +97,40 @@ class ThreadAdminPatch(BaseModel):
|
|||
is_deleted: Optional[int] = None
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# GET /api/admin/action-items
|
||||
# ------------------------------------------------------------------
|
||||
@router.get("/action-items")
|
||||
async def action_items(user=Depends(require_mod)):
|
||||
with db() as conn:
|
||||
jobs = conn.execute(
|
||||
"SELECT COUNT(*) FROM job_applications WHERE status IN ('pending','reviewing')"
|
||||
).fetchone()[0]
|
||||
breeders = conn.execute(
|
||||
"SELECT COUNT(*) FROM users WHERE breeder_status='pending'"
|
||||
).fetchone()[0]
|
||||
reports = conn.execute(
|
||||
"SELECT COUNT(*) FROM forum_reports WHERE resolved=0"
|
||||
).fetchone()[0]
|
||||
fotos = conn.execute(
|
||||
"SELECT COUNT(*) FROM wiki_foto_submissions WHERE status='pending'"
|
||||
).fetchone()[0]
|
||||
poi_edits = conn.execute(
|
||||
"SELECT COUNT(*) FROM osm_poi_edits WHERE status='pending'"
|
||||
).fetchone()[0]
|
||||
users_today = conn.execute(
|
||||
"SELECT COUNT(*) FROM users WHERE DATE(created_at)=DATE('now')"
|
||||
).fetchone()[0]
|
||||
return {
|
||||
"jobs_pending": jobs,
|
||||
"breeder_pending": breeders,
|
||||
"reports_open": reports,
|
||||
"fotos_pending": fotos,
|
||||
"poi_edits_pending": poi_edits,
|
||||
"users_today": users_today,
|
||||
}
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# GET /api/admin/stats
|
||||
# ------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue