From d3b762d6e9a6a8773a19fd94dc2d8c2b65635163 Mon Sep 17 00:00:00 2001 From: Andrew Besedin Date: Wed, 18 Feb 2026 21:36:18 +0300 Subject: [PATCH] update: update pair currencies full_name length validation for char_length 400 --- src/models/Dex.ts | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/models/Dex.ts b/src/models/Dex.ts index 0a1174b..740c79e 100644 --- a/src/models/Dex.ts +++ b/src/models/Dex.ts @@ -39,7 +39,7 @@ class DexModel { private getPairsSearchCondition(searchText: string, whitelistedOnly: boolean) { const tickerRegexp = /^[A-Za-z0-9]{1,14}$/; - const fullNameRegexp = /^[A-Za-z0-9.,:!?\-() ]{0,255}$/; + const fullNameRegexp = /^[A-Za-z0-9.,:!?\-() ]*$/; const firstFullNameExpr = Sequelize.literal(`"first_currency"."asset_info"->>'full_name'`); const secondFullNameExpr = Sequelize.literal( @@ -57,9 +57,16 @@ class DexModel { [Op.is]: null, }), Sequelize.where(firstFullNameExpr, { [Op.is]: null }), - Sequelize.where(firstFullNameExpr, { - [Op.regexp]: fullNameRegexp.source, - }), + { + [Op.and]: [ + Sequelize.where(firstFullNameExpr, { + [Op.regexp]: fullNameRegexp.source, + }), + Sequelize.where(Sequelize.fn('char_length', firstFullNameExpr), { + [Op.lte]: 400, + }), + ], + }, ], }, Sequelize.where(Sequelize.col('second_currency.name'), { @@ -71,9 +78,16 @@ class DexModel { [Op.is]: null, }), Sequelize.where(secondFullNameExpr, { [Op.is]: null }), - Sequelize.where(secondFullNameExpr, { - [Op.regexp]: fullNameRegexp.source, - }), + { + [Op.and]: [ + Sequelize.where(secondFullNameExpr, { + [Op.regexp]: fullNameRegexp.source, + }), + Sequelize.where(Sequelize.fn('char_length', secondFullNameExpr), { + [Op.lte]: 400, + }), + ], + }, ], }, {