From f9356c6bbedb60fd805edc66933f7c06af268d51 Mon Sep 17 00:00:00 2001 From: NW Date: Thu, 9 Jan 2025 13:25:35 +0000 Subject: [PATCH] update user purchase list --- src/handlers/userHandlers/userPurchaseHandler.js | 6 +++++- src/services/productService.js | 2 ++ src/services/purchaseService.js | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/handlers/userHandlers/userPurchaseHandler.js b/src/handlers/userHandlers/userPurchaseHandler.js index 953d802..7889a4f 100644 --- a/src/handlers/userHandlers/userPurchaseHandler.js +++ b/src/handlers/userHandlers/userPurchaseHandler.js @@ -1,3 +1,6 @@ +// userPurchaseHandler.js + + import config from "../../config/config.js"; import db from '../../config/database.js'; import PurchaseService from "../../services/purchaseService.js"; @@ -43,7 +46,8 @@ export default class UserPurchaseHandler { const keyboard = { inline_keyboard: [ ...purchases.map(item => [{ - text: `${item.product_name} [${new Date(item.purchase_date).toLocaleString()}]`, + // Добавляем иконку статуса покупки + text: `${item.status === 'received' ? '✅' : '❌'} ${item.product_name} [${new Date(item.purchase_date).toLocaleString()}]`, callback_data: `view_purchase_${item.id}` }]), [ diff --git a/src/services/productService.js b/src/services/productService.js index e3913e9..1c92db9 100644 --- a/src/services/productService.js +++ b/src/services/productService.js @@ -1,3 +1,5 @@ +// productService.js + import db from "../config/database.js"; class ProductService { diff --git a/src/services/purchaseService.js b/src/services/purchaseService.js index 8f02333..e143121 100644 --- a/src/services/purchaseService.js +++ b/src/services/purchaseService.js @@ -1,3 +1,5 @@ +// purchaseService.js + import db from "../config/database.js"; import CryptoJS from "crypto-js"; // Импортируем библиотеку crypto-js class PurchaseService {