From 3fbc13e1b40ad502039d410f7dcc29b1f1a79e26 Mon Sep 17 00:00:00 2001 From: romantarkin Date: Mon, 18 Aug 2025 10:39:28 +0500 Subject: [PATCH] fix --- .../src/controllers/subscriberController.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mail-service/src/controllers/subscriberController.js b/mail-service/src/controllers/subscriberController.js index 34cdc3f..c1e4a51 100644 --- a/mail-service/src/controllers/subscriberController.js +++ b/mail-service/src/controllers/subscriberController.js @@ -13,7 +13,20 @@ export default { try { const limit = parseInt(req.query.limit) || 20; const offset = parseInt(req.query.offset) || 0; - const result = await Subscriber.findAndCountAll({ limit, offset, order: [['id', 'ASC']] }); + const { status } = req.query; + + // Создаем условия для фильтрации + const where = {}; + if (status) { + where.status = status; + } + + const result = await Subscriber.findAndCountAll({ + where, + limit, + offset, + order: [['id', 'ASC']] + }); res.json({ count: result.count, rows: result.rows }); } catch (err) { res.status(500).json({ error: err.message });