build
This commit is contained in:
parent
e4ab7d9c1e
commit
1d279ff176
16
main.py
16
main.py
@ -1546,7 +1546,6 @@ async def partner_competition_request_artist(
|
|||||||
print(data)
|
print(data)
|
||||||
competition = await competitions_col.find_one({'_id':ObjectId(data.competition_id), 'user._id': current_user.get('_id')})
|
competition = await competitions_col.find_one({'_id':ObjectId(data.competition_id), 'user._id': current_user.get('_id')})
|
||||||
if competition:
|
if competition:
|
||||||
if PROD:
|
|
||||||
await competition_request_col.update_many(
|
await competition_request_col.update_many(
|
||||||
{'user._id': data.user_id, 'competition_id': data.competition_id},
|
{'user._id': data.user_id, 'competition_id': data.competition_id},
|
||||||
{'$set': {'status': True,"posts.$[].status": 'Проходит' }},
|
{'$set': {'status': True,"posts.$[].status": 'Проходит' }},
|
||||||
@ -1555,14 +1554,23 @@ async def partner_competition_request_artist(
|
|||||||
social_vk = await social_collection.find_one({'user_id':current_user.get('_id'), 'group': {"$exists": False}, 'type':'vk'})
|
social_vk = await social_collection.find_one({'user_id':current_user.get('_id'), 'group': {"$exists": False}, 'type':'vk'})
|
||||||
user = display_user(current_user)
|
user = display_user(current_user)
|
||||||
user['social_vk'] = social_vk
|
user['social_vk'] = social_vk
|
||||||
await invitations_collection.insert_one({
|
await invitations_collection.update_one({
|
||||||
"user_id": data.user_id,
|
"user_id": data.user_id,
|
||||||
"item": competition['title'],
|
"item": competition.get('title'),
|
||||||
"title": "Вы прошли отбор",
|
"title": "Вы прошли отбор",
|
||||||
|
"type_": competition.get("type_"),
|
||||||
"user": user,
|
"user": user,
|
||||||
"prod": PROD,
|
"prod": PROD,
|
||||||
"type": "Конкурс"
|
"type": "Конкурс"
|
||||||
})
|
},{'$set':{
|
||||||
|
"user_id": data.user_id,
|
||||||
|
"item": competition.get('title'),
|
||||||
|
"title": "Вы прошли отбор",
|
||||||
|
"type_": competition.get("type_"),
|
||||||
|
"user": user,
|
||||||
|
"prod": PROD,
|
||||||
|
"type": "Конкурс"
|
||||||
|
}},upsert=True)
|
||||||
return {'ok': True}
|
return {'ok': True}
|
||||||
else:
|
else:
|
||||||
return {'ok': False}
|
return {'ok': False}
|
||||||
|
|||||||
22
tasks.py
22
tasks.py
@ -631,7 +631,7 @@ async def update_competition_req(competition, user, posts):
|
|||||||
# Генерация login link
|
# Генерация login link
|
||||||
token = await token_create(
|
token = await token_create(
|
||||||
str(user['_id']),
|
str(user['_id']),
|
||||||
url=f'/profile/delivery#main'
|
url=f'/profile/invitation#main'
|
||||||
)
|
)
|
||||||
login_link = f'{FULL_DOMAIN}/login/{token}'
|
login_link = f'{FULL_DOMAIN}/login/{token}'
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ async def update_competition_req(competition, user, posts):
|
|||||||
user_id=str(user['_id']),
|
user_id=str(user['_id']),
|
||||||
type_item='invitation',
|
type_item='invitation',
|
||||||
title='Приглашение',
|
title='Приглашение',
|
||||||
link=f'/profile/delivery',
|
link=f'/profile/invitation',
|
||||||
text=f'Вы прошли отбор на конкурсе "{competition.get("title")}"'
|
text=f'Вы прошли отбор на конкурсе "{competition.get("title")}"'
|
||||||
))
|
))
|
||||||
all_allowed = all(
|
all_allowed = all(
|
||||||
@ -692,7 +692,23 @@ async def update_competition_req(competition, user, posts):
|
|||||||
|
|
||||||
# Email-уведомление
|
# Email-уведомление
|
||||||
if user.get('email') and all_allowed and has_approved:
|
if user.get('email') and all_allowed and has_approved:
|
||||||
print([i['title'] for i in posts_sorted])
|
await invitations_collection.update_one({
|
||||||
|
"user_id": str(user['_id']),
|
||||||
|
"item": competition.get("title"),
|
||||||
|
"title": "Вы прошли отбор",
|
||||||
|
"type_": competition.get("type_"),
|
||||||
|
"user": display_user(competition_owner),
|
||||||
|
"prod": PROD,
|
||||||
|
"type": "Конкурс"
|
||||||
|
},{'$set':{
|
||||||
|
"user_id": str(user['_id']),
|
||||||
|
"item": competition.get("title"),
|
||||||
|
"title": "Вы прошли отбор",
|
||||||
|
"type_": competition.get("type_"),
|
||||||
|
"user": display_user(competition_owner),
|
||||||
|
"prod": PROD,
|
||||||
|
"type": "Конкурс"
|
||||||
|
}},upsert=True)
|
||||||
if PROD and user.get('email') and all_allowed and has_approved:
|
if PROD and user.get('email') and all_allowed and has_approved:
|
||||||
email_data = {
|
email_data = {
|
||||||
'text': 'Статус заявки обновлен',
|
'text': 'Статус заявки обновлен',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user