Skip to content

Commit

Permalink
release(hotfix): fix email apis
Browse files Browse the repository at this point in the history
Merge PR #25
  • Loading branch information
bjardon authored Nov 30, 2024
2 parents c2678cb + cfffa00 commit b599979
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/app/gift-exchanges/controllers/gift-exchanges.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit b599979

Please sign in to comment.