From 96a71fb69fa5e189d0076d67b8c66c7f2ea8b2c0 Mon Sep 17 00:00:00 2001 From: dsantosferreira Date: Mon, 17 Apr 2023 00:45:53 +0100 Subject: [PATCH] Get all currently active offers endpoint only returns non-pending offers. Co-authored-by: Francisco Cardoso --- src/models/Offer.js | 4 ++++ src/services/offer.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/models/Offer.js b/src/models/Offer.js index 4270b9e3..3a9e7b4f 100644 --- a/src/models/Offer.js +++ b/src/models/Offer.js @@ -167,6 +167,10 @@ OfferSchema.query.current = function() { return this.where(this.model.filterCurrent()); }; +OfferSchema.query.notPending= function(){ + return this.where({ isPending: false }); +} + /** * Currently active and non-hidden Offers */ diff --git a/src/services/offer.js b/src/services/offer.js index badaf627..6dc747c6 100644 --- a/src/services/offer.js +++ b/src/services/offer.js @@ -222,7 +222,7 @@ class OfferService { } = this.decodeQueryToken(queryToken); [queryValue, queryFilters] = [searchInfo.value, searchInfo.filters]; - + offers = this._buildSearchContinuationQuery(lastOfferId, lastOfferScore, queryValue, showHidden, showAdminReason, queryFilters); } else { @@ -346,6 +346,7 @@ class OfferService { selectSearchOffers(offers, showHidden, showAdminReason) { offers.current(); + offers.notPending(); if (!showHidden) offers.withoutHidden(); if (!showAdminReason) offers.select("-adminReason");