Chore: Sprint32-36 Zwischenstand — alle Änderungen aus dieser Session committen
This commit is contained in:
parent
f4052fbb7d
commit
747c353444
20 changed files with 3115 additions and 63 deletions
|
|
@ -315,11 +315,13 @@ async def update_dog(dog_id: int, data: DogUpdate, user=Depends(get_current_user
|
|||
values = list(fields.values()) + [dog_id, user["id"]]
|
||||
|
||||
with db() as conn:
|
||||
conn.execute(
|
||||
updated = conn.execute(
|
||||
f"UPDATE dogs SET {set_clause} WHERE id=? AND user_id=?", values
|
||||
)
|
||||
).rowcount
|
||||
if not updated:
|
||||
raise HTTPException(404, "Hund nicht gefunden.")
|
||||
dog = conn.execute(
|
||||
"SELECT * FROM dogs WHERE id=?", (dog_id,)
|
||||
"SELECT * FROM dogs WHERE id=? AND user_id=?", (dog_id, user["id"])
|
||||
).fetchone()
|
||||
return dict(dog)
|
||||
|
||||
|
|
@ -413,8 +415,8 @@ async def delete_photo(dog_id: int, user=Depends(get_current_user)):
|
|||
os.remove(path)
|
||||
with db() as conn:
|
||||
conn.execute(
|
||||
"UPDATE dogs SET foto_url=NULL, foto_zoom=1.0, foto_offset_x=0.0, foto_offset_y=0.0 WHERE id=?",
|
||||
(dog_id,)
|
||||
"UPDATE dogs SET foto_url=NULL, foto_zoom=1.0, foto_offset_x=0.0, foto_offset_y=0.0 WHERE id=? AND user_id=?",
|
||||
(dog_id, user["id"])
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue