Compare commits

..

No commits in common. "3c851c8e8fe142867a7bd659b3ad8a90d6565de5" and "434f553ce4da62d92bc4d5375227543f6e89d084" have entirely different histories.

2 changed files with 7 additions and 7 deletions

View File

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

View File

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