Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add logic to the query to filter items/nfts NOT on sale #205

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/adapters/handlers/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function createItemsHandler(
const category = params.getValue<NFTCategory>('category', NFTCategory)
const creator = params.getAddress('creator')
const isSoldOut = params.getBoolean('isSoldOut')
const isOnSale = params.getBoolean('isOnSale')
const isOnSale = params.getString('isOnSale') === 'true'
const search = params.getString('search')
const isWearableHead = params.getBoolean('isWearableHead')
const isWearableAccessory = params.getBoolean('isWearableAccessory')
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/handlers/nfts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function createNFTsHandler(
const category = params.getValue<NFTCategory>('category', NFTCategory)
const owner = params.getAddress('owner')
const tenant = params.getAddress('tenant')?.toLowerCase()
const isOnSale = params.getBoolean('isOnSale')
const isOnSale = params.getString('isOnSale') === 'true'
const search = params.getString('search')
const isLand = params.getBoolean('isLand')
const isOnRent = params.getBoolean('isOnRent')
Expand Down
2 changes: 2 additions & 0 deletions src/ports/items/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ export function getItemsQuery(filters: ItemFilters, isCount = false) {

if (isOnSale) {
where.push(`searchIsStoreMinter: true`)
} else if (isOnSale === false) {
where.push(`searchIsStoreMinter: false`)
}

if (sortBy === ItemSortBy.RECENTLY_SOLD) {
Expand Down
2 changes: 2 additions & 0 deletions src/ports/nfts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ export function getFetchQuery(
) {
where.push('searchOrderStatus: open')
where.push('searchOrderExpiresAt_gt: $expiresAt')
} else if (!filters.isOnSale) {
where.push('searchOrderStatus: null')
}

if (filters.search) {
Expand Down