From fac9485658f4b83af814d701ef32dd8ae4958dbd Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 May 2023 09:54:57 +0000 Subject: [PATCH] fix: uuid capital problem --- server/infra/database/TokensRepository.ts | 2 +- server/infra/database/TreeRepository.ts | 6 +++--- server/infra/database/TreeRepositoryV2.ts | 4 ++-- server/infra/database/WalletsRepository.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/infra/database/TokensRepository.ts b/server/infra/database/TokensRepository.ts index 89fe7d59..3330fd35 100644 --- a/server/infra/database/TokensRepository.ts +++ b/server/infra/database/TokensRepository.ts @@ -20,7 +20,7 @@ export default class TokensRepository extends BaseRepository { public.tree_species.name as tree_species_name from wallet.token left join public.trees on - wallet.token.capture_id::text = public.trees.uuid::text + wallet.token.capture_id::text = lower(public.trees.uuid::text) left join public.tree_species on public.trees.species_id = public.tree_species.id where wallet.token.id = '${tokenId}' diff --git a/server/infra/database/TreeRepository.ts b/server/infra/database/TreeRepository.ts index b4f5fcb3..8f9201e4 100644 --- a/server/infra/database/TreeRepository.ts +++ b/server/infra/database/TreeRepository.ts @@ -36,7 +36,7 @@ export default class TreeRepository extends BaseRepository { on ST_WITHIN(trees.estimated_geometric_location, region.geom) and region.type_id in (select id from region_type where type = 'country') left JOIN wallet.token - on wallet.token.capture_id::text = trees.uuid::text + on wallet.token.capture_id::text = lower(trees.uuid::text) left JOIN wallet.wallet on wallet.token.wallet_id = wallet.wallet.id `), @@ -234,7 +234,7 @@ export default class TreeRepository extends BaseRepository { SELECT COUNT(*) FROM trees - LEFT JOIN wallet.token ON token.capture_id::text = trees.uuid + LEFT JOIN wallet.token ON token.capture_id::text = lower(trees.uuid) WHERE wallet.token.wallet_id = '${wallet_id}' `; const total = await this.session.getDB().raw(totalSql); @@ -245,7 +245,7 @@ export default class TreeRepository extends BaseRepository { SELECT trees.* FROM trees - LEFT JOIN wallet.token ON token.capture_id::text = trees.uuid + LEFT JOIN wallet.token ON token.capture_id::text = lower(trees.uuid) WHERE wallet.token.wallet_id = '${wallet_id}' LIMIT ${limit} OFFSET ${offset} diff --git a/server/infra/database/TreeRepositoryV2.ts b/server/infra/database/TreeRepositoryV2.ts index 5021c2ce..e6840039 100644 --- a/server/infra/database/TreeRepositoryV2.ts +++ b/server/infra/database/TreeRepositoryV2.ts @@ -199,7 +199,7 @@ export default class TreeRepositoryV2 extends BaseRepository { SELECT COUNT(*) FROM trees - LEFT JOIN wallet.token ON token.capture_id::text = trees.uuid + LEFT JOIN wallet.token ON token.capture_id::text = lower(trees.uuid) WHERE wallet.token.wallet_id = '${wallet_id}' `; const total = await this.session.getDB().raw(totalSql); @@ -210,7 +210,7 @@ export default class TreeRepositoryV2 extends BaseRepository { SELECT trees.* FROM trees - LEFT JOIN wallet.token ON token.capture_id::text = trees.uuid + LEFT JOIN wallet.token ON token.capture_id::text = lower(trees.uuid) WHERE wallet.token.wallet_id = '${wallet_id}' LIMIT ${limit} OFFSET ${offset} diff --git a/server/infra/database/WalletsRepository.ts b/server/infra/database/WalletsRepository.ts index 6fd951a3..906db3f7 100644 --- a/server/infra/database/WalletsRepository.ts +++ b/server/infra/database/WalletsRepository.ts @@ -49,7 +49,7 @@ export default class WalletsRepository extends BaseRepository { left join wallet.token on wallet.token.wallet_id = wallet.wallet.id left join public.trees on - wallet.token.capture_id::text = public.trees.uuid::text + wallet.token.capture_id::text = lower(public.trees.uuid::text) left join region as continent on ST_WITHIN(public.trees.estimated_geometric_location, continent.geom) and continent.type_id in (select id from region_type where type = 'continents' )