Fix automatic image deletion

This commit is contained in:
april 2024-01-15 17:12:26 -06:00
parent b65805aed5
commit c59bf2fcc9

View File

@ -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)})