Karten-Ausbau (OSM), Forum-Erweiterung, UI-Komponenten, Refactor Tagebuch/Gassi (DRY), Landing/SEO — APP_VER 1155
This commit is contained in:
parent
2d907f6370
commit
10e39ed135
18 changed files with 871 additions and 405 deletions
|
|
@ -586,6 +586,25 @@ async def toggle_like(data: LikeBody, user=Depends(get_current_user)):
|
|||
return {"liked": liked, "count": count}
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# GET /api/forum/likes/{target_type}/{target_id} — Wer hat geliked?
|
||||
# ------------------------------------------------------------------
|
||||
@router.get("/likes/{target_type}/{target_id}")
|
||||
async def list_likers(target_type: str, target_id: int):
|
||||
if target_type not in _LIKE_TABLE:
|
||||
raise HTTPException(400, "Ungültiger Typ.")
|
||||
with db() as conn:
|
||||
rows = conn.execute(
|
||||
"""SELECT u.name AS name, u.founder_number AS founder_number
|
||||
FROM forum_likes fl
|
||||
JOIN users u ON u.id = fl.user_id
|
||||
WHERE fl.target_type = ? AND fl.target_id = ?
|
||||
ORDER BY fl.id DESC""",
|
||||
(target_type, target_id)
|
||||
).fetchall()
|
||||
return [dict(r) for r in rows]
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# POST /api/forum/report
|
||||
# ------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue