Fix: ki_health_reports ALTER TABLE user_id Migration, INSERT try/catch, Bericht immer zurückgeben (SW by-v807)
This commit is contained in:
parent
0b06669635
commit
891e11df65
6 changed files with 24 additions and 16 deletions
|
|
@ -454,11 +454,14 @@ async def ki_zusammenfassung(dog_id: int, user=Depends(get_current_user)):
|
|||
user_is_premium=bool(user.get("is_premium")),
|
||||
user_id=user["id"],
|
||||
)
|
||||
with db() as conn:
|
||||
conn.execute(
|
||||
"INSERT INTO ki_health_reports (dog_id, user_id, bericht) VALUES (?,?,?)",
|
||||
(dog_id, user["id"], result)
|
||||
)
|
||||
try:
|
||||
with db() as conn:
|
||||
conn.execute(
|
||||
"INSERT INTO ki_health_reports (dog_id, user_id, bericht) VALUES (?,?,?)",
|
||||
(dog_id, user["id"], result)
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(f"KI-Bericht konnte nicht gespeichert werden: {e}")
|
||||
return {"zusammenfassung": result}
|
||||
except KIPremiumRequired as e:
|
||||
raise HTTPException(402, str(e))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue