Fix: /breeder/my-editor Endpoint (Crash 'Cannot destructure profile') + Läufigkeit in Züchter-Bereich
breeder-editor.js (aus 459cd42) rief /api/breeder/my-editor auf — Endpoint
existierte nie (gleicher Worktree-Verlust wie /partner/my-profile). Jetzt
gebaut: profile + litters + storage_mb/limit; ohne Profil klare 404 statt
Destrukturierungs-Crash. 3 Tests.
Läufigkeit (Rene): eigener HUND-Chip entfällt, stattdessen vierte Karte im
Züchter-Bereich (Zyklen, Progesterontests, Deckdaten). Suite: 58 passed.
This commit is contained in:
parent
ed7c469c6a
commit
487dacc7c7
9 changed files with 100 additions and 20 deletions
|
|
@ -491,6 +491,43 @@ class BreederProfileUpdate(BaseModel):
|
|||
website: Optional[str] = Field(None, max_length=500)
|
||||
beschreibung: Optional[str] = Field(None, max_length=10000)
|
||||
|
||||
@router.get("/breeder/my-editor")
|
||||
async def breeder_my_editor(user=Depends(require_breeder)):
|
||||
"""Daten für den Profil-Editor: Profil + eigene Würfe + Speicherverbrauch.
|
||||
(Frontend breeder-editor.js stammt aus 459cd42 — dieser Lese-Endpoint
|
||||
ging damals im Worktree-Merge verloren, wie /partner/my-profile.)"""
|
||||
with db() as conn:
|
||||
profile = conn.execute(
|
||||
"SELECT * FROM breeder_profiles WHERE user_id=?", (user["id"],)
|
||||
).fetchone()
|
||||
if not profile:
|
||||
raise HTTPException(404, "Noch kein Züchter-Profil angelegt.")
|
||||
profile = dict(profile)
|
||||
litters = [dict(r) for r in conn.execute(
|
||||
"SELECT * FROM litters WHERE breeder_id=? ORDER BY created_at DESC",
|
||||
(profile["id"],)
|
||||
).fetchall()]
|
||||
|
||||
# Speicherverbrauch der Züchter-Medien (MEDIA_DIR/breeders/{breeder_id}/**)
|
||||
media_dir = os.getenv("MEDIA_DIR", "/data/media")
|
||||
base = os.path.join(media_dir, "breeders", str(profile["id"]))
|
||||
total = 0
|
||||
if os.path.isdir(base):
|
||||
for root, _dirs, files in os.walk(base):
|
||||
for f in files:
|
||||
try:
|
||||
total += os.path.getsize(os.path.join(root, f))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
return {
|
||||
"profile": profile,
|
||||
"litters": litters,
|
||||
"storage_mb": round(total / (1024 * 1024), 4),
|
||||
"storage_limit_mb": 200,
|
||||
}
|
||||
|
||||
|
||||
@router.put("/breeder/profile")
|
||||
async def update_breeder_profile(body: BreederProfileUpdate, user=Depends(require_breeder)):
|
||||
with db() as conn:
|
||||
|
|
|
|||
|
|
@ -86,14 +86,14 @@
|
|||
<title>Ban Yaro</title>
|
||||
|
||||
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
|
||||
<script src="/js/boot-early.js?v=1266"></script>
|
||||
<script src="/js/boot-early.js?v=1267"></script>
|
||||
|
||||
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
|
||||
<link rel="stylesheet" href="/css/design-system.css?v=1266">
|
||||
<link rel="stylesheet" href="/css/layout.css?v=1266">
|
||||
<link rel="stylesheet" href="/css/components.css?v=1266">
|
||||
<link rel="stylesheet" href="/css/utilities.css?v=1266">
|
||||
<link rel="stylesheet" href="/css/lists.css?v=1266">
|
||||
<link rel="stylesheet" href="/css/design-system.css?v=1267">
|
||||
<link rel="stylesheet" href="/css/layout.css?v=1267">
|
||||
<link rel="stylesheet" href="/css/components.css?v=1267">
|
||||
<link rel="stylesheet" href="/css/utilities.css?v=1267">
|
||||
<link rel="stylesheet" href="/css/lists.css?v=1267">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
@ -620,11 +620,11 @@
|
|||
<div id="modal-container"></div>
|
||||
|
||||
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
||||
<script src="/js/api.js?v=1266"></script>
|
||||
<script src="/js/ui.js?v=1266"></script>
|
||||
<script src="/js/app.js?v=1266"></script>
|
||||
<script src="/js/worlds.js?v=1266"></script>
|
||||
<script src="/js/offline-indicator.js?v=1266"></script>
|
||||
<script src="/js/api.js?v=1267"></script>
|
||||
<script src="/js/ui.js?v=1267"></script>
|
||||
<script src="/js/app.js?v=1267"></script>
|
||||
<script src="/js/worlds.js?v=1267"></script>
|
||||
<script src="/js/offline-indicator.js?v=1267"></script>
|
||||
|
||||
<!-- Feature-Seiten werden lazy geladen -->
|
||||
|
||||
|
|
@ -634,7 +634,7 @@
|
|||
|
||||
|
||||
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
|
||||
<script src="/js/boot.js?v=1266"></script>
|
||||
<script src="/js/boot.js?v=1267"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Router, State-Management, Navigation, Initialisierung.
|
||||
============================================================ */
|
||||
|
||||
const APP_VER = '1266'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VER = '1267'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||
window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator)
|
||||
window.APP_VERSION = APP_VERSION;
|
||||
|
|
|
|||
|
|
@ -112,8 +112,19 @@ window.Page_breeder_dashboard = (() => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-xs-muted" style="padding:0 var(--space-1)">
|
||||
${UI.icon('info')} Läufigkeit & Trächtigkeit findest du wie gewohnt in der HUND-Welt.
|
||||
<!-- Läufigkeit & Trächtigkeit -->
|
||||
<div class="card" style="padding:var(--space-4);margin-bottom:var(--space-3)">
|
||||
<div style="display:flex;align-items:center;gap:var(--space-3)">
|
||||
<div style="width:44px;height:44px;border-radius:var(--radius-md);background:rgba(236,72,153,.12);
|
||||
display:flex;align-items:center;justify-content:center;flex-shrink:0">
|
||||
<svg class="ph-icon" style="width:22px;height:22px;color:#EC4899"><use href="/icons/phosphor.svg#thermometer"></use></svg>
|
||||
</div>
|
||||
<div class="flex-1-min">
|
||||
<div style="font-weight:700">Läufigkeit & Trächtigkeit</div>
|
||||
<div class="text-xs-muted">Zyklen, Progesterontests, Deckdaten, Meilensteine</div>
|
||||
</div>
|
||||
<button class="btn btn-sm btn-secondary" data-bd-nav="laeufi">Öffnen</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -573,7 +573,6 @@ window.Worlds = (() => {
|
|||
{ icon:'certificate', label:'Züchter', page:'breeder-dashboard', role:'breeder',
|
||||
fab:[{ icon:'notebook', color:'#10B981', label:'Wurf anlegen', sub:'Neuen Wurf eintragen', page:'litters', action:'openNew' },
|
||||
{ icon:'tree-structure', color:'#8B5CF6', label:'Zuchthund eintragen', sub:'Neuen Hund anlegen', page:'zuchthunde', action:'openNew' }] },
|
||||
{ icon:'thermometer', label:'Läufigkeit', page:'laeufi', role:'breeder' },
|
||||
{ icon:'sparkle', label:'Social', page:'social', role:'social',
|
||||
fab:[{ icon:'sparkle', color:'#EC4899', label:'Social-Post', sub:'Beitrag erstellen', page:'social', action:'openNew' }] },
|
||||
{ icon:'shield-check', label:'Moderation', page:'moderation', role:'mod' },
|
||||
|
|
@ -589,7 +588,7 @@ window.Worlds = (() => {
|
|||
const _DEFAULT_CONFIG = {
|
||||
jetzt: ['notes','expenses','erste-hilfe','playdate','chat','wetter','social','moderation','partner-dashboard','admin'],
|
||||
hund: ['diary','health','uebungen','trainingsplaene','adoption','sitting','wiki','wurfboerse',
|
||||
'breeder-dashboard','laeufi','ernaehrung','personality'],
|
||||
'breeder-dashboard','ernaehrung','personality'],
|
||||
welt: ['map','forum','friends','walks','poison','recalls','lost','routes','events',
|
||||
'jobs','knigge','movies','reise'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<script src="/js/landing-init.js?v=1266"></script>
|
||||
<script src="/js/landing-init.js?v=1267"></script>
|
||||
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
|
||||
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, direkt im Browser.">
|
||||
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
============================================================ */
|
||||
|
||||
// ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab
|
||||
const VER = '1266';
|
||||
const VER = '1267';
|
||||
const CACHE_VERSION = `by-v${VER}`;
|
||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue