Skip to content

Commit

Permalink
remove applicant_id in the enpoint as it will never be used for anyon…
Browse files Browse the repository at this point in the history
…e else than the user
  • Loading branch information
julien4215 committed Nov 12, 2023
1 parent cdb7109 commit 10198e8
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions app/endpoints/booking.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,28 +226,22 @@ async def get_confirmed_bookings(


@router.get(
"/booking/bookings/users/{applicant_id}",
"/booking/bookings/users/me",
response_model=list[schemas_booking.BookingReturn],
status_code=200,
tags=[Tags.booking],
)
async def get_applicant_bookings(
applicant_id: str,
db: AsyncSession = Depends(get_db),
user: models_core.CoreUser = Depends(is_user_a_member),
):
"""
Get one user bookings.
Get the user bookings.
**Only usable by the user**
"""
if user.id == applicant_id:
bookings = await cruds_booking.get_applicant_bookings(
db=db, applicant_id=applicant_id
)
return bookings
else:
raise HTTPException(status_code=403)
bookings = await cruds_booking.get_applicant_bookings(db=db, applicant_id=user.id)
return bookings


@router.post(
Expand Down

0 comments on commit 10198e8

Please sign in to comment.