Fixed count for redemptions

no-issue

You must use `where` rather than `forge` when generating counts.
This commit is contained in:
Fabien O'Carroll 2021-10-18 14:04:37 +02:00
parent 3cd26bc11b
commit dbf549b664

View File

@ -101,7 +101,7 @@ class OfferRepository {
async mapToOffer(model, options) { async mapToOffer(model, options) {
const json = model.toJSON(); const json = model.toJSON();
const count = await this.OfferRedemptionModel.forge({offer_id: json.id}).count('id', { const count = await this.OfferRedemptionModel.where({offer_id: json.id}).count('id', {
transacting: options.transacting transacting: options.transacting
}); });
return Offer.create({ return Offer.create({