Skip to content

Commit a3fb432

Browse files
HasnatL-Adapptlimitedmorgang-adapptajithkumaradapptAntoineRelief
authored
feat: Email functions hosted on serverless function (#1160)
feat: allow emails to include links to application pages --------- Co-authored-by: Morgan Gowans <[email protected]> Co-authored-by: AjithKumar <[email protected]> Co-authored-by: Antoine Hurard <[email protected]>
1 parent 411ea15 commit a3fb432

File tree

15 files changed

+77
-2158
lines changed

15 files changed

+77
-2158
lines changed

.env.dist

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ MAIL_FROM_PREFIX=
2828
MAIL_USER=
2929
MAIL_PASS=
3030

31-
MAIL_BLOB_STORAGE_URL=
32-
MAIL_BLOB_STORAGE_NAME=
33-
MAIL_BLOB_STORAGE_KEY=
31+
# AZURE FUNCTION MAIL CONFIGURATION
32+
MAIL_SERVERLESS_URL=
33+
MAIL_SERVERLESS_KEY=
34+
35+
# BLOB STORAGE FOR EMAIL ASSETS
3436
MAIL_BLOB_STORAGE_CONTAINER=
37+
MAIL_BLOB_STORAGE_CONNECTION_STRING=
3538

3639
# AUTH CONFIGURATION
3740
AUTH_PROVIDER=

config/custom-environment-variables.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ module.exports = {
3636
connectionString: 'MAIL_BLOB_STORAGE_CONNECTION_STRING',
3737
container: 'MAIL_BLOB_STORAGE_CONTAINER',
3838
},
39+
serverless: {
40+
url: 'MAIL_SERVERLESS_URL',
41+
key: 'MAIL_SERVERLESS_KEY',
42+
},
3943
},
4044
auth: {
4145
provider: 'AUTH_PROVIDER',

config/default.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ module.exports = {
3737
connectionString: '',
3838
container: '',
3939
},
40+
serverless: {
41+
url: '',
42+
key: '',
43+
},
4044
},
4145
database: {
4246
provider: '',

package-lock.json

Lines changed: 0 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"mongoose": "^7.4.3",
8686
"node-cache": "^5.1.2",
8787
"node-fetch": "^2.6.1",
88-
"node-html-parser": "^6.1.13",
8988
"nodemailer": "^6.7.2",
9089
"passport": "^0.6.0",
9190
"passport-azure-ad": "^4.3.4",

src/const/locale.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/const/notification.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/migrations/stateStore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class MongoStorage {
6767
}
6868
callback(null);
6969
} catch (error) {
70-
console.error('error while saving', error);
7170
callback(error);
7271
}
7372
}

src/models/emailNotification.model.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export interface Dataset {
3636
sendAsAttachment: boolean;
3737
individualEmail: boolean;
3838
individualEmailFields?: any[];
39+
navigateToPage: boolean;
40+
navigateSettings: {
41+
field: string;
42+
pageUrl: string;
43+
title: string;
44+
};
3945
}
4046

4147
/** custom notification documents interface declaration */
@@ -102,6 +108,15 @@ export const emailNotificationSchema = new Schema<EmailNotification>(
102108
textStyle: { type: mongoose.Schema.Types.Mixed },
103109
sendAsAttachment: { type: Boolean, default: false },
104110
individualEmail: { type: Boolean, default: false },
111+
navigateToPage: {
112+
type: Boolean,
113+
default: false,
114+
},
115+
navigateSettings: {
116+
field: String,
117+
pageUrl: String,
118+
title: String,
119+
},
105120
},
106121
],
107122
emailDistributionList: {

0 commit comments

Comments
 (0)