From f358824ea5cf94c730c5f45d27d0c191ef0694b2 Mon Sep 17 00:00:00 2001 From: Juanma Hidalgo Date: Tue, 10 Dec 2024 21:20:07 +0100 Subject: [PATCH] fix: nfts on sale being limited when asked by owner --- src/ports/nfts/queries.ts | 4 +++- src/ports/orders/queries.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ports/nfts/queries.ts b/src/ports/nfts/queries.ts index 8c1dd13..2340f7e 100644 --- a/src/ports/nfts/queries.ts +++ b/src/ports/nfts/queries.ts @@ -117,7 +117,9 @@ function getFilteredNFTCTE(nftFilters: GetNFTsFilters, uncapped = false): SQLSta ` .append(whereClause) .append(getNFTsSortByStatement(nftFilters.sortBy)) - .append(uncapped || nftFilters.sortBy === NFTSortBy.RECENTLY_LISTED ? SQL`` : getNFTLimitAndOffsetStatement(nftFilters)) + .append( + uncapped || nftFilters.sortBy === NFTSortBy.RECENTLY_LISTED || !!nftFilters.owner ? SQL`` : getNFTLimitAndOffsetStatement(nftFilters) + ) .append(SQL`)`) } diff --git a/src/ports/orders/queries.ts b/src/ports/orders/queries.ts index 8043d77..3a9ec62 100644 --- a/src/ports/orders/queries.ts +++ b/src/ports/orders/queries.ts @@ -27,14 +27,14 @@ function getOrdersSortByStatement(filters: OrderFilters): SQLStatement { } function getOrdersLimitAndOffsetStatement(filters: OrderFilters) { - const limit = filters?.first ? filters.first : 100 + const limit = filters?.first ? filters.first : 1000 const offset = filters?.skip ? filters.skip : 0 return SQL` LIMIT ${limit} OFFSET ${offset} ` } function getInnerOrdersLimitAndOffsetStatement(filters: OrderFilters) { - const finalLimit = filters?.first ? filters.first : 100 + const finalLimit = filters?.first ? filters.first : 1000 const finalOffset = filters?.skip ? filters.skip : 0 // For inner queries, we need to fetch enough records to account for the final offset