0 update adminHandlers
This commit is contained in:
parent
13a2d67474
commit
3e78e231f3
@ -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<pre>${jsonExample}</pre>\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,
|
||||
|
Loading…
Reference in New Issue
Block a user