Отедельные таблицы User и TelegramUser

This commit is contained in:
Artem Tsyrulnikov
2026-01-07 14:00:35 +03:00
parent 3e1ad27c66
commit f6669c3f5a
19 changed files with 344 additions and 74 deletions

View File

@@ -52,6 +52,18 @@ async def tg_add_project(self: 'Usecase', input: dto.ConnectProjectInput) -> dto
input.user_telegram_id,
)
raise domain.UserNotFound()
if user.telegram_user is None:
log.warning('User %s missing telegram profile when connecting channel', user.id)
await self.telegram_bot.send_message(
'⚠️ Произошла ошибка при обработке вашего профиля. Пожалуйста, повторите авторизацию.',
input.user_telegram_id,
)
raise domain.UserNotFound()
if user.telegram_user is None:
raise domain.UserNotFound(user.id)
telegram_user = user.telegram_user
memberships = await self.database.get_user_workspaces(user.id)
workspaces: list[domain.Workspace] = []
@@ -154,10 +166,10 @@ async def tg_add_project(self: 'Usecase', input: dto.ConnectProjectInput) -> dto
f'Бот добавлен в канал "{input.title}".\n\n'
f'У вас {len(workspaces)} рабочих пространств. '
'Нажмите кнопку ниже чтобы выбрать, где создать проект.',
user.telegram_id,
telegram_user.telegram_id,
buttons,
)
log.info('Pending channel notification sent to user %s for channel %s', user.telegram_id, channel.id)
log.info('Pending channel notification sent to user %s for channel %s', telegram_user.telegram_id, channel.id)
return None