Skip to content

Commit

Permalink
Get all currently active offers endpoint only returns non-pending off…
Browse files Browse the repository at this point in the history
…ers.

Co-authored-by: Francisco Cardoso <[email protected]>
  • Loading branch information
dsantosferreira and FranciscoCardoso913 committed Apr 16, 2023
1 parent 0d10252 commit 96a71fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/models/Offer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 2 additions & 1 deletion src/services/offer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -346,6 +346,7 @@ class OfferService {

selectSearchOffers(offers, showHidden, showAdminReason) {
offers.current();
offers.notPending();
if (!showHidden) offers.withoutHidden();
if (!showAdminReason) offers.select("-adminReason");

Expand Down

0 comments on commit 96a71fb

Please sign in to comment.