tango-app-api-audit 3.4.61 → 3.4.62

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.4.61",
3
+ "version": "3.4.62",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4939,12 +4939,31 @@ export async function getDetectionAuditFile( req, res ) {
4939
4939
  startTime: new Date(),
4940
4940
  moduleType: inputData.moduleType,
4941
4941
  };
4942
- const query = {
4943
- storeId: msg.storeId,
4944
- zoneName: msg.zoneName,
4945
- fileDate: msg.fileDate,
4946
- moduleType: inputData.moduleType,
4947
- };
4942
+ let query ={};
4943
+ switch ( inputData.moduleType ) {
4944
+ case 'open-time':
4945
+
4946
+ case 'close-time':
4947
+
4948
+ case 'mobile-detection':
4949
+
4950
+ case 'uniform-detection':
4951
+ query = {
4952
+ storeId: msg.storeId,
4953
+ fileDate: msg.fileDate,
4954
+ moduleType: inputData.moduleType,
4955
+ };
4956
+ break;
4957
+ case 'hygiene':
4958
+ query = {
4959
+ storeId: msg.storeId,
4960
+ zoneName: msg.zoneName,
4961
+ fileDate: msg.fileDate,
4962
+ moduleType: inputData.moduleType,
4963
+ };
4964
+ break;
4965
+ }
4966
+
4948
4967
  const storeRecord = {
4949
4968
  userId: req.user._id,
4950
4969
  storeId: msg.storeId,
@@ -5147,6 +5166,7 @@ export async function getDraftedData( req, res ) {
5147
5166
 
5148
5167
  export async function save( req, res ) {
5149
5168
  try {
5169
+ const url = JSON.parse( process.env.URL );
5150
5170
  const openSearch = JSON.parse( process.env.OPENSEARCH );
5151
5171
  const bucket = JSON.parse( process.env.BUCKET );
5152
5172
  const sqs = JSON.parse( process.env.SQS );
@@ -5292,6 +5312,21 @@ export async function save( req, res ) {
5292
5312
  await copyImage( copyParams );
5293
5313
  }
5294
5314
 
5315
+ if ( inputData.moduleType == 'hygiene' && inputData.employeeCount> 0 ) {
5316
+ const hygieneTaskData = {
5317
+ storeName: getStore?.storeName,
5318
+ taskName: 'Store Hygiene Check',
5319
+ question: 'A store hygiene issue has been detected. Upload a new image showing the current store condition.',
5320
+ answerType: 'descriptiveImage',
5321
+ referenceImage: [ `${output.folderPath}${tempId[0]}` ],
5322
+ zoneName: inputData?.zoneName,
5323
+ };
5324
+ await axios.post( `${url.apiDomain}/v3/task/StoreHygienetask`, hygieneTaskData, { headers: {
5325
+ 'Content-Type': 'application/json',
5326
+ 'Authorization': 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f55' },
5327
+ } );
5328
+ }
5329
+
5295
5330
  const logData = {
5296
5331
  userId: req.user._id,
5297
5332
  userName: req.user.userName,