From bc7a2e09b3f6bcb9935e88249e6691dd7aa6b695 Mon Sep 17 00:00:00 2001 From: jejolare Date: Tue, 21 Oct 2025 20:05:52 +0700 Subject: [PATCH] alias debug --- server/server.ts | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/server/server.ts b/server/server.ts index f3b9c0d..b648f73 100644 --- a/server/server.ts +++ b/server/server.ts @@ -468,17 +468,24 @@ async function waitForDb() { app.get( '/api/get_aliases_count', exceptionHandler(async (req, res) => { - const aliasesAmount = await Alias.count(); + const aliasesAmount = await Alias.count({ + where: { enabled: true } + }); const premiumAliasesAmount = await Alias.count({ - where: sequelize.where( - sequelize.fn( - 'LENGTH', - sequelize.col('alias') - ), - { - [Op.lte]: 5 - } - ) + where: { + [Op.and]: [ + sequelize.where( + sequelize.fn( + 'LENGTH', + sequelize.col('alias') + ), + { + [Op.lte]: 5 + }, + ), + { enabled: true } + ] + } }); return res.json({ aliasesAmount, premiumAliasesAmount }); }), @@ -2019,7 +2026,9 @@ async function waitForDb() { ); // Fetch the count of aliases using Sequelize - const aliasCountDB = await Alias.count(); + const aliasCountDB = await Alias.count({ + where: { enabled: true } + }); if (aliasCountDB !== state.countAliasesServer) { log( @@ -2079,7 +2088,9 @@ async function waitForDb() { } // Get the count of aliases - const aliasCountResult = await Alias.count(); + const aliasCountResult = await Alias.count({ + where: { enabled: true } + }); setState({ ...state, countAliasesDB: aliasCountResult @@ -2244,7 +2255,7 @@ cron.schedule("0 */4 * * *", async () => { .filter(e => e !== null); const validPricesObject = Object.assign({}, ...validPrices); - + setState({ ...state, priceData: {