Change update_flight return value to be consistent with others
This commit is contained in:
parent
d61b473869
commit
403ce0d9bc
@ -71,7 +71,10 @@ async def update_flight(body: FlightCreateSchema, id: str) -> FlightDisplaySchem
|
||||
raise HTTPException(404, "Flight not found")
|
||||
|
||||
updated_flight = await flight_collection.update_one({"_id": ObjectId(id)}, {"$set": body.model_dump()})
|
||||
return updated_flight.upserted_id
|
||||
if updated_flight is None:
|
||||
raise HTTPException(500, "Failed to update flight")
|
||||
|
||||
return id
|
||||
|
||||
|
||||
async def delete_flight(id: str) -> FlightDisplaySchema:
|
||||
|
@ -100,9 +100,9 @@ async def add_flight(flight_body: FlightCreateSchema, user: UserDisplaySchema =
|
||||
return {"id": str(flight)}
|
||||
|
||||
|
||||
@router.put('/{flight_id}', summary="Update the given flight with new information", status_code=201)
|
||||
@router.put('/{flight_id}', summary="Update the given flight with new information", status_code=200)
|
||||
async def update_flight(flight_id: str, flight_body: FlightCreateSchema,
|
||||
user: UserDisplaySchema = Depends(get_current_user)) -> str:
|
||||
user: UserDisplaySchema = Depends(get_current_user)) -> dict:
|
||||
"""
|
||||
Update the given flight with new information
|
||||
|
||||
@ -121,7 +121,7 @@ async def update_flight(flight_id: str, flight_body: FlightCreateSchema,
|
||||
|
||||
updated_flight_id = await db.update_flight(flight_body, flight_id)
|
||||
|
||||
return str(updated_flight_id)
|
||||
return {"id": str(updated_flight_id)}
|
||||
|
||||
|
||||
@router.delete('/{flight_id}', summary="Delete the given flight", status_code=200, response_model=FlightDisplaySchema)
|
||||
|
Loading…
x
Reference in New Issue
Block a user