Suppose that you have a hotel and you want to create an API for your customer to make a reservation.
Assumption
- Your restaurant has a total of 10 rooms.
- All customers can make reservations regardless that day has passed.
Use get
method to retrieve the details of the reservation by name of booker.
Use get
method to retrieve all the reservation in that room.
Use post
method to make a reservation.
Use put
method to update the specific reservation.
Use delete
method to cancel the specific reservation.
Conditions:
- Error handling (e.g., the start date must come before the end date)
- date format must be ("YYYY-MM-DD")
- "2017-07-3 != 2017-07-03"
- The booking time must not overlap with other people's bookings. (including updated reservations)
- room_id must be in the range 1 to 10
- raise HTTPException 400, when the result was unsuccessful
- Set variable in test/fastapi_test.py
- run
uvicorn main:app --reload
- run
python test/fastapi_test.py