Skip to content

Commit

Permalink
Fix call on appointment id before NoneType check (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmount authored Jul 3, 2023
1 parent f00f23e commit 2c8fca0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/src/routes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,11 @@ def delete_my_appointment(id: int, db: Session = Depends(get_db), subscriber: Su
def read_public_appointment(slug: str, db: Session = Depends(get_db)):
"""endpoint to retrieve an appointment from db via public link and only expose necessary data"""
a = repo.get_public_appointment(db, slug=slug)
s = repo.get_subscriber_by_appointment(db=db, appointment_id=a.id)
if a is None or s is None:
if a is None:
raise HTTPException(status_code=404, detail="Appointment not found")
s = repo.get_subscriber_by_appointment(db=db, appointment_id=a.id)
if s is None:
raise HTTPException(status_code=404, detail="Subscriber not found")
slots = [
schemas.SlotOut(id=sl.id, start=sl.start, duration=sl.duration, attendee_id=sl.attendee_id) for sl in a.slots
]
Expand Down

0 comments on commit 2c8fca0

Please sign in to comment.