feat: Add A-Z filter for clients/suppliers in Telegram bot
- Add A-Z alphabetical filter keyboard for clients and suppliers lists (same pattern as company selection, without emoji) - Increase clients/suppliers list pagination from 10 to 20 items per page - Remove emoji from company A-Z filter button for consistency - Add 6 new callback handlers: clients_alpha_menu, clients_alpha:LETTER, clients_alpha_page:PAGE:LETTER, and supplier equivalents - Dashboard service and models updates - Telegram bot: email handlers, auth, DB operations, internal API improvements - Frontend: dashboard cards updates (CashFlow, Clienti, Furnizori, Treasury) - Frontend: SolduriCompactCard and CollapsibleCard improvements - DashboardView enhancements - start.sh and run-with-restart.sh script updates - IIS web.config and service worker updates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -148,6 +148,14 @@ async def init_database() -> None:
|
||||
ON email_auth_codes(expires_at)
|
||||
""")
|
||||
|
||||
# Migration: add server_id column to telegram_auth_codes if missing
|
||||
try:
|
||||
await db.execute("ALTER TABLE telegram_auth_codes ADD COLUMN server_id TEXT")
|
||||
await db.commit()
|
||||
logger.info("Migration: added server_id column to telegram_auth_codes")
|
||||
except Exception:
|
||||
pass # Column already exists
|
||||
|
||||
await db.commit()
|
||||
logger.info("Database initialized successfully")
|
||||
|
||||
|
||||
@@ -288,7 +288,8 @@ async def create_auth_code(
|
||||
code: str,
|
||||
telegram_user_id: int,
|
||||
oracle_username: str,
|
||||
expires_in_minutes: int = 5
|
||||
expires_in_minutes: int = 5,
|
||||
server_id: Optional[str] = None
|
||||
) -> bool:
|
||||
"""
|
||||
Create a new authentication code for linking.
|
||||
@@ -298,6 +299,7 @@ async def create_auth_code(
|
||||
telegram_user_id: Telegram user ID
|
||||
oracle_username: Oracle username to link
|
||||
expires_in_minutes: Code expiration time in minutes (default: 5)
|
||||
server_id: Oracle server ID (for multi-server mode)
|
||||
|
||||
Returns:
|
||||
bool: True if successful
|
||||
@@ -310,13 +312,13 @@ async def create_auth_code(
|
||||
db.row_factory = aiosqlite.Row
|
||||
await db.execute("""
|
||||
INSERT INTO telegram_auth_codes (
|
||||
code, telegram_user_id, oracle_username, expires_at
|
||||
code, telegram_user_id, oracle_username, expires_at, server_id
|
||||
)
|
||||
VALUES (?, ?, ?, ?)
|
||||
""", (code, telegram_user_id, oracle_username, expires_at))
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
""", (code, telegram_user_id, oracle_username, expires_at, server_id))
|
||||
|
||||
await db.commit()
|
||||
logger.info(f"Auth code created for user {telegram_user_id}")
|
||||
logger.info(f"Auth code created for user {telegram_user_id} (server_id={server_id})")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user