Skip to content

Commit

Permalink
fix: uuid capital problem
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 4, 2023
1 parent 68dc674 commit fac9485
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion server/infra/database/TokensRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class TokensRepository extends BaseRepository<Tokens> {
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}'
Expand Down
6 changes: 3 additions & 3 deletions server/infra/database/TreeRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class TreeRepository extends BaseRepository<Tree> {
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
`),
Expand Down Expand Up @@ -234,7 +234,7 @@ export default class TreeRepository extends BaseRepository<Tree> {
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);
Expand All @@ -245,7 +245,7 @@ export default class TreeRepository extends BaseRepository<Tree> {
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}
Expand Down
4 changes: 2 additions & 2 deletions server/infra/database/TreeRepositoryV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default class TreeRepositoryV2 extends BaseRepository<Tree> {
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);
Expand All @@ -210,7 +210,7 @@ export default class TreeRepositoryV2 extends BaseRepository<Tree> {
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}
Expand Down
2 changes: 1 addition & 1 deletion server/infra/database/WalletsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class WalletsRepository extends BaseRepository<Wallets> {
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' )
Expand Down

0 comments on commit fac9485

Please sign in to comment.