From 3e78e231f3b0302a582c2aee5a141424b13d62c2 Mon Sep 17 00:00:00 2001 From: NW Date: Fri, 13 Dec 2024 13:41:49 +0000 Subject: [PATCH] 0 update adminHandlers --- .../adminHandlers/adminProductHandler.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/handlers/adminHandlers/adminProductHandler.js b/src/handlers/adminHandlers/adminProductHandler.js index 6312b9e..9d88056 100644 --- a/src/handlers/adminHandlers/adminProductHandler.js +++ b/src/handlers/adminHandlers/adminProductHandler.js @@ -908,22 +908,22 @@ Coordinates: ${product.hidden_coordinates} if (!this.isAdmin(callbackQuery.from.id)) { return; } - + const chatId = callbackQuery.message.chat.id; const messageId = callbackQuery.message.message_id; const productId = callbackQuery.data.replace('edit_product_', ''); - + try { const product = await ProductService.getDetailedProductById(productId); - + if (!product) { throw new Error('Product not found'); } - + const locationId = product.location_id; const categoryId = product.category_id; const subcategoryId = product.subcategory_id; - + const sampleProduct = { name: product.name, price: product.price, @@ -935,10 +935,10 @@ Coordinates: ${product.hidden_coordinates} hidden_coordinates: product.hidden_coordinates, hidden_description: product.hidden_description }; - + const jsonExample = JSON.stringify(sampleProduct, null, 2); const message = `To edit product, send a JSON file with product in the following format:\n\n
${jsonExample}
\n\nProduct must have all the fields shown above.\n\nYou can either:\n1. Send the JSON as text\n2. Upload a .json file`; - + userStates.set(chatId, { action: 'edit_product', locationId, @@ -946,7 +946,7 @@ Coordinates: ${product.hidden_coordinates} subcategoryId, productId }); - + await bot.editMessageText(message, { chat_id: chatId, message_id: messageId,