Fix+Feature: data-modal-close global fix, Breeder-Profil Logo+Galerie (SW by-v901)
This commit is contained in:
parent
b17706e7ba
commit
c417891546
7 changed files with 76 additions and 13 deletions
|
|
@ -395,6 +395,33 @@ async def breeder_public_profile(zwingername: str):
|
|||
""", (breeder_id,)).fetchall()
|
||||
result["ed_stats"] = [dict(r) for r in ed_stats]
|
||||
|
||||
# Logo = primäres Bild der entity_type='breeder' Fotos
|
||||
logo = conn.execute("""
|
||||
SELECT file_path FROM breeder_photos
|
||||
WHERE breeder_id=? AND entity_type='breeder' AND is_primary=1
|
||||
LIMIT 1
|
||||
""", (breeder_id,)).fetchone()
|
||||
if not logo:
|
||||
logo = conn.execute("""
|
||||
SELECT file_path FROM breeder_photos
|
||||
WHERE breeder_id=? AND entity_type='breeder'
|
||||
ORDER BY sort_order, id LIMIT 1
|
||||
""", (breeder_id,)).fetchone()
|
||||
result["logo_url"] = f"/api/media/{logo['file_path']}" if logo else None
|
||||
|
||||
# Öffentliche Fotos für die Gallery (alle entity_type='breeder', max. 12)
|
||||
photos = conn.execute("""
|
||||
SELECT file_path, thumbnail_path, caption, is_primary FROM breeder_photos
|
||||
WHERE breeder_id=? AND entity_type='breeder' AND visibility IN ('public','inquiry')
|
||||
ORDER BY is_primary DESC, sort_order, id LIMIT 12
|
||||
""", (breeder_id,)).fetchall()
|
||||
result["fotos"] = [{
|
||||
"url": f"/api/media/{p['file_path']}",
|
||||
"thumb": f"/api/media/{p['thumbnail_path']}" if p['thumbnail_path'] else f"/api/media/{p['file_path']}",
|
||||
"caption": p["caption"] or "",
|
||||
"primary": bool(p["is_primary"]),
|
||||
} for p in photos]
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue