tango-app-api-audit 3.6.36 → 3.6.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-audit",
3
- "version": "3.6.36",
3
+ "version": "3.6.37",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -924,16 +924,24 @@ export async function save( req, res ) {
924
924
  updatedAt: new Date(),
925
925
 
926
926
  };
927
+ const reference1 ={
928
+ storeCode: inputUpdatedData?._source?.storeName,
929
+ OptomId: inputUpdatedData?._source?.optumId,
930
+ feedBackIssuedBy: req?.user?.email,
931
+ RMName: inputData.RMEmail,
932
+ clusterName: inputData.cluster,
933
+ };
927
934
  await insertWithId( openSearch.eyeTestEmailAlert, id, record1 );
928
935
  sendComplianceEmail( {
929
936
  toEmail: inputUpdatedData?._source?.salesmanEmailId,
930
937
  fromEmail: ses.eyeTestAlertEmail,
931
- userName: 'User',
938
+ userName: 'Optom',
932
939
  storeName: inputUpdatedData?._source?.storeName,
933
940
  startTime: `${inputUpdatedData?._source?.fileDate}T${inputUpdatedData?._source.testEndTime}`,
934
941
  compliancePercentage: humanScore,
935
942
  steps: steps,
936
943
  videoUrl: `${url.physical}${inputUpdatedData?._source?.filePath}`,
944
+ ref: reference1,
937
945
  } );
938
946
  }
939
947
  break;
@@ -955,16 +963,24 @@ export async function save( req, res ) {
955
963
  updatedAt: new Date(),
956
964
 
957
965
  };
966
+ const reference2 ={
967
+ storeCode: inputUpdatedData?._source?.storeName,
968
+ OptomId: inputUpdatedData?._source?.optumId,
969
+ feedBackIssuedBy: req?.user?.email,
970
+ RMName: inputData.RMEmail,
971
+ clusterName: inputData.cluster,
972
+ };
958
973
  await insertWithId( openSearch.eyeTestEmailAlert, id, record2 );
959
974
  sendComplianceEmail( {
960
975
  toEmail: inputUpdatedData?._source?.salesmanEmailId,
961
976
  fromEmail: ses.eyeTestAlertEmail,
962
- userName: 'User',
977
+ userName: 'Optom',
963
978
  storeName: inputUpdatedData?._source?.storeName,
964
979
  startTime: `${inputUpdatedData?._source?.fileDate}T${inputUpdatedData?._source.testEndTime}`,
965
980
  compliancePercentage: humanScore,
966
981
  steps: steps,
967
982
  videoUrl: `${url.physical}${inputUpdatedData?._source?.filePath}`,
983
+ ref: reference2,
968
984
  } );
969
985
  };
970
986
  break;
@@ -986,16 +1002,24 @@ export async function save( req, res ) {
986
1002
  updatedAt: new Date(),
987
1003
 
988
1004
  };
1005
+ const reference3 ={
1006
+ storeCode: inputUpdatedData?._source?.storeName,
1007
+ OptomId: inputUpdatedData?._source?.optumId,
1008
+ feedBackIssuedBy: req?.user?.email,
1009
+ RMName: inputData.RMEmail,
1010
+ clusterName: inputData.cluster,
1011
+ };
989
1012
  await insertWithId( openSearch.eyeTestEmailAlert, id, record3 );
990
1013
  sendComplianceEmail( {
991
1014
  toEmail: inputUpdatedData?._source?.salesmanEmailId,
992
1015
  fromEmail: ses.eyeTestAlertEmail,
993
- userName: 'User',
1016
+ userName: 'Optom',
994
1017
  storeName: inputUpdatedData?._source?.storeName,
995
1018
  startTime: `${inputUpdatedData?._source?.fileDate}T${inputUpdatedData?._source.testEndTime}`,
996
1019
  compliancePercentage: humanScore,
997
1020
  steps: steps,
998
1021
  videoUrl: `${url.physical}${inputUpdatedData?._source?.filePath}`,
1022
+ ref: reference3,
999
1023
  } );
1000
1024
  }
1001
1025
  break;
@@ -1017,16 +1041,24 @@ export async function save( req, res ) {
1017
1041
  updatedAt: new Date(),
1018
1042
 
1019
1043
  };
1044
+ const reference4 ={
1045
+ storeCode: inputUpdatedData?._source?.storeName,
1046
+ OptomId: inputUpdatedData?._source?.optumId,
1047
+ feedBackIssuedBy: req?.user?.email,
1048
+ RMName: inputData.RMEmail,
1049
+ clusterName: inputData.cluster,
1050
+ };
1020
1051
  await insertWithId( openSearch.eyeTestEmailAlert, id, record4 );
1021
1052
  sendComplianceEmail( {
1022
1053
  toEmail: inputUpdatedData?._source?.salesmanEmailId,
1023
1054
  fromEmail: ses.eyeTestAlertEmail,
1024
- userName: 'User',
1055
+ userName: 'Optom',
1025
1056
  storeName: inputUpdatedData?._source?.storeName,
1026
1057
  startTime: `${inputUpdatedData?._source?.fileDate}T${inputUpdatedData?._source.testEndTime}`,
1027
1058
  compliancePercentage: humanScore,
1028
1059
  steps: steps,
1029
1060
  videoUrl: `${url.physical}${inputUpdatedData?._source?.filePath}`,
1061
+ ref: reference4,
1030
1062
  } );
1031
1063
  }
1032
1064
  break;
@@ -1049,16 +1081,24 @@ export async function save( req, res ) {
1049
1081
  updatedAt: new Date(),
1050
1082
 
1051
1083
  };
1084
+ const reference5 ={
1085
+ storeCode: inputUpdatedData?._source?.storeName,
1086
+ OptomId: inputUpdatedData?._source?.optumId,
1087
+ feedBackIssuedBy: req?.user?.email,
1088
+ RMName: inputData.RMEmail,
1089
+ clusterName: inputData.cluster,
1090
+ };
1052
1091
  await insertWithId( openSearch.eyeTestEmailAlert, id, record5 );
1053
1092
  sendComplianceEmail( {
1054
1093
  toEmail: inputUpdatedData?._source?.salesmanEmailId,
1055
1094
  fromEmail: ses.eyeTestAlertEmail,
1056
- userName: 'User',
1095
+ userName: 'Optom',
1057
1096
  storeName: inputUpdatedData?._source?.storeName,
1058
1097
  startTime: `${inputUpdatedData?._source?.fileDate}T${inputUpdatedData?._source.testEndTime}`,
1059
1098
  compliancePercentage: humanScore,
1060
1099
  steps: steps,
1061
1100
  videoUrl: `${url.physical}${inputUpdatedData?._source?.filePath}`,
1101
+ ref: reference5,
1062
1102
  } );
1063
1103
  }
1064
1104
  break;
@@ -1079,16 +1119,24 @@ export async function save( req, res ) {
1079
1119
  createdAt: new Date(),
1080
1120
  updatedAt: new Date(),
1081
1121
  };
1122
+ const reference6 ={
1123
+ storeCode: inputUpdatedData?._source?.storeName,
1124
+ OptomId: inputUpdatedData?._source?.optumId,
1125
+ feedBackIssuedBy: req?.user?.email,
1126
+ RMName: inputData.RMEmail,
1127
+ clusterName: inputData.cluster,
1128
+ };
1082
1129
  await insertWithId( openSearch.eyeTestEmailAlert, id, record6 );
1083
1130
  sendComplianceEmail( {
1084
1131
  toEmail: inputUpdatedData?._source?.salesmanEmailId,
1085
1132
  fromEmail: ses.eyeTestAlertEmail,
1086
- userName: 'User',
1133
+ userName: 'Optom',
1087
1134
  storeName: inputUpdatedData?._source?.storeName,
1088
1135
  startTime: `${inputUpdatedData?._source?.fileDate}T${inputUpdatedData?._source.testEndTime}`,
1089
1136
  compliancePercentage: humanScore,
1090
1137
  steps: steps,
1091
1138
  videoUrl: `${url.physical}${inputUpdatedData?._source?.filePath}`,
1139
+ ref: reference6,
1092
1140
  } );
1093
1141
  }
1094
1142
  break;
@@ -1,5 +1,5 @@
1
1
  import express from 'express';
2
- import { isAuditDocumentExist, isAuditInputFolderExist, isAuditUser, isExistsQueue, isFeatureRunning, validateUserAudit, validation } from '../validation/audit.validation.js';
2
+ import { isAuditDocumentExist, isAuditInputFolderExist, isAuditUser, isExistsQueue, isFeatureRunning, validateUserAudit } from '../validation/audit.validation.js';
3
3
  import { accessVerification, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
4
4
  import { auditImages, auditStoreList, auditUserList, clientMetrics, clients, getAuditFile, getDraftedData, overAllAuditSummary, overViewCard, overviewTable, pendingSummaryTable, reTrigger, save, saveDraft, storeMetrics, summarySplit, totalNotAssignedCount, userAuditHistory, userMetrics, workSpace, getUserAuditCount, getUserAuditCountMTD, auditViewLogs, getUserCredit, rePushAuditStores } from '../controllers/audit.controllers.js';
5
5
  import { auditStoreValid, clientMetricsValid, clientValid, getDraftedDataValid, getFileValid, overAllAuditSummaryValid, overViewCardValid, pendingSummaryTableValid, reTriggerValid, saveDraftValid, saveValid, storeMetricsValid, summarySplitValid, userAuditHistoryValid, userMetricsValid, workSpaceValid, auditImageValid, overviewTableValid, auditViewLogValid, rePushAuditStoresValid } from '../dtos/audit.dtos.js';
@@ -73,6 +73,7 @@ export async function sendComplianceEmail( {
73
73
  compliancePercentage,
74
74
  steps,
75
75
  videoUrl, // S3 cdn video URL
76
+ ref,
76
77
  } ) {
77
78
  // Initialize AWS SES client
78
79
  const sesClient = new SESClient( {
@@ -149,7 +150,7 @@ export async function sendComplianceEmail( {
149
150
  font-weight: 600;
150
151
  }
151
152
  .footer { margin-top: 24px; color: #555; font-size: 16px; text-align: left; }
152
- .attachment { margin-top: 24px; color: #555; font-size: 18px; text-align: left; }
153
+ .attachment { margin-top: 24px; color: #555; font-size: 16px; text-align: left; }
153
154
  .copy-rights { margin-top: 24px; color: #555; font-size: 12px; text-align: left; }
154
155
  </style>
155
156
  </head>
@@ -164,15 +165,45 @@ export async function sendComplianceEmail( {
164
165
 
165
166
  <p class="subtitle">
166
167
  Dear ${userName},<br><br>
167
- Please ensure that all conducted eye tests meet the required compliance standards.<br><br>
168
- Your prompt attention to this matter will help us maintain the highest standards and avoid any<br>
169
- discrepancies. Please take a look at the below findings.
168
+ We’d like to share some feedback regarding certain areas where expectations haven’t been fully met. This is simply intended as a
169
+ constructive step forward to help you gain clarity and to ensure you feel supported as you grow in your role.<br><br>
170
+
171
+ We value the effort you’ve put in, and this feedback is part of our commitment to help every team member succeed. We will be discussing
172
+ this in person to clearly outline the next steps and ensure you are equipped to succeed in your role.<br><br>
173
+
174
+ Looking forward to working together on this, Below is a copy of yoursubmitted responses for your reference:
170
175
  </p>
171
176
 
177
+ <table class="table">
178
+ <tbody>
179
+ <tr>
180
+ <td>Store Code</td>
181
+ <td>${ref.storeCode ?? '--'}</td>
182
+ </tr>
183
+ <tr>
184
+ <td>Optom ID</td>
185
+ <td>${ref.OptomId ?? '--'}</td>
186
+ </tr>
187
+ <tr>
188
+ <td>Feedback Issued By</td>
189
+ <td>${ref.feedBackIssuedBy ?? '--'}</td>
190
+ </tr>
191
+ <tr>
192
+ <td>RM Name</td>
193
+ <td>${ref.RMName ?? '--'}</td>
194
+ </tr>
195
+ <tr>
196
+ <td>Cluster Name</td>
197
+ <td>${ref.clusterName ?? '--'}</td>
198
+ </tr>
199
+ </tbody>
200
+ </table>
201
+
202
+
172
203
  <table class="table">
173
204
  <thead>
174
205
  <tr>
175
- <th>Step Name</th>
206
+ <th>Steps Violated</th>
176
207
  <th>Comments</th>
177
208
  </tr>
178
209
  </thead>
@@ -183,7 +214,7 @@ export async function sendComplianceEmail( {
183
214
 
184
215
  <div class="compliance-box">Compliance Percentage: ${compliancePercentage}%</div>
185
216
 
186
- <p class="attachment">One Attachment</p>
217
+ <p class="attachment">Here’s the Eye test compliance video for your review</p>
187
218
  <!-- Video Embed (only if provided) -->
188
219
  ${
189
220
  videoUrl ?