Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
fix: filters in bought domains
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajpiar committed May 15, 2020
1 parent 9aaf653 commit 1d39d0e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/rns/hooks/domain.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,21 @@ export default {
FROM
"rns_domain-offer"
WHERE
"status" = '${isOwned ? 'CANCELED' : 'ACTIVE'}'
${isOwned ? '"status" IN (\'CANCELED\', \'SOLD\')' : '"status" = \'ACTIVE\''}
) "INACTIVE_OFFERS" ON "INACTIVE_OFFERS"."tokenId" = "Domain"."tokenId"
AND "INACTIVE_OFFERS"."creationDate" = "offers"."creationDate"
AND "INACTIVE_OFFERS"."ROW_PRIORITY" = 1
WHERE
"Domain"."ownerAddress" = '${ownerAddress}'
AND (
"offers"."status" = '${isOwned ? 'CANCELED' : 'ACTIVE'}'
${isOwned ? 'OR "offers"."tokenId" is null' : ''}
)
${isOwned ? `AND "active_offers"."tokenId" IS NULL
AND ("INACTIVE_OFFERS"."tokenId" IS NOT NULL OR "offers"."tokenId" IS NULL)` : ''}
${isOwned
? `
AND ("offers"."status" IN ('CANCELED', 'SOLD') OR "offers"."tokenId" IS NULL)
AND "active_offers"."tokenId" IS NULL
AND ("INACTIVE_OFFERS"."tokenId" IS NOT NULL OR "offers"."tokenId" IS NULL)
`
: `
AND "offers"."status" = 'ACTIVE'
`}
${nameFilter?.$like ? `AND ("Domain"."name" LIKE '%${nameFilter.$like}%' OR "Domain"."tokenId" = '${numberToHex((sha3(nameFilter.$like)) as string)}')` : ''}
`

Expand Down

0 comments on commit 1d39d0e

Please sign in to comment.