Fix automatic image deletion
This commit is contained in:
parent
b65805aed5
commit
c59bf2fcc9
@ -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)})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user