+ style="width: 15%; height: 100%; padding-left: 32px; padding-right: 2px; padding-top: 16px; padding-bottom: 16px; background: #135DFF; border-radius: 1px; justify-content: center; align-items: center; gap: 10px; display: inline-flex">
Subscribe
diff --git a/src/auth-service/utils/mailer.js b/src/auth-service/utils/mailer.js
index 1d8d271d52..223d155e6e 100644
--- a/src/auth-service/utils/mailer.js
+++ b/src/auth-service/utils/mailer.js
@@ -68,7 +68,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -143,7 +143,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -228,7 +228,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -309,7 +309,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
if (!checkResult.success) {
return checkResult;
}
@@ -346,7 +346,7 @@ const mailer = {
const checkPromises = bccEmails.map(async (bccEmail) => {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
return checkResult.success ? bccEmail : null;
});
const successfulEmails = (await Promise.all(checkPromises)).filter(
@@ -425,7 +425,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -531,7 +531,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -650,7 +650,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "mobile_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -768,7 +768,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -846,7 +846,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1190,7 +1190,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
if (!checkResult.success) {
return checkResult;
}
@@ -1244,7 +1244,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
if (!checkResult.success) {
return checkResult;
}
@@ -1298,7 +1298,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
if (!checkResult.success) {
return checkResult;
}
@@ -1347,7 +1347,7 @@ const mailer = {
},
sendUnsubscriptionEmail: async (
- { product, type, userEmail, name, paramString } = {},
+ { product, type, email, name, paramString } = {},
next
) => {
try {
@@ -1357,107 +1357,13 @@ const mailer = {
name: "AirQo Data Team",
address: process.env.MAIL_USER,
},
- to: `${userEmail}`,
+ to: `${email}`,
subject: "We're Sad to See You Go - Unsubscription Confirmation!",
- html: `${msgs.emailNotificationUnsubscibe(product, type, userEmail, name, paramString)}`,
+ html: `${msgs.emailNotificationUnsubscibe(product, type, email, name, paramString)}`,
attachments: attachments,
};
- if (userEmail === "automated-tests@airqo.net") {
- return {
- success: true,
- message: "email successfully sent",
- data: [],
- status: httpStatus.OK,
- };
- }
-
- const response = await transporter.sendMail(mailOptions);
-
- const data = response;
- if (isEmpty(data.rejected) && !isEmpty(data.accepted)) {
- return {
- success: true,
- message: "email successfully sent",
- data,
- status: httpStatus.OK,
- };
- } else {
- next(
- new HttpError(
- "Internal Server Error",
- httpStatus.INTERNAL_SERVER_ERROR,
- {
- message: "email not sent",
- emailResults: data,
- }
- )
- );
- }
- } catch (error) {
- logger.error(`🐛🐛 Internal Server Error ${error.message}`);
- next(
- new HttpError(
- "Internal Server Error",
- httpStatus.INTERNAL_SERVER_ERROR,
- { message: error.message }
- )
- );
- }
- },
-
-
- newMobileAppUser: async (
- { email, message, subject, tenant = "airqo" } = {},
- next
- ) => {
- try {
- const checkResult = await SubscriptionModel(
- tenant
- ).checkNotificationStatus({ email, type: "email" });
- if (!checkResult.success) {
- return checkResult;
- }
-
- let bccEmails = [];
-
- if (constants.REQUEST_ACCESS_EMAILS) {
- bccEmails = constants.REQUEST_ACCESS_EMAILS.split(",");
- }
-
- let subscribedEmails = [];
-
- for (let i = 0; i < bccEmails.length; i++) {
- const bccEmail = bccEmails[i].trim();
- const checkResult = await SubscriptionModel(
- tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
-
- if (checkResult.success) {
- subscribedEmails.push(bccEmail);
- }
- }
-
- const subscribedBccEmails = subscribedEmails.join(",");
-
- logObject("the values to send to email function", {
- email,
- message,
- subject,
- });
-
- const mailOptions = {
- from: {
- name: constants.EMAIL_NAME,
- address: constants.EMAIL,
- },
- subject,
- html: message,
- to: email,
- bcc: subscribedBccEmails,
- };
-
if (email === "automated-tests@airqo.net") {
return {
success: true,
@@ -1500,6 +1406,7 @@ const mailer = {
);
}
},
+
feedback: async (
{ email, message, subject, tenant = "airqo" } = {},
next
@@ -1507,7 +1414,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email" });
+ ).checkNotificationStatus({ email, type: "email", product: "mobile_notifications" });
if (!checkResult.success) {
return checkResult;
}
@@ -1524,7 +1431,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "mobile_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1630,7 +1537,7 @@ const mailer = {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: recepientEmail, type: "email" });
+ ).checkNotificationStatus({ email: recepientEmail, type: "email", product: "analytics_notifications" });
if (!checkResult.success) {
continue
}
@@ -1709,7 +1616,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
if (!checkResult.success) {
return checkResult;
}
@@ -1726,7 +1633,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1801,7 +1708,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
if (!checkResult.success) {
return checkResult;
}
@@ -1818,7 +1725,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1898,7 +1805,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
From 301bc850c4ae4e90e5c208f8d6541d602e7d7cb2 Mon Sep 17 00:00:00 2001
From: Benjamin Ssempala <86492979+BenjaminSsempala@users.noreply.github.com>
Date: Thu, 4 Apr 2024 06:26:42 +0300
Subject: [PATCH 04/10] Adjusting the schema
---
src/auth-service/models/Subscription.js | 50 +++++++++----------------
src/auth-service/utils/create-user.js | 34 ++++++-----------
src/auth-service/utils/mailer.js | 44 +++++++++++-----------
3 files changed, 51 insertions(+), 77 deletions(-)
diff --git a/src/auth-service/models/Subscription.js b/src/auth-service/models/Subscription.js
index bbc0cedd92..89102a1494 100644
--- a/src/auth-service/models/Subscription.js
+++ b/src/auth-service/models/Subscription.js
@@ -19,18 +19,20 @@ const SubscriptionSchema = new mongoose.Schema(
required: true,
unique: true,
},
- mobile_notifications: {
- email: { type: Boolean, default: true },
- push: { type: Boolean, default: true },
- text: { type: Boolean, default: true },
- phone: { type: Boolean, default: true },
- },
- analytics_notifications: {
- email: { type: Boolean, default: true },
- push: { type: Boolean, default: true },
- text: { type: Boolean, default: true },
- phone: { type: Boolean, default: true },
- },
+ notifications: {
+ mobile: {
+ email: { type: Boolean, default: true },
+ push: { type: Boolean, default: true },
+ text: { type: Boolean, default: true },
+ phone: { type: Boolean, default: true },
+ },
+ analytics: {
+ email: { type: Boolean, default: true },
+ push: { type: Boolean, default: true },
+ text: { type: Boolean, default: true },
+ phone: { type: Boolean, default: true },
+ },
+ }
},
{
timestamps: true,
@@ -50,8 +52,7 @@ SubscriptionSchema.methods = {
return {
_id: this._id,
email: this.email,
- mobile_notifications: this.mobile_notifications,
- analytics_notifications: this.analytics_notifications,
+ notifications: this.notifications,
};
},
};
@@ -237,7 +238,7 @@ SubscriptionSchema.statics.remove = async function (
};
SubscriptionSchema.statics.unsubscribe = async function (email, product, type) {
- await this.updateOne({ email }, { [`${product}_notifications.${type}`]: false });
+ await this.updateOne({ email }, { [`notifications.${product}.${type}`]: false });
};
SubscriptionSchema.statics.checkNotificationStatus = async function (
@@ -258,25 +259,8 @@ SubscriptionSchema.statics.checkNotificationStatus = async function (
};
}
- let isSubscribed = false;
+ let isSubscribed = subscription.notifications[product][type];
- switch (product) {
- case 'mobile_notifications':
- isSubscribed = subscription.mobile_notifications[type];
- break;
- case 'analytics_notifications':
- isSubscribed = subscription.analytics_notifications[type];
- break;
- default:
- return {
- success: false,
- message: `Invalid category`,
- status: httpStatus.BAD_REQUEST,
- errors: {
- message: `Invalid category: ${product}`,
- },
- };
- }
if (!isSubscribed) {
return {
diff --git a/src/auth-service/utils/create-user.js b/src/auth-service/utils/create-user.js
index 49975048d0..dd820d52ff 100644
--- a/src/auth-service/utils/create-user.js
+++ b/src/auth-service/utils/create-user.js
@@ -2361,7 +2361,7 @@ const createUserModule = {
tenant
).findOneAndUpdate(
{ email },
- { $set: { [`mobile_notifications.${type}`]: true } },
+ { $set: { [`notifications.mobile.${type}`]: true } },
{ new: true, upsert: true }
);
@@ -2414,7 +2414,7 @@ const createUserModule = {
tenant
).findOneAndUpdate(
{ email },
- { $set: { [`analytics_notifications.${type}`]: true } },
+ { $set: { [`notifications.analytics.${type}`]: true } },
{ new: true, upsert: true }
);
@@ -2517,7 +2517,7 @@ const createUserModule = {
tenant
).findOneAndUpdate(
{ email },
- { $set: { [`mobile_notifications.${type}`]: false } },
+ { $set: { [`notifications.mobile.${type}`]: false } },
{ new: true, upsert: true }
);
@@ -2596,7 +2596,7 @@ const createUserModule = {
tenant
).findOneAndUpdate(
{ email },
- { $set: { [`analytics_notifications.${type}`]: false } },
+ { $set: { [`notifications.analytics.${type}`]: false } },
{ new: true, upsert: true }
);
@@ -2645,7 +2645,7 @@ const createUserModule = {
},
checkNotificationStatus: async (request, next) => {
try {
- let { email, type, tenant, user_id } = {
+ let { email, type, product, tenant, user_id } = {
...request.body,
...request.query,
...request.params,
@@ -2667,23 +2667,13 @@ const createUserModule = {
email = user.email;
}
- const subscription = await SubscriptionModel(tenant).findOne({ email });
- if (!subscription.notifications[type]) {
- return {
- success: false,
- message: `Forbidden`,
- status: httpStatus.FORBIDDEN,
- errors: {
- message: `User is not subscribed to ${type} notifications`,
- },
- };
- } else {
- return {
- success: true,
- message: `User is subscribed to ${type} notifications`,
- status: httpStatus.OK,
- };
- }
+ const result = await SubscriptionModel(tenant).checkNotificationStatus({
+ email,
+ type,
+ product,
+ }, next);
+
+ return result;
} catch (error) {
logger.error(`🐛🐛 Internal Server Error ${error.message}`);
next(
diff --git a/src/auth-service/utils/mailer.js b/src/auth-service/utils/mailer.js
index 61a94cbd4e..1a33d989d4 100644
--- a/src/auth-service/utils/mailer.js
+++ b/src/auth-service/utils/mailer.js
@@ -68,7 +68,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -143,7 +143,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -228,7 +228,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -309,7 +309,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics" });
if (!checkResult.success) {
return checkResult;
}
@@ -349,7 +349,7 @@ const mailer = {
const checkPromises = bccEmails.map(async (bccEmail) => {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
return checkResult.success ? bccEmail : null;
});
const successfulEmails = (await Promise.all(checkPromises)).filter(
@@ -511,7 +511,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -617,7 +617,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -736,7 +736,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "mobile_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "mobile" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -854,7 +854,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1025,7 +1025,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1372,7 +1372,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics" });
if (!checkResult.success) {
return checkResult;
}
@@ -1426,7 +1426,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics" });
if (!checkResult.success) {
return checkResult;
}
@@ -1480,7 +1480,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics" });
if (!checkResult.success) {
return checkResult;
}
@@ -1596,7 +1596,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email", product: "mobile_notifications" });
+ ).checkNotificationStatus({ email, type: "email", product: "mobile" });
if (!checkResult.success) {
return checkResult;
}
@@ -1613,7 +1613,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "mobile_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "mobile" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1689,7 +1689,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: senderEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: senderEmail, type: "email", product: "analytics" });
if (!checkResult.success) {
return checkResult;
}
@@ -1731,7 +1731,7 @@ const mailer = {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: recepientEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: recepientEmail, type: "email", product: "analytics" });
if (!checkResult.success) {
continue
}
@@ -1810,7 +1810,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics" });
if (!checkResult.success) {
return checkResult;
}
@@ -1827,7 +1827,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1902,7 +1902,7 @@ const mailer = {
try {
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email, type: "email", product: "analytics" });
if (!checkResult.success) {
return checkResult;
}
@@ -1919,7 +1919,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
@@ -1999,7 +1999,7 @@ const mailer = {
const bccEmail = bccEmails[i].trim();
const checkResult = await SubscriptionModel(
tenant
- ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics_notifications" });
+ ).checkNotificationStatus({ email: bccEmail, type: "email", product: "analytics" });
if (checkResult.success) {
subscribedEmails.push(bccEmail);
From 6f4e0839f9fe19fcce073c925c2603d2d1f19f79 Mon Sep 17 00:00:00 2001
From: Benjamin Ssempala <86492979+BenjaminSsempala@users.noreply.github.com>
Date: Tue, 9 Apr 2024 00:36:05 +0300
Subject: [PATCH 05/10] Removing " Product "
---
.../config/global/email-templates.js | 10 +-
src/auth-service/models/Subscription.js | 45 +-
src/auth-service/package-lock.json | 13536 +---------------
src/auth-service/routes/v2/users.js | 42 +-
src/auth-service/utils/create-user.js | 151 +-
src/auth-service/utils/email.msgs.js | 44 +-
src/auth-service/utils/mailer.js | 50 +-
7 files changed, 151 insertions(+), 13727 deletions(-)
diff --git a/src/auth-service/config/global/email-templates.js b/src/auth-service/config/global/email-templates.js
index ce5f7cb69c..bb2027fdb7 100644
--- a/src/auth-service/config/global/email-templates.js
+++ b/src/auth-service/config/global/email-templates.js
@@ -25,10 +25,10 @@ const emailTemplates = {