From 8e1182a96a7c6d766ddae8add2affd376dcbf7f7 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 4 Jun 2023 06:49:51 +0000 Subject: [PATCH] feat: neartest wallet case --- .eslintrc.js | 1 + server/infra/database/GisRepository.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7995454e..020b3396 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -12,6 +12,7 @@ module.exports = { rules: { // disabled or modified because too strict + 'no-nested-ternary': 'off', 'no-restricted-globals': 'warn', 'no-console': ['warn', { allow: ['info', 'error'] }], 'import/prefer-default-export': 'off', diff --git a/server/infra/database/GisRepository.ts b/server/infra/database/GisRepository.ts index 2a8b72ac..79958622 100644 --- a/server/infra/database/GisRepository.ts +++ b/server/infra/database/GisRepository.ts @@ -63,7 +63,9 @@ export default class GisRepository { active = true ${ params.wallet_id - ? `and (wallet.token.wallet_id::text = '${params.wallet_id}' or wallet.wallet.name = '${params.wallet_id}')` + ? /[0-9a-f-]{36}/.test(params.wallet_id) + ? `and wallet.token.wallet_id = '${params.wallet_id}' ` + : `and wallet.wallet.name = '${params.wallet_id}'` : '' } ${params.planter_id ? `and planter_id = ${params.planter_id}` : ''}