from __future__ import annotations from telegram import Update, InputMediaPhoto from telegram.ext import ContextTypes from app.core.db import db_session from app.repositories.candidate_repo import CandidateRepository from app.utils.common import csv_to_list async def my_profile_handler(update: Update, context: ContextTypes.DEFAULT_TYPE): """Команда /my — показать свою анкету.""" with db_session() as s: repo = CandidateRepository(s) c = repo.by_tg(update.effective_user.id) if not c: await update.message.reply_text("Анкета не найдена. Начни с /new") return text = ( f"Твоя анкета:\n" f"{c.full_name or '—'} (@{update.effective_user.username or ''})\n" f"Город: {c.city or '—'}\n" f"Цель: {c.goal or '—'}" ) if c.avatar_file_id: await update.message.reply_photo(photo=c.avatar_file_id, caption=text) else: await update.message.reply_text(text) gallery = csv_to_list(c.gallery_file_ids) if gallery: media = [InputMediaPhoto(g) for g in gallery[:10]] await update.message.reply_media_group(media) async def edit_hint_handler(update: Update, context: ContextTypes.DEFAULT_TYPE): """Команда /edit — пока только подсказка о редактировании.""" await update.message.reply_text( "Точечное редактирование будет добавлено командами /edit_*. Пока что для правок — /new (перезаполнить анкету)." )