Fix automatic image deletion
This commit is contained in:
1 parent
b65805aed5
commit
c59bf2fcc9
1 file changed
+2
-1
@@ -267,7 +267,8 @@ async def delete_flight(id: str) -> FlightDisplaySchema:
|
|||||||
raise HTTPException(404, "Flight not found")
|
raise HTTPException(404, "Flight not found")
|
||||||
|
|
||||||
# Delete associated images
|
# Delete associated images
|
||||||
for image in flight.images:
|
if "images" in flight:
|
||||||
|
for image in flight["images"]:
|
||||||
await delete_image(image)
|
await delete_image(image)
|
||||||
|
|
||||||
await flight_collection.delete_one({"_id": to_objectid(id)})
|
await flight_collection.delete_one({"_id": to_objectid(id)})
|
||||||
|
|||||||
Reference in new issue
Block a user