Skip to content

Commit

Permalink
Ensure that emails are unique
Browse files Browse the repository at this point in the history
  • Loading branch information
AydanPirani authored Apr 14, 2024
1 parent 1ba901f commit d3d6712
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 d3d6712

Please sign in to comment.