From 6303fcec65ebae2ad5c92176a6f4f680d3cfd6d7 Mon Sep 17 00:00:00 2001 From: Aydan Pirani Date: Wed, 10 Apr 2024 23:39:49 -0500 Subject: [PATCH] Update subscription-router.ts --- src/services/subscription/subscription-router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/subscription/subscription-router.ts b/src/services/subscription/subscription-router.ts index d847061..b503fbe 100644 --- a/src/services/subscription/subscription-router.ts +++ b/src/services/subscription/subscription-router.ts @@ -11,7 +11,7 @@ subscriptionRouter.post("/", async (req, res, next) => { const subscriptionData = SubscriptionValidator.parse(req.body); await Database.SUBSCRIPTION.findOneAndUpdate( { mailingList: subscriptionData.mailingList }, - { $push: { subscriptions: data.email } }, + { $push: { subscriptions: subscriptionData.email } }, { upsert: true, new: true } ); return res.status(StatusCodes.CREATED).json(subscriptionData);