From ebcd1de8e6f2e34b5beb721cfc3a22fad6ec8278 Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Wed, 28 May 2025 18:54:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20user=5Fid=20to=20become=20?= =?UTF-8?q?null=20on=20pin=20update=20(rare=20bug)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routes/pins.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/routes/pins.py b/app/routes/pins.py index b74f31d..036a802 100644 --- a/app/routes/pins.py +++ b/app/routes/pins.py @@ -74,6 +74,9 @@ async def update_pin(id: str, pin: PinDTO, current_user: User = Depends(get_curr if not permission: raise HTTPException(status_code=403, detail="You don't have permission to edit this pin") + # Ajouter l'ID de l'utilisateur au PinDTO + pin.user_id = current_user.uid + # Mettre à jour le pin pins_collection.update_one({"_id": ObjectId(id)}, {"$set": pin.model_dump()})