export database
This commit is contained in:
13
src/index.js
13
src/index.js
@@ -11,6 +11,7 @@ import AdminProductHandler from './handlers/adminProductHandler.js';
|
||||
import ErrorHandler from './utils/errorHandler.js';
|
||||
import User from './models/User.js';
|
||||
import AdminUserLocationHandler from "./handlers/adminUserLocationHandler.js";
|
||||
import AdminDumpHandler from "./handlers/adminDumpHandler.js";
|
||||
|
||||
// Debug logging function
|
||||
const logDebug = (action, functionName) => {
|
||||
@@ -39,6 +40,7 @@ const adminUserHandler = new AdminUserHandler(bot);
|
||||
const adminLocationHandler = new AdminLocationHandler(bot);
|
||||
const adminUserLocationHandler = new AdminUserLocationHandler(bot);
|
||||
const adminProductHandler = new AdminProductHandler(bot);
|
||||
const adminDumpHandler = new AdminDumpHandler(bot);
|
||||
|
||||
// Start command - Create user profile
|
||||
bot.onText(/\/start/, async (msg) => {
|
||||
@@ -135,6 +137,11 @@ bot.on('message', async (msg) => {
|
||||
await adminLocationHandler.handleViewLocations(msg);
|
||||
}
|
||||
break;
|
||||
case '💾 Database Backup':
|
||||
if (adminHandler.isAdmin(msg.from.id)) {
|
||||
await adminDumpHandler.handleDump(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
await ErrorHandler.handleError(bot, msg.chat.id, error, 'message handler');
|
||||
@@ -330,6 +337,12 @@ bot.on('callback_query', async (callbackQuery) => {
|
||||
logDebug(action, 'handleEditUserDistrict');
|
||||
await adminUserLocationHandler.handleEditUserDistrict(callbackQuery)
|
||||
}
|
||||
// Dump manage
|
||||
else if (action === "export_database") {
|
||||
await adminDumpHandler.exportDatabase(callbackQuery);
|
||||
return;
|
||||
}
|
||||
|
||||
await bot.answerCallbackQuery(callbackQuery.id);
|
||||
} catch (error) {
|
||||
await ErrorHandler.handleError(bot, msg.chat.id, error, 'callback query');
|
||||
|
||||
Reference in New Issue
Block a user