@platform-x/hep-notification-client 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/jest-setup.js +28 -0
- package/dist/jest-setup.js.map +1 -0
- package/dist/src/common/controllers/common_controller.js +72 -0
- package/dist/src/common/controllers/common_controller.js.map +1 -0
- package/dist/src/common/controllers/index.js +29 -0
- package/dist/src/common/controllers/index.js.map +1 -0
- package/dist/src/common/middleware/commonMiddleware.js +141 -0
- package/dist/src/common/middleware/commonMiddleware.js.map +1 -0
- package/dist/src/common/service/requestService.js +79 -1
- package/dist/src/common/service/requestService.js.map +1 -0
- package/dist/src/common/service/twilioService.js +3 -11
- package/dist/src/common/service/twilioService.js.map +1 -0
- package/dist/src/common/util/commonUtil.js +119 -1
- package/dist/src/common/util/commonUtil.js.map +1 -0
- package/dist/src/common/util/constants.js +18 -0
- package/dist/src/common/util/constants.js.map +1 -0
- package/dist/src/common/util/errorHandler.js +4 -6
- package/dist/src/common/util/errorHandler.js.map +1 -0
- package/dist/src/common/util/httpCodes.js +26 -0
- package/dist/src/common/util/httpCodes.js.map +1 -0
- package/dist/src/common/util/logger.js +1 -1
- package/dist/src/common/util/logger.js.map +1 -0
- package/dist/src/common/util/requestTracer.js +18 -1
- package/dist/src/common/util/requestTracer.js.map +1 -0
- package/dist/src/common/util/solrConnector.js +85 -226
- package/dist/src/common/util/solrConnector.js.map +1 -0
- package/dist/src/config/index.js +49 -4
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/platform-x/app.js +35 -0
- package/dist/src/platform-x/app.js.map +1 -0
- package/dist/src/platform-x/constants/index.js +2 -14
- package/dist/src/platform-x/constants/index.js.map +1 -0
- package/dist/src/platform-x/constants/style.js +98 -98
- package/dist/src/platform-x/constants/style.js.map +1 -0
- package/dist/src/platform-x/controllers/cronController.js +399 -0
- package/dist/src/platform-x/controllers/cronController.js.map +1 -0
- package/dist/src/platform-x/controllers/fileUploadController.js +76 -0
- package/dist/src/platform-x/controllers/fileUploadController.js.map +1 -0
- package/dist/src/platform-x/controllers/graphRESTControllers.js +183 -0
- package/dist/src/platform-x/controllers/graphRESTControllers.js.map +1 -0
- package/dist/src/platform-x/controllers/index.js +30 -0
- package/dist/src/platform-x/controllers/index.js.map +1 -0
- package/dist/src/platform-x/controllers/siteDomainController.js +74 -0
- package/dist/src/platform-x/controllers/siteDomainController.js.map +1 -0
- package/dist/src/platform-x/dataSource/emailDataSource.js.map +1 -0
- package/dist/src/platform-x/database/connection.js +3 -6
- package/dist/src/platform-x/database/connection.js.map +1 -0
- package/dist/src/platform-x/database/dao/formBuilder.dao.js +1 -1
- package/dist/src/platform-x/database/dao/formBuilder.dao.js.map +1 -0
- package/dist/src/platform-x/database/dao/siteDomain.dao.js +73 -0
- package/dist/src/platform-x/database/dao/siteDomain.dao.js.map +1 -0
- package/dist/src/platform-x/database/index.js.map +1 -0
- package/dist/src/platform-x/database/interfaces/site_domain.interface.js +3 -0
- package/dist/src/platform-x/database/interfaces/site_domain.interface.js.map +1 -0
- package/dist/src/platform-x/database/models/formBuilder.model.js.map +1 -0
- package/dist/src/platform-x/database/models/site_domains.model.js +51 -0
- package/dist/src/platform-x/database/models/site_domains.model.js.map +1 -0
- package/dist/src/platform-x/routes/index.js +19 -0
- package/dist/src/platform-x/routes/index.js.map +1 -0
- package/dist/src/platform-x/services/cron.services.js +117 -0
- package/dist/src/platform-x/services/cron.services.js.map +1 -0
- package/dist/src/platform-x/util/emailHandler.js +53 -137
- package/dist/src/platform-x/util/emailHandler.js.map +1 -0
- package/dist/src/platform-x/util/emailTemplate.js +63 -60
- package/dist/src/platform-x/util/emailTemplate.js.map +1 -0
- package/dist/src/platform-x/util/solr-data-source/SolrHttpDataSource.js +31 -45
- package/dist/src/platform-x/util/solr-data-source/SolrHttpDataSource.js.map +1 -0
- package/dist/src/server.js +38 -0
- package/dist/src/server.js.map +1 -0
- package/dist/swagger.json +247 -0
- package/dist/test/controllers/common_controller.spec.js +79 -0
- package/dist/test/controllers/common_controller.spec.js.map +1 -0
- package/dist/test/middleware/commonMiddleware.spec.js +88 -0
- package/dist/test/middleware/commonMiddleware.spec.js.map +1 -0
- package/dist/test/platform-x/controllers/graphRESTControllers.spec.js +195 -0
- package/dist/test/platform-x/controllers/graphRESTControllers.spec.js.map +1 -0
- package/dist/test/platform-x/datasource/emailDataSource.spec.js +81 -0
- package/dist/test/platform-x/datasource/emailDataSource.spec.js.map +1 -0
- package/dist/test/platform-x/util/emailHandler.spec.js +474 -0
- package/dist/test/platform-x/util/emailHandler.spec.js.map +1 -0
- package/dist/test/platform-x/util/solr-data-source/SolrHttpDataSource.spec.js +80 -0
- package/dist/test/platform-x/util/solr-data-source/SolrHttpDataSource.spec.js.map +1 -0
- package/dist/test/services/requestService.spec.js +108 -0
- package/dist/test/services/requestService.spec.js.map +1 -0
- package/dist/test/services/requestServiceGet.spec.js +43 -0
- package/dist/test/services/requestServiceGet.spec.js.map +1 -0
- package/dist/test/src/common/service/twilioService.spec.js +65 -0
- package/dist/test/src/common/service/twilioService.spec.js.map +1 -0
- package/dist/test/util/commonUtil.spec.js +110 -0
- package/dist/test/util/commonUtil.spec.js.map +1 -0
- package/dist/test/util/logger.spec.js +51 -0
- package/dist/test/util/logger.spec.js.map +1 -0
- package/dist/test/util/requestTracer.spec.js +64 -0
- package/dist/test/util/requestTracer.spec.js.map +1 -0
- package/dist/test/util/solrconnector.spec.js +145 -0
- package/dist/test/util/solrconnector.spec.js.map +1 -0
- package/package.json +66 -66
- package/postman_collection/HEP_Environment.postman_environment.json +44 -44
- package/postman_collection/hep-notification.postman_collection.json +55 -55
- package/reports/output.jtl +1 -1
- package/reports/scripts/jmeter_sendgrid.js +34 -34
- package/reports/scripts/newman_sendgrid.js +40 -40
- package/reports/scripts/sendgrid.js +40 -40
- package/reports/scripts/trivy_sendgrid.js +40 -40
- package/src/common/service/requestService.ts +87 -0
- package/src/common/service/secretKeyManager.services.ts +37 -0
- package/src/common/service/twilioService.ts +58 -0
- package/src/common/util/commonUtil.ts +39 -0
- package/src/common/util/errorHandler.ts +120 -0
- package/src/common/util/logger.ts +215 -0
- package/src/common/util/requestTracer.ts +10 -0
- package/src/common/util/solrConnector.ts +319 -0
- package/src/config/index.ts +35 -0
- package/src/index.ts +34 -0
- package/src/platform-x/constants/index.ts +20 -0
- package/src/platform-x/constants/style.ts +99 -0
- package/src/platform-x/dataSource/emailDataSource.ts +34 -0
- package/src/platform-x/database/connection.ts +47 -0
- package/src/platform-x/database/dao/formBuilder.dao.ts +33 -0
- package/src/platform-x/database/index.ts +7 -0
- package/src/platform-x/database/models/formBuilder.model.ts +23 -0
- package/src/platform-x/util/emailHandler.ts +580 -0
- package/src/platform-x/util/emailTemplate.ts +66 -0
- package/src/platform-x/util/solr-data-source/SolrHttpDataSource.ts +97 -0
- package/{dist → src}/templates/orderPlaced.ejs +172 -172
- package/{dist → src}/templates/orderPlaced.html +189 -189
- package/tsconfig.json +73 -0
- package/dist/src/common/service/requestService.d.ts +0 -26
- package/dist/src/common/service/secretKeyManager.services.d.ts +0 -7
- package/dist/src/common/service/secretKeyManager.services.js +0 -58
- package/dist/src/common/service/twilioService.d.ts +0 -19
- package/dist/src/common/util/commonUtil.d.ts +0 -22
- package/dist/src/common/util/errorHandler.d.ts +0 -44
- package/dist/src/common/util/logger.d.ts +0 -68
- package/dist/src/common/util/requestTracer.d.ts +0 -2
- package/dist/src/common/util/solrConnector.d.ts +0 -47
- package/dist/src/config/index.d.ts +0 -30
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.js +0 -21
- package/dist/src/platform-x/constants/index.d.ts +0 -18
- package/dist/src/platform-x/constants/style.d.ts +0 -1
- package/dist/src/platform-x/dataSource/emailDataSource.d.ts +0 -5
- package/dist/src/platform-x/database/connection.d.ts +0 -8
- package/dist/src/platform-x/database/dao/formBuilder.dao.d.ts +0 -9
- package/dist/src/platform-x/database/index.d.ts +0 -7
- package/dist/src/platform-x/database/models/formBuilder.model.d.ts +0 -34
- package/dist/src/platform-x/util/emailHandler.d.ts +0 -62
- package/dist/src/platform-x/util/emailTemplate.d.ts +0 -4
- package/dist/src/platform-x/util/solr-data-source/SolrHttpDataSource.d.ts +0 -29
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CREATE_USER_EMAIL_TEMPLATE = exports.DEFAULT_SOLR_ROWS = exports.DEFAULT_SOLR_CORE = void 0;
|
|
4
|
+
exports.DEFAULT_SOLR_CORE = 'platform-x';
|
|
4
5
|
exports.DEFAULT_SOLR_ROWS = 2147483647;
|
|
5
6
|
exports.CREATE_USER_EMAIL_TEMPLATE = [{
|
|
6
7
|
subject: 'Plat-x User Registration',
|
|
7
8
|
hclplatformx_Body: "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\">\r\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n <link href=\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">\r\n <title>Document</title>\r\n <style>\r\n body {\r\n font-family: 'Inter', sans-serif;\r\n }\r\n @media (max-width: 697px) {\r\n .rw-100 {\r\n width: 100% !important;\r\n padding: 20px !important\r\n }\r\n .padding29 {\r\n padding-left: 29px !important;\r\n padding-right: 29px !important;\r\n }\r\n .padding15 {\r\n padding-left: 15px !important;\r\n padding-right: 15px !important;\r\n }\r\n }\r\n </style>\r\n</head>\r\n<body style=\"margin: 0; padding: 0;\">\r\n <table class=\"rw-100\" style=\"width: 698px; margin: auto; padding: 32px;\">\r\n <thead>\r\n <tr>\r\n <th style=\"padding-bottom: 30px; text-align: left;\"><img src=\"https://platx-dspace-dev.fanuep.com/server/api/core/bitstreams/792c4406-ae39-4cfd-9627-d4af2d2033bd/content\" alt=\"X\" /></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>\r\n <table style=\"text-align: center; width: 100%; background-color: #fbfaff; padding: 32px; border-radius: 18px;\">\r\n <tr>\r\n <td style=\"padding-bottom: 42px;\"><img src=\"https://platx-dspace-dev.fanuep.com/server/api/core/bitstreams/c1118d01-f887-4612-a1d4-19276ef7fe56/content\" style=\"max-width: 100%;\" alt=\"X\" /></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size: 24px; font-weight: bold; color: #000;\">Hi, {{FIRST_NAME}}</td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size: 16px; font-weight: 500; color: #333; padding-top: 20px;\">We’re so happy to have you.</td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <table style=\"text-align: center; width: 100%;\">\r\n <tr>\r\n <td style=\"font-size: 24px; font-weight: bold; color: #000; padding: 30px 0\">Your team is waiting for you to join them</td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-bottom: 20px;\"><img src=\"{{PROFILE_IMAGE}}\" alt=\"X\" width=\"50px\" height=\"50px\" /></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size: 14px; font-weight: 600; color: #2d2d39;\">{{CREATED_BY}} has invited you to collaborate on</td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding: 10px 0; font-size: 12px; font-weight: bold; color: #5256b7;\">Platform X</td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size: 12px; font-weight: 400; color: #2d2d39; padding-bottom: 20px;\">Your Role: {{ROLE}}</td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-bottom: 20px;\">\r\n <a href=\"{{URL}}\" style=\"display: inline-block; padding: 12.4px 40px; border-radius: 4px; background-color: #2d2d39; color: #fff; font-size: 16px; text-decoration: none;\">Join the team</a>\r\n </td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding: 0 44px;\" class=\"padding29\">\r\n <table style=\"text-align: center; width: 100%; background-color: #fbfaff; padding: 10px\">\r\n <tr>\r\n <td style=\"font-size: 12px; font-weight: 400; color: #2d2d39;\">Your login information</td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size: 14px; font-weight: 400; color: #5256b7; padding: 10px 0;\">“Email : <span style=\"font-weight: 600;\"> {{USERNAME}}”</span></td>\r\n </tr>\r\n <tr>\r\n <td style=\"font-size: 14px; font-weight: 400; color: #5256b7;\">“Password : <span style=\"font-weight: 600;\">{{PASSWORD}}”</span></td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <tfoot>\r\n <tr>\r\n <td>\r\n <table style=\"width: 100%; padding: 30px; text-align: center;\" class=\"padding15\">\r\n <tr>\r\n <td style=\" border-top: 1px solid rgba(0, 0, 0, 0.2); padding: 15px 0; font-size: 24px; font-weight: bold; color: #2d2d39;\">Thank You!</td>\r\n </tr>\r\n <tr>\r\n <td style=\"color: #5c6574; font-size: 12px;\">Copyright © 2023</td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n</body>\r\n</html>"
|
|
8
9
|
}];
|
|
9
|
-
/** HTTP Request related constants */
|
|
10
|
-
exports.HTTP_CONTENT_TYPE_JSON = 'application/json';
|
|
11
|
-
exports.TRACE_ID_HEADER_NAME = 'Platform-X-Trace-Id';
|
|
12
|
-
exports.DEFAULT_APP_PORT = 8080;
|
|
13
|
-
exports.DEFAULT_APP_NAME = 'api-gateway';
|
|
14
|
-
exports.DEFAULT_REALM_NAME = 'platform-x';
|
|
15
|
-
exports.DynamicValues = {
|
|
16
|
-
SENDGRID_API_KEY: 'SENDGRID_API_KEY',
|
|
17
|
-
TWILIO_ACCOUNT_SID: 'TWILIO_ACCOUNT_SID',
|
|
18
|
-
TWILIO_AUTH_TOKEN: 'TWILIO_AUTH_TOKEN',
|
|
19
|
-
TWILIO_SENDER_NUMBER: 'TWILIO_SENDER_NUMBER',
|
|
20
|
-
MONGO_PASS: 'MONGO_PASS',
|
|
21
|
-
};
|
|
22
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform-x/constants/index.ts"],"names":[],"mappings":";;;AACa,QAAA,iBAAiB,GAAG,YAAY,CAAC;AACjC,QAAA,iBAAiB,GAAG,UAAU,CAAC;AAC/B,QAAA,0BAA0B,GAAG,CAAC;QACvC,OAAO,EAAE,0BAA0B;QACnC,iBAAiB,EAAE,s3JAAs3J;KAC54J,CAAC,CAAC"}
|
|
@@ -1,103 +1,103 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.style = void 0;
|
|
4
|
-
exports.style = `<style>
|
|
5
|
-
.username {
|
|
6
|
-
font-size:24px;
|
|
7
|
-
}
|
|
8
|
-
.main_div {
|
|
9
|
-
background-color: #dff3ff;
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, "sans-serif"
|
|
12
|
-
}
|
|
13
|
-
table {
|
|
14
|
-
height: 100%;
|
|
15
|
-
margin-left: auto;
|
|
16
|
-
margin-right: auto;
|
|
17
|
-
}
|
|
18
|
-
.table_div {
|
|
19
|
-
max-width: 600px;
|
|
20
|
-
width: 100%;
|
|
21
|
-
background-color: #fff;
|
|
22
|
-
padding: 40px;
|
|
23
|
-
border-radius: 5px;
|
|
24
|
-
box-shadow: 8px 8px 16px 0 #b4e3ff;
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
}
|
|
27
|
-
.table_2 {
|
|
28
|
-
width: 100%;
|
|
29
|
-
padding-bottom: 30px;
|
|
30
|
-
border-bottom: solid 1px #bfbfbf;
|
|
31
|
-
margin-bottom: 30px;
|
|
32
|
-
}
|
|
33
|
-
.w-400 {
|
|
34
|
-
width: 402px;
|
|
35
|
-
}
|
|
36
|
-
.w_h_30 {
|
|
37
|
-
width: 40px;
|
|
38
|
-
height: auto;
|
|
39
|
-
}
|
|
40
|
-
h1 {
|
|
41
|
-
font-size: 24px;
|
|
42
|
-
color: #000;
|
|
43
|
-
text-transform: capitalize;
|
|
44
|
-
margin: 0 0 20px;
|
|
45
|
-
}
|
|
46
|
-
.main_text {
|
|
47
|
-
font-size: 16px;
|
|
48
|
-
line-height: 1.5;
|
|
49
|
-
color: #000000;
|
|
50
|
-
margin: 0 0 30px;
|
|
51
|
-
}
|
|
52
|
-
a {
|
|
53
|
-
color: #0077b5;
|
|
54
|
-
}
|
|
55
|
-
.mb_20 {
|
|
56
|
-
margin-bottom: 20px;
|
|
57
|
-
}
|
|
58
|
-
.btn {
|
|
59
|
-
display: block;
|
|
60
|
-
width: 100px;
|
|
61
|
-
padding: 15px 30px;
|
|
62
|
-
font-size: 18px;
|
|
63
|
-
font-weight: 600;
|
|
64
|
-
color: #ffffff;
|
|
65
|
-
text-align: center;
|
|
66
|
-
background-color: #2D2D39;
|
|
67
|
-
border-radius: 4px;
|
|
68
|
-
text-decoration: none;
|
|
69
|
-
}
|
|
70
|
-
.border {
|
|
71
|
-
margin-bottom: 30px;
|
|
72
|
-
border-bottom: solid 1px #bfbfbf;
|
|
73
|
-
padding-bottom: 30px;
|
|
74
|
-
}
|
|
75
|
-
.mb_pb_20 {
|
|
76
|
-
margin-bottom: 30px;
|
|
77
|
-
padding-bottom: 30px;
|
|
78
|
-
}
|
|
79
|
-
.sub_text {
|
|
80
|
-
font-size: 14px;
|
|
81
|
-
line-height: 1.5;
|
|
82
|
-
color: #000000;
|
|
83
|
-
margin: 26.5px 16px 15px 1px;
|
|
84
|
-
}
|
|
85
|
-
.link {
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
font-weight: 600;
|
|
88
|
-
color: #0077b5;
|
|
89
|
-
margin-bottom: 20px;
|
|
90
|
-
margin-right: 15px;
|
|
91
|
-
}
|
|
92
|
-
.thanks{
|
|
93
|
-
font-size: 16px;
|
|
94
|
-
line-height: 1.5;
|
|
95
|
-
color: #000000;
|
|
96
|
-
margin-top:40px
|
|
97
|
-
}
|
|
98
|
-
.mt_10{
|
|
99
|
-
margin-top:10px
|
|
100
|
-
}
|
|
101
|
-
</style>
|
|
4
|
+
exports.style = `<style>
|
|
5
|
+
.username {
|
|
6
|
+
font-size:24px;
|
|
7
|
+
}
|
|
8
|
+
.main_div {
|
|
9
|
+
background-color: #dff3ff;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, "sans-serif"
|
|
12
|
+
}
|
|
13
|
+
table {
|
|
14
|
+
height: 100%;
|
|
15
|
+
margin-left: auto;
|
|
16
|
+
margin-right: auto;
|
|
17
|
+
}
|
|
18
|
+
.table_div {
|
|
19
|
+
max-width: 600px;
|
|
20
|
+
width: 100%;
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
padding: 40px;
|
|
23
|
+
border-radius: 5px;
|
|
24
|
+
box-shadow: 8px 8px 16px 0 #b4e3ff;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
}
|
|
27
|
+
.table_2 {
|
|
28
|
+
width: 100%;
|
|
29
|
+
padding-bottom: 30px;
|
|
30
|
+
border-bottom: solid 1px #bfbfbf;
|
|
31
|
+
margin-bottom: 30px;
|
|
32
|
+
}
|
|
33
|
+
.w-400 {
|
|
34
|
+
width: 402px;
|
|
35
|
+
}
|
|
36
|
+
.w_h_30 {
|
|
37
|
+
width: 40px;
|
|
38
|
+
height: auto;
|
|
39
|
+
}
|
|
40
|
+
h1 {
|
|
41
|
+
font-size: 24px;
|
|
42
|
+
color: #000;
|
|
43
|
+
text-transform: capitalize;
|
|
44
|
+
margin: 0 0 20px;
|
|
45
|
+
}
|
|
46
|
+
.main_text {
|
|
47
|
+
font-size: 16px;
|
|
48
|
+
line-height: 1.5;
|
|
49
|
+
color: #000000;
|
|
50
|
+
margin: 0 0 30px;
|
|
51
|
+
}
|
|
52
|
+
a {
|
|
53
|
+
color: #0077b5;
|
|
54
|
+
}
|
|
55
|
+
.mb_20 {
|
|
56
|
+
margin-bottom: 20px;
|
|
57
|
+
}
|
|
58
|
+
.btn {
|
|
59
|
+
display: block;
|
|
60
|
+
width: 100px;
|
|
61
|
+
padding: 15px 30px;
|
|
62
|
+
font-size: 18px;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
color: #ffffff;
|
|
65
|
+
text-align: center;
|
|
66
|
+
background-color: #2D2D39;
|
|
67
|
+
border-radius: 4px;
|
|
68
|
+
text-decoration: none;
|
|
69
|
+
}
|
|
70
|
+
.border {
|
|
71
|
+
margin-bottom: 30px;
|
|
72
|
+
border-bottom: solid 1px #bfbfbf;
|
|
73
|
+
padding-bottom: 30px;
|
|
74
|
+
}
|
|
75
|
+
.mb_pb_20 {
|
|
76
|
+
margin-bottom: 30px;
|
|
77
|
+
padding-bottom: 30px;
|
|
78
|
+
}
|
|
79
|
+
.sub_text {
|
|
80
|
+
font-size: 14px;
|
|
81
|
+
line-height: 1.5;
|
|
82
|
+
color: #000000;
|
|
83
|
+
margin: 26.5px 16px 15px 1px;
|
|
84
|
+
}
|
|
85
|
+
.link {
|
|
86
|
+
font-size: 14px;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
color: #0077b5;
|
|
89
|
+
margin-bottom: 20px;
|
|
90
|
+
margin-right: 15px;
|
|
91
|
+
}
|
|
92
|
+
.thanks{
|
|
93
|
+
font-size: 16px;
|
|
94
|
+
line-height: 1.5;
|
|
95
|
+
color: #000000;
|
|
96
|
+
margin-top:40px
|
|
97
|
+
}
|
|
98
|
+
.mt_10{
|
|
99
|
+
margin-top:10px
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
102
102
|
`;
|
|
103
103
|
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../../src/platform-x/constants/style.ts"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGpB,CAAA"}
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.applicationSubmitRemainder = exports.formDeadlineRemainder = exports.emailConfigurationsData = exports.attachFileToMail = exports.getStatusCountFromRes = exports.createExcel = exports.NewlatterMailTriggerWithExcel = exports.contactusSubmittedMailTriggerWithExcel = exports.applicationSubmittedMailTriggerWithExcel = exports.applicationProcessRemainder = void 0;
|
|
39
|
+
const logger_1 = require("../../common/util/logger");
|
|
40
|
+
const formBuilder_dao_1 = __importDefault(require("../database/dao/formBuilder.dao"));
|
|
41
|
+
const moment_1 = __importDefault(require("moment"));
|
|
42
|
+
const commonUtil_1 = require("../../common/util/commonUtil");
|
|
43
|
+
const cron_services_1 = require("../services/cron.services");
|
|
44
|
+
const config_1 = __importDefault(require("../../config"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const exceljs_1 = __importDefault(require("exceljs"));
|
|
48
|
+
const emailHandler_1 = require("../util/emailHandler");
|
|
49
|
+
const constants_1 = require("../../common/util/constants");
|
|
50
|
+
const lodash_1 = require("lodash");
|
|
51
|
+
const fileUploadController_1 = require("./fileUploadController");
|
|
52
|
+
/**
|
|
53
|
+
* Crontroller to sent application form submit remainder
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
const applicationProcessRemainder = () => {
|
|
57
|
+
return (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
+
logger_1.Logger.info('Reached cron controller applcation process reminder', 'applicationProcessRemainder');
|
|
59
|
+
try {
|
|
60
|
+
const formData = new formBuilder_dao_1.default();
|
|
61
|
+
const cron_notification = new cron_services_1.CronService();
|
|
62
|
+
const twoDaysAgo = (0, moment_1.default)().subtract(48, 'hours').toDate();
|
|
63
|
+
const resdata = yield formData.fetch(config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.APPLICATION_FORM_COLLECTION, {
|
|
64
|
+
status: { $in: ['draft'] },
|
|
65
|
+
createdAt: { $lte: twoDaysAgo },
|
|
66
|
+
});
|
|
67
|
+
yield (resdata === null || resdata === void 0 ? void 0 : resdata.forEach((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
yield cron_notification.applicationProcessRemainder({ userEmail: data === null || data === void 0 ? void 0 : data.user_email, userName: data === null || data === void 0 ? void 0 : data.user_name }, "Application-Submit-Remainder" /* EmailTemplates.Appication_Submit_Ramainder */);
|
|
69
|
+
})));
|
|
70
|
+
(0, commonUtil_1.handleResponse)(res, { message: 'Application process remainder sent' }, null);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
logger_1.Logger.error(`cronController: Error in ApplicationProcessRemainder`, err, 'applicationProcessRemainder');
|
|
74
|
+
(0, commonUtil_1.handleResponse)(res, null, err);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
exports.applicationProcessRemainder = applicationProcessRemainder;
|
|
79
|
+
/**
|
|
80
|
+
* Application submit Mail Trigger along with Excel
|
|
81
|
+
* @param req
|
|
82
|
+
* @param res
|
|
83
|
+
*/
|
|
84
|
+
const applicationSubmittedMailTriggerWithExcel = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
+
logger_1.Logger.info('Reached CronController applicationSubmittedMailTriggerWithExcel', 'applicationSubmittedMailTriggerWithExcel');
|
|
86
|
+
try {
|
|
87
|
+
const applicationName = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.APPLICATION_FORM_COLLECTION;
|
|
88
|
+
yield (0, exports.createExcel)("Application_Form.xlsx" /* FormNames.Aplication_Form_Name */, applicationName, "Application Form Data" /* FormNames.Application_Sheet_Name */, constants_1.APPLICATION_ID);
|
|
89
|
+
(0, commonUtil_1.handleResponse)(res, { message: 'Application Submitted mail send with attachment' }, null);
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
logger_1.Logger.error(`cronController: Error in applicationSubmittedMailTriggerWithExcel`, err, 'applicationSubmittedMailTriggerWithExcel');
|
|
93
|
+
(0, commonUtil_1.handleResponse)(res, null, err);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
exports.applicationSubmittedMailTriggerWithExcel = applicationSubmittedMailTriggerWithExcel;
|
|
97
|
+
/**
|
|
98
|
+
* Contact Us Mail Trigger along with Excel
|
|
99
|
+
* @param req
|
|
100
|
+
* @param res
|
|
101
|
+
*/
|
|
102
|
+
const contactusSubmittedMailTriggerWithExcel = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
+
logger_1.Logger.info('Reached CronController contactusSubmittedMailTriggerWithExcel', 'contactusSubmittedMailTriggerWithExcel');
|
|
104
|
+
try {
|
|
105
|
+
const applicationName = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.CONTACT_FORM_COLLECTION;
|
|
106
|
+
yield (0, exports.createExcel)("Contact_Form.xlsx" /* FormNames.Contact_Us_Form_Name */, applicationName, "Contact Us Data" /* FormNames.Contact_Us_Sheet_Name */, constants_1.CONTACT_US);
|
|
107
|
+
(0, commonUtil_1.handleResponse)(res, { message: 'Contact us Submitted mail send with attachment' }, null);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
logger_1.Logger.error(`cronController: Error in contactusSubmittedMailTriggerWithExcel`, err, 'contactusSubmittedMailTriggerWithExcel');
|
|
111
|
+
(0, commonUtil_1.handleResponse)(res, null, err);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
exports.contactusSubmittedMailTriggerWithExcel = contactusSubmittedMailTriggerWithExcel;
|
|
115
|
+
/**
|
|
116
|
+
* News Letter Mail Trigger along with Excel
|
|
117
|
+
* @param req
|
|
118
|
+
* @param res
|
|
119
|
+
*/
|
|
120
|
+
const NewlatterMailTriggerWithExcel = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
|
+
logger_1.Logger.info('Reached CronController NewlatterMailTriggerWithExcel', 'NewlatterMailTriggerWithExcel');
|
|
122
|
+
try {
|
|
123
|
+
const applicationName = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.NEWS_LETTER_FORM_COLLECTION;
|
|
124
|
+
yield (0, exports.createExcel)("News_Letter.xlsx" /* FormNames.News_Letter_Form_Name */, applicationName, "News Letter Data" /* FormNames.News_Letter_Sheet_Name */, constants_1.NEWS_LETTER);
|
|
125
|
+
(0, commonUtil_1.handleResponse)(res, { message: 'New Letter mail Triggered with an attachment' }, null);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
logger_1.Logger.error(`cronController: Error in NewlatterMailTriggerWithExcel`, err, 'NewlatterMailTriggerWithExcel');
|
|
129
|
+
(0, commonUtil_1.handleResponse)(res, null, err);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
exports.NewlatterMailTriggerWithExcel = NewlatterMailTriggerWithExcel;
|
|
133
|
+
/**
|
|
134
|
+
* attaching data in the Excel and sharing over the mail
|
|
135
|
+
* @function createExcel
|
|
136
|
+
*/
|
|
137
|
+
const createExcel = (fileName, applicationName, sheetName, formName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
logger_1.Logger.info('Reached CronController createExcel', 'createExcel');
|
|
140
|
+
try {
|
|
141
|
+
const formData = new formBuilder_dao_1.default();
|
|
142
|
+
let resdata;
|
|
143
|
+
let statusCounts = {};
|
|
144
|
+
if (fileName === "Application_Form.xlsx" /* FormNames.Aplication_Form_Name */) {
|
|
145
|
+
resdata = yield formData.fetch(applicationName, {});
|
|
146
|
+
statusCounts = (0, exports.getStatusCountFromRes)(resdata);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
resdata = yield formData.fetch(applicationName, {});
|
|
150
|
+
}
|
|
151
|
+
if (!resdata) {
|
|
152
|
+
logger_1.Logger.info('No data found for excel generation', 'createExcel');
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
statusCounts.fileName = fileName;
|
|
156
|
+
// Exclude the '$__', '$isNew', '_doc'
|
|
157
|
+
const excludedKeys = new Set(['$__', '$isNew', '_doc', 'user_id', 'issoftDelete', '!@~@', '9.5-Captcha']);
|
|
158
|
+
// Create new Excel workbook or file
|
|
159
|
+
const workbook = new exceljs_1.default.Workbook();
|
|
160
|
+
const worksheet = workbook.addWorksheet('Form Data'); // sheet name is form data
|
|
161
|
+
const headersSet = new Set();
|
|
162
|
+
headersSet.add('_id'); // explicitly adding _id
|
|
163
|
+
// Collect all unique headers from top level + form_data.title
|
|
164
|
+
resdata === null || resdata === void 0 ? void 0 : resdata.forEach((headerData) => {
|
|
165
|
+
Object.keys(headerData).forEach(key => {
|
|
166
|
+
var _a;
|
|
167
|
+
if (key === '_id') {
|
|
168
|
+
headersSet.add('_id'); // Explicitly include _id
|
|
169
|
+
}
|
|
170
|
+
if (key !== 'form_data' && !excludedKeys.has(key)) {
|
|
171
|
+
headersSet.add(key);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
(_a = headerData === null || headerData === void 0 ? void 0 : headerData.form_data) === null || _a === void 0 ? void 0 : _a.forEach((field) => {
|
|
175
|
+
if (field === null || field === void 0 ? void 0 : field.title) {
|
|
176
|
+
headersSet.add(field === null || field === void 0 ? void 0 : field.title);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
const headers = Array.from(headersSet);
|
|
183
|
+
headers.sort((a, b) => {
|
|
184
|
+
return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
|
|
185
|
+
});
|
|
186
|
+
worksheet.addRow(headers); // Header row
|
|
187
|
+
resdata.forEach(entry => {
|
|
188
|
+
const row = [];
|
|
189
|
+
headers.forEach((header) => {
|
|
190
|
+
var _a;
|
|
191
|
+
let value = '';
|
|
192
|
+
// Try top-level value first
|
|
193
|
+
if (header === '_id' && (entry === null || entry === void 0 ? void 0 : entry._id)) {
|
|
194
|
+
value = entry === null || entry === void 0 ? void 0 : entry._id.toString(); // Convert ObjectId to string
|
|
195
|
+
}
|
|
196
|
+
if (entry.hasOwnProperty(header)) {
|
|
197
|
+
value = entry[header];
|
|
198
|
+
if (header.toLowerCase().includes('date') && typeof value === 'string') {
|
|
199
|
+
const parsedDate = new Date(value);
|
|
200
|
+
if (!isNaN(parsedDate.getTime())) {
|
|
201
|
+
value = parsedDate.toLocaleString('en-IN', {
|
|
202
|
+
timeZone: 'Asia/Kolkata',
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// If not found, check inside form_data by matching title
|
|
208
|
+
const matchingField = (_a = entry.form_data) === null || _a === void 0 ? void 0 : _a.find((field) => field.title === header);
|
|
209
|
+
if (matchingField) {
|
|
210
|
+
const valueData = matchingField === null || matchingField === void 0 ? void 0 : matchingField.value;
|
|
211
|
+
if (Array.isArray(valueData)) {
|
|
212
|
+
if ((0, lodash_1.isObject)(valueData[0])) {
|
|
213
|
+
const singleLineData = valueData.map((obj) => {
|
|
214
|
+
if ((obj === null || obj === void 0 ? void 0 : obj.label) && (obj === null || obj === void 0 ? void 0 : obj.value)) {
|
|
215
|
+
return obj === null || obj === void 0 ? void 0 : obj.value;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
return Object.entries(obj)
|
|
219
|
+
.map(([key, val]) => `${key}: ${val}`)
|
|
220
|
+
.join(', ');
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
value = singleLineData === null || singleLineData === void 0 ? void 0 : singleLineData.join(',');
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
value = valueData === null || valueData === void 0 ? void 0 : valueData.join(',');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else if ((0, lodash_1.isObject)(valueData)) {
|
|
230
|
+
value = valueData === null || valueData === void 0 ? void 0 : valueData.value;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
value = valueData;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
row.push(value);
|
|
237
|
+
});
|
|
238
|
+
worksheet.addRow(row);
|
|
239
|
+
});
|
|
240
|
+
// Save to file
|
|
241
|
+
const outputDir = path.join(__dirname, 'excel_exports');
|
|
242
|
+
logger_1.Logger.info('Excel file path is ', `${outputDir}`);
|
|
243
|
+
if (!fs.existsSync(outputDir)) {
|
|
244
|
+
fs.mkdirSync(outputDir);
|
|
245
|
+
}
|
|
246
|
+
const filePath = path.join(outputDir, fileName);
|
|
247
|
+
logger_1.Logger.info('Excel file path is ', `${filePath}`);
|
|
248
|
+
yield workbook.xlsx.writeFile(filePath);
|
|
249
|
+
const uploadFileRes = yield (0, fileUploadController_1.uploadFile)(filePath, formName);
|
|
250
|
+
const host_url = (_b = (_a = uploadFileRes === null || uploadFileRes === void 0 ? void 0 : uploadFileRes.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.relativeUrl;
|
|
251
|
+
statusCounts.host_url = host_url;
|
|
252
|
+
logger_1.Logger.debug(' Excel generation completed for all sites', 'uploadFileRes', uploadFileRes);
|
|
253
|
+
const mailRes = yield (0, exports.attachFileToMail)(filePath, fileName, sheetName, applicationName, statusCounts);
|
|
254
|
+
logger_1.Logger.info(' Excel generation completed for all sites', 'createExcel');
|
|
255
|
+
return uploadFileRes;
|
|
256
|
+
// return mailRes;
|
|
257
|
+
}
|
|
258
|
+
catch (err) {
|
|
259
|
+
logger_1.Logger.error('Error in CreateExcel function', 'createExcel', err);
|
|
260
|
+
throw err;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
exports.createExcel = createExcel;
|
|
264
|
+
/**
|
|
265
|
+
* this function is get the status count from the response.
|
|
266
|
+
* @param resdata
|
|
267
|
+
* @returns
|
|
268
|
+
*/
|
|
269
|
+
const getStatusCountFromRes = (resdata) => {
|
|
270
|
+
return resdata.reduce((acc, curr) => {
|
|
271
|
+
const status = curr.status || 'unknown'; // handle missing status safely
|
|
272
|
+
acc[status] = (acc[status] || 0) + 1;
|
|
273
|
+
return acc;
|
|
274
|
+
}, {});
|
|
275
|
+
};
|
|
276
|
+
exports.getStatusCountFromRes = getStatusCountFromRes;
|
|
277
|
+
/**
|
|
278
|
+
* attach File to Mail function
|
|
279
|
+
* @param filePath
|
|
280
|
+
* @param fileName
|
|
281
|
+
* @returns
|
|
282
|
+
*/
|
|
283
|
+
const attachFileToMail = (filePath, fileName, form_name, applicationName, statusCounts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
284
|
+
logger_1.Logger.info('Reached CronController attachFileToMail', 'attachFileToMail');
|
|
285
|
+
try {
|
|
286
|
+
let supportMail = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.MAIL_ID;
|
|
287
|
+
if (applicationName === (config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.APPLICATION_FORM_COLLECTION) ||
|
|
288
|
+
applicationName === (config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.NEWS_LETTER_FORM_COLLECTION) ||
|
|
289
|
+
applicationName === (config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.CONTACT_FORM_COLLECTION)) {
|
|
290
|
+
supportMail = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.CFF_INFO_MAIL;
|
|
291
|
+
}
|
|
292
|
+
let recipientsData = [{
|
|
293
|
+
name: '',
|
|
294
|
+
email: supportMail,
|
|
295
|
+
}];
|
|
296
|
+
let emailTriggerRequest = {
|
|
297
|
+
form_name,
|
|
298
|
+
host_url: `${constants_1.GCP_STORAGE_URL}${statusCounts === null || statusCounts === void 0 ? void 0 : statusCounts.host_url}`,
|
|
299
|
+
};
|
|
300
|
+
logger_1.Logger.info('GCP storage URL is ', `${emailTriggerRequest.host_url}`);
|
|
301
|
+
let emailConfig = {};
|
|
302
|
+
if (config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.CFF_CC_EMAIL) {
|
|
303
|
+
recipientsData === null || recipientsData === void 0 ? void 0 : recipientsData.push({ name: '', email: config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.CFF_CC_EMAIL });
|
|
304
|
+
}
|
|
305
|
+
if (statusCounts.fileName === "Application_Form.xlsx" /* FormNames.Aplication_Form_Name */) {
|
|
306
|
+
emailTriggerRequest.draft = statusCounts === null || statusCounts === void 0 ? void 0 : statusCounts.draft;
|
|
307
|
+
emailTriggerRequest.published = statusCounts === null || statusCounts === void 0 ? void 0 : statusCounts.published;
|
|
308
|
+
emailConfig = (0, exports.emailConfigurationsData)(emailTriggerRequest, recipientsData, "ApplicationFormStatus" /* EmailTemplates.Application_Form_Status */);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
emailConfig = (0, exports.emailConfigurationsData)(emailTriggerRequest, recipientsData, "ApplicationStatusToTeam" /* EmailTemplates.Application_status_to_Team */);
|
|
312
|
+
}
|
|
313
|
+
const emailhandler = new emailHandler_1.EmailHandler();
|
|
314
|
+
return yield emailhandler.sendPersonalizeEmailRequest(emailConfig);
|
|
315
|
+
}
|
|
316
|
+
catch (err) {
|
|
317
|
+
logger_1.Logger.error('❌ Error in attachFileToMail function', 'attachFileToMail', err);
|
|
318
|
+
throw err;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
exports.attachFileToMail = attachFileToMail;
|
|
322
|
+
/**
|
|
323
|
+
* this function for Email configuration
|
|
324
|
+
* @param emailTriggerRequest
|
|
325
|
+
* @param recipientsData
|
|
326
|
+
* @param email_type
|
|
327
|
+
*/
|
|
328
|
+
const emailConfigurationsData = (emailTriggerRequest, recipientsData, email_type) => {
|
|
329
|
+
return {
|
|
330
|
+
replacement_variables: emailTriggerRequest,
|
|
331
|
+
recipients: recipientsData,
|
|
332
|
+
email_type,
|
|
333
|
+
isCFF: true,
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
exports.emailConfigurationsData = emailConfigurationsData;
|
|
337
|
+
/**
|
|
338
|
+
* Crontroller to sent form deadline remainder
|
|
339
|
+
* @returns
|
|
340
|
+
*/
|
|
341
|
+
const formDeadlineRemainder = () => {
|
|
342
|
+
return (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
343
|
+
logger_1.Logger.info('Reached: cron controller formDeadlineRemainder', 'formDeadlineRemainder');
|
|
344
|
+
try {
|
|
345
|
+
const formData = new formBuilder_dao_1.default();
|
|
346
|
+
const cron_notification = new cron_services_1.CronService();
|
|
347
|
+
let { deadlineLimit, today } = (0, commonUtil_1.getTwoDaysBeforeDeadlineWindow)();
|
|
348
|
+
const resdata = yield formData.fetch(config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.APPLICATION_FORM_COLLECTION, {
|
|
349
|
+
deadline_date: {
|
|
350
|
+
$gte: today.toISOString(),
|
|
351
|
+
$lte: deadlineLimit.toISOString(),
|
|
352
|
+
$ne: '',
|
|
353
|
+
},
|
|
354
|
+
status: 'draft',
|
|
355
|
+
});
|
|
356
|
+
yield (resdata === null || resdata === void 0 ? void 0 : resdata.forEach((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
357
|
+
yield cron_notification.applicationProcessRemainder({ userEmail: data === null || data === void 0 ? void 0 : data.user_email, userName: data === null || data === void 0 ? void 0 : data.user_name }, "Deadline Template" /* EmailTemplates.Deadline_Remainder */);
|
|
358
|
+
})));
|
|
359
|
+
(0, commonUtil_1.handleResponse)(res, { message: 'Remainder sent for deadline of form' }, null);
|
|
360
|
+
}
|
|
361
|
+
catch (err) {
|
|
362
|
+
logger_1.Logger.error(`cronController: Error in formDeadlineRemainder`, err, 'formDeadlineRemainder');
|
|
363
|
+
(0, commonUtil_1.handleResponse)(res, null, err);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
exports.formDeadlineRemainder = formDeadlineRemainder;
|
|
368
|
+
/**
|
|
369
|
+
* Crontroller to send remainder for application submit progress
|
|
370
|
+
* @returns
|
|
371
|
+
*/
|
|
372
|
+
const applicationSubmitRemainder = () => {
|
|
373
|
+
return (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
374
|
+
logger_1.Logger.info('Reached: cron controller applicationSubmitRemainder', 'applicationSubmitRemainder');
|
|
375
|
+
try {
|
|
376
|
+
const formData = new formBuilder_dao_1.default();
|
|
377
|
+
const cron_notification = new cron_services_1.CronService();
|
|
378
|
+
const resData = yield formData.fetch(config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.APPLICATION_FORM_COLLECTION, {
|
|
379
|
+
status: 'draft',
|
|
380
|
+
deadline_date: { $exists: true, $ne: '' },
|
|
381
|
+
});
|
|
382
|
+
for (const data of resData) {
|
|
383
|
+
try {
|
|
384
|
+
yield cron_notification.applicationSubmitRemainder(data);
|
|
385
|
+
}
|
|
386
|
+
catch (error) {
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
(0, commonUtil_1.handleResponse)(res, { message: 'Remainder sent for application submit' }, null);
|
|
391
|
+
}
|
|
392
|
+
catch (err) {
|
|
393
|
+
logger_1.Logger.error(`cronController: Error in applicationSubmitRemainder`, err, 'applicationSubmitRemainder');
|
|
394
|
+
(0, commonUtil_1.handleResponse)(res, null, err, err === null || err === void 0 ? void 0 : err.code);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
exports.applicationSubmitRemainder = applicationSubmitRemainder;
|
|
399
|
+
//# sourceMappingURL=cronController.js.map
|