Only return pending invitations from incomming
This commit is contained in:
parent
b6052eceb9
commit
fcf5a5d64d
|
@ -150,6 +150,7 @@ async def get_user_incomming_invitatinos(user_id: PydanticObjectId, user: Curren
|
|||
"""Get all incoming invitations for a given user.
|
||||
|
||||
Note that this endpoint only allows you to access the invitations you received.
|
||||
Only invitations with status "pending" are returned.
|
||||
"""
|
||||
if user.id is None:
|
||||
raise MissingIdError(user)
|
||||
|
@ -157,7 +158,11 @@ async def get_user_incomming_invitatinos(user_id: PydanticObjectId, user: Curren
|
|||
if user.id != user_id:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="You can only access your own invitations.")
|
||||
|
||||
invitations = await Invitation.find(expr(Invitation.invitee).id == user_id, fetch_links=True).to_list()
|
||||
invitations = await Invitation.find(
|
||||
expr(Invitation.invitee).id == user_id,
|
||||
Invitation.status == "pending",
|
||||
fetch_links=True,
|
||||
).to_list()
|
||||
|
||||
return [InvitationData.from_invitation(invitation) for invitation in invitations]
|
||||
|
||||
|
|
Loading…
Reference in a new issue