fix
This commit is contained in:
parent
b36ba2aaa4
commit
2fa5c0c39f
21
main.py
21
main.py
@ -3185,7 +3185,26 @@ async def profile_invitation(
|
||||
user: Dict = Security(get_current_user)
|
||||
):
|
||||
data = await invitations_collection.find_one({'_id': ObjectId(invitation_id)})
|
||||
posts = await delivery_collection.find({'competition_id': data.get('competition').get('_id')}).to_list()
|
||||
cursor = delivery_collection.aggregate([
|
||||
{"$match": {
|
||||
"$or": [
|
||||
{"sender._id": user.get('_id')},
|
||||
{"user._id": user.get('_id')},
|
||||
{"receiver._id": user.get('_id')}
|
||||
],
|
||||
'prod': PROD,
|
||||
'competition_id': data.get('competition').get('_id'),
|
||||
}},
|
||||
{"$sort": {"_id": -1}},
|
||||
{"$group": {
|
||||
"_id": "$post_id",
|
||||
"doc": {"$first": "$$ROOT"}
|
||||
}},
|
||||
{"$replaceRoot": {"newRoot": "$doc"}},
|
||||
{"$sort": {"_id": -1}},
|
||||
])
|
||||
|
||||
posts = [doc async for doc in cursor]
|
||||
return templates.TemplateResponse(
|
||||
request=request, name="profile/invitation.html", context={ "user": user, "doc": data, "data": posts}
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user