This commit is contained in:
vladislav 2026-09-08 04:41:20 -04:00
parent 002235b6f6
commit 66539d373a
Signed by: Vladislav
GPG Key ID: D97C9E5E4860EE45
2 changed files with 26 additions and 0 deletions

View File

@ -69,6 +69,19 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"async def notify_in_profile(item: NotifyItem):\n", "async def notify_in_profile(item: NotifyItem):\n",
" user = await users_collection.find_one({'_id': ObjectId(str(item.user_id))},{'email':1})\n",
" login_link = f'{FULL_DOMAIN}/login/{await token_create(str(user['_id']), url=f'/profile')}'\n",
" if PROD:\n",
" email_task.notify.delay(user['email'], {\n",
" 'text': 'в личном кабинете',\n",
" 'list': [[]],\n",
" 'primary': {\n",
" 'href': login_link,\n",
" 'text': 'Войти и посмотреть'\n",
" },\n",
" 'title': 'новое уведомление',\n",
" 'login_link': login_link,\n",
" }, 'Уведомление', 'main.html')\n",
" return await notify_collection.update_one(\n", " return await notify_collection.update_one(\n",
" {\n", " {\n",
" \"user_id\": item.user_id,\n", " \"user_id\": item.user_id,\n",

View File

@ -12,6 +12,19 @@ import asyncio
async def notify_in_profile(item: NotifyItem): async def notify_in_profile(item: NotifyItem):
user = await users_collection.find_one({'_id': ObjectId(str(item.user_id))},{'email':1})
login_link = f'{FULL_DOMAIN}/login/{await token_create(str(user['_id']), url=f'/profile')}'
if PROD:
email_task.notify.delay(user['email'], {
'text': 'в личном кабинете',
'list': [[]],
'primary': {
'href': login_link,
'text': 'Войти и посмотреть'
},
'title': 'новое уведомление',
'login_link': login_link,
}, 'Уведомление', 'main.html')
return await notify_collection.update_one( return await notify_collection.update_one(
{ {
"user_id": item.user_id, "user_id": item.user_id,