now only active offers are shown

This commit is contained in:
counterweight 2025-03-10 15:37:37 +01:00
parent 613ded0cf1
commit 9c4581d33d
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -54,21 +54,23 @@ class OfferServiceProvider {
}; };
const getOffersByPublicKey = async (publicKey) => { const getOffersByPublicKey = async (publicKey) => {
const offers = await this.models.OfferCreated.findAll({ const activeOffers = await this.models.OfferCreated.findAll({
where: { where: {
public_key: publicKey, public_key: publicKey,
'$OfferDeleted.uuid$': null,
}, },
include: { model: this.models.OfferDeleted, required: false },
}); });
console.log(offers); console.log(activeOffers);
if (!offers) { if (!activeOffers) {
return []; return [];
} }
const offersToReturn = []; const offersToReturn = [];
if (offers) { if (activeOffers) {
for (const someOffer of offers) { for (const someOffer of activeOffers) {
const offerDetails = await this.models.OfferDetailsSet.findOne({ const offerDetails = await this.models.OfferDetailsSet.findOne({
where: { where: {
offer_uuid: someOffer.uuid, offer_uuid: someOffer.uuid,