From 2e8b6b56592218ce6d83603fb4c557cd89048d7f Mon Sep 17 00:00:00 2001 From: NW Date: Wed, 17 Jun 2026 22:19:40 +0100 Subject: [PATCH] fix: add isAdmin delegate method to AdminHandler, fix exportCSV call in adminWalletsHandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AdminHandler.isAdmin() static method delegates to middleware/auth.js (index.js calls adminHandler.isAdmin() which needs a class method) - adminWalletsHandler: this.exportCSV() → this.handleExportCSV(callbackQuery) (exportCSV doesn't exist, handleExportCSV is the correct method) --- src/handlers/adminHandlers/adminHandler.js | 4 ++++ src/handlers/adminHandlers/adminWalletsHandler.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/handlers/adminHandlers/adminHandler.js b/src/handlers/adminHandlers/adminHandler.js index 5d9fb9e..d3cb527 100644 --- a/src/handlers/adminHandlers/adminHandler.js +++ b/src/handlers/adminHandlers/adminHandler.js @@ -2,6 +2,10 @@ import { isAdmin } from '../../middleware/auth.js'; import bot from "../../context/bot.js"; export default class AdminHandler { + static isAdmin(userId) { + return isAdmin(userId); + } + static async handleAdminCommand(msg) { const chatId = msg.chat.id; diff --git a/src/handlers/adminHandlers/adminWalletsHandler.js b/src/handlers/adminHandlers/adminWalletsHandler.js index 3934f72..6f3c715 100644 --- a/src/handlers/adminHandlers/adminWalletsHandler.js +++ b/src/handlers/adminHandlers/adminWalletsHandler.js @@ -510,7 +510,8 @@ export default class AdminWalletsHandler { } else { // Если баланс достаточный, продолжаем экспорт console.log(`[${new Date().toISOString()}] Commission balance sufficient, proceeding with export`); - await this.exportCSV(chatId, walletType, wallets); + await this.handleExportCSV(callbackQuery); + return; } } catch (error) { console.error(`[${new Date().toISOString()}] Error checking commission balance:`, error);