From cfffa006af144f899e65af404cce07f6245a667d Mon Sep 17 00:00:00 2001 From: Bruno Jardon Date: Fri, 29 Nov 2024 21:56:54 -0600 Subject: [PATCH] hotfix: add missing populate options --- .../controllers/gift-exchanges.controller.ts | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/app/gift-exchanges/controllers/gift-exchanges.controller.ts b/src/app/gift-exchanges/controllers/gift-exchanges.controller.ts index f9daa3a..c473e20 100644 --- a/src/app/gift-exchanges/controllers/gift-exchanges.controller.ts +++ b/src/app/gift-exchanges/controllers/gift-exchanges.controller.ts @@ -159,9 +159,12 @@ export class GiftExchangesController { if (!user._id.equals(exchange._organizer)) throw new UnauthorizedException('giftexchanges.organizer.match'); - const participants = await this.participants.find({ - _exchange: exchange._id, - }); + const participants = await this.participants.find( + { + _exchange: exchange._id, + }, + { populate: ['user'] }, + ); const to = participants.map(({ user }) => ({ email: user.email, @@ -247,10 +250,13 @@ export class GiftExchangesController { if (!exchange.drawnOn) throw new ConflictException('giftexchanges.draw.required'); - const participants = await this.participants.find({ - _exchange: exchange._id, - acknowledgedOn: { $exists: true, $ne: null }, - }); + const participants = await this.participants.find( + { + _exchange: exchange._id, + acknowledgedOn: { $exists: true, $ne: null }, + }, + { populate: ['user', 'giftee'] }, + ); await Promise.all( participants.map(async (participant) => {