fix
All checks were successful
Deploy Dev / Build (pull_request) Successful in 6s
Deploy Dev / Push (pull_request) Successful in 8s
Deploy Prod / Build (pull_request) Successful in 5s
Deploy Dev / Deploy dev (pull_request) Successful in 8s
Deploy Prod / Push (pull_request) Successful in 8s
Deploy Prod / Deploy prod (pull_request) Successful in 7s

This commit is contained in:
emmatveev 2024-11-24 11:54:10 +03:00
parent 728fe12a1a
commit 6323fb6a26
2 changed files with 7 additions and 5 deletions

View File

@ -18,11 +18,12 @@ def create_indexes():
database.get_collection('configs').create_index([
('stage', 1),
('project', 1),
])
('name', 1),
], unique=True)
database.get_collection('experiments').create_index([
('stage', 1),
('project', 1),
])
], unique=True)
database.get_collection('staff').create_index([
('platform_id', 1),
])
], unique=True)

View File

@ -13,6 +13,7 @@ class Staff(pydantic.BaseModel):
yandex_id: int|None = None
telegram_id: int|None = None
email: str|None = None
telegram_username: str|None = None
async def create(staff: Staff) -> str:
@ -20,8 +21,8 @@ async def create(staff: Staff) -> str:
return result.inserted_id
async def update(platform_id: int, vk_id: int|None, yandex_id: int|None, telegram_id: int|None, email: str|None) -> bool:
result = await collection.update_one({'platform_id': platform_id}, {'$set': {'vk_id': vk_id, 'yandex_id': yandex_id, 'telegram_id': telegram_id, 'email': email}})
async def update(platform_id: int, vk_id: int|None, yandex_id: int|None, telegram_id: int|None, email: str|None, telegram_username: str|None) -> bool:
result = await collection.update_one({'platform_id': platform_id}, {'$set': {'vk_id': vk_id, 'yandex_id': yandex_id, 'telegram_id': telegram_id, 'email': email, 'telegram_username': telegram_username}})
return result.modified_count != 0