commit
3c851c8e8f
@ -18,13 +18,12 @@ def create_indexes():
|
||||
database.get_collection('configs').create_index([
|
||||
('stage', 1),
|
||||
('project', 1),
|
||||
('name', 1)
|
||||
])
|
||||
('name', 1),
|
||||
], unique=True)
|
||||
database.get_collection('experiments').create_index([
|
||||
('stage', 1),
|
||||
('project', 1),
|
||||
('name', 1)
|
||||
])
|
||||
], unique=True)
|
||||
database.get_collection('staff').create_index([
|
||||
('platform_id', 1),
|
||||
])
|
||||
], unique=True)
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user