This commit is contained in:
vladislav 2026-09-03 06:04:35 -04:00
parent a7a03d321d
commit d1d9c5e9de
Signed by: Vladislav
GPG Key ID: D97C9E5E4860EE45
3 changed files with 24 additions and 11 deletions

View File

@ -56,11 +56,15 @@ async def send_delivery(
continue continue
# Уведомление получателю # Уведомление получателю
if (exhibition:=existing.get('exhibition',{})) and (exhibition_id:=existing.get('exhibition_id')):
link = f'/profile/delivery/exhibition/{exhibition_id}'
else:
link = f'/profile/delivery'
notify = await notify_in_profile(NotifyItem( notify = await notify_in_profile(NotifyItem(
user_id=str(existing["receiver"]["_id"]), user_id=str(existing["receiver"]["_id"]),
type_item="delivery", type_item="delivery",
title="Доставка картин", title="Доставка картин",
link="/profile/delivery", link=link,
text=f"{str(existing['sender']['username'])} — прислал вам картины." text=f"{str(existing['sender']['username'])} — прислал вам картины."
)) ))
@ -106,13 +110,16 @@ async def accept_delivery(
if not existing: if not existing:
errors.append({"item": item_id, "error": "Доставка не найдена или не для вас"}) errors.append({"item": item_id, "error": "Доставка не найдена или не для вас"})
continue continue
if (exhibition:=existing.get('exhibition',{})) and (exhibition_id:=existing.get('exhibition_id')):
link = f'/profile/delivery/exhibition/{exhibition_id}'
else:
link = f'/profile/delivery'
# Уведомление отправителю # Уведомление отправителю
notify = await notify_in_profile(NotifyItem( notify = await notify_in_profile(NotifyItem(
user_id=str(existing["sender"]["_id"]), user_id=str(existing["sender"]["_id"]),
type_item="delivery", type_item="delivery",
title="Доставка картин", title="Доставка картин",
link="/profile/delivery", link=link,
text=f"Картина «{existing['title']}» получена — {str(existing['receiver']['username'])}." text=f"Картина «{existing['title']}» получена — {str(existing['receiver']['username'])}."
)) ))

View File

@ -678,12 +678,15 @@
" {'post_id': {'$in': other_ids}},\n", " {'post_id': {'$in': other_ids}},\n",
" {'$set': {'status': 'Приглашение отклонено'}} # как вы написали\n", " {'$set': {'status': 'Приглашение отклонено'}} # как вы написали\n",
" )\n", " )\n",
"\n", " if (exhibition:=invitation.get('exhibition',{})) and (exhibition_id:=invitation.get('exhibition_id')):\n",
" link = f'/profile/delivery/exhibition/{exhibition_id}'\n",
" else:\n",
" link = f'/profile/delivery'\n",
" await notify_in_profile(NotifyItem(\n", " await notify_in_profile(NotifyItem(\n",
" user_id=invitation.get('exhibition',{}).get(\"user\",{}).get('_id'),\n", " user_id=exhibition.get(\"user\",{}).get('_id'),\n",
" type_item='c',\n", " type_item='c',\n",
" title=f'Выставка \"{invitation.get('exhibition',{}).get(\"title\")}\"',\n", " title=f'Выставка \"{exhibition.get(\"title\")}\"',\n",
" link=f'/profile/delivery',\n", " link=link,\n",
" text=f'Художник принял условия'\n", " text=f'Художник принял условия'\n",
" ))" " ))"
], ],

View File

@ -516,12 +516,15 @@ async def accept_invitations(invitations_id: str, posts_ids: List[str]):
{'post_id': {'$in': other_ids}}, {'post_id': {'$in': other_ids}},
{'$set': {'status': 'Приглашение отклонено'}} # как вы написали {'$set': {'status': 'Приглашение отклонено'}} # как вы написали
) )
if (exhibition:=invitation.get('exhibition',{})) and (exhibition_id:=invitation.get('exhibition_id')):
link = f'/profile/delivery/exhibition/{exhibition_id}'
else:
link = f'/profile/delivery'
await notify_in_profile(NotifyItem( await notify_in_profile(NotifyItem(
user_id=invitation.get('exhibition',{}).get("user",{}).get('_id'), user_id=exhibition.get("user",{}).get('_id'),
type_item='c', type_item='c',
title=f'Выставка "{invitation.get('exhibition',{}).get("title")}"', title=f'Выставка "{exhibition.get("title")}"',
link=f'/profile/delivery', link=link,
text=f'Художник принял условия' text=f'Художник принял условия'
)) ))