Skip to content

Commit

Permalink
Merge pull request #18 from ReflectionsProjections/dev/aydan/unique-s…
Browse files Browse the repository at this point in the history
…ubscription-emails

Ensure that emails are unique
  • Loading branch information
AydanPirani authored Apr 14, 2024
2 parents 1ba901f + df43776 commit 6ada1f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/subscription/subscription-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ subscriptionRouter.post("/", async (req, res, next) => {
// Upsert the user info into the corresponding Subscription collection
await Database.SUBSCRIPTIONS.findOneAndUpdate(
{ mailingList: subscriptionData.mailingList },
{ $push: { subscriptions: subscriptionData.email } },
{ $addToSet: { subscriptions: subscriptionData.email } },
{ upsert: true, new: true }
);
return res.status(StatusCodes.CREATED).json(subscriptionData);
Expand Down

0 comments on commit 6ada1f8

Please sign in to comment.