tango-app-api-audit 1.0.37 → 1.0.38

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": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,4 +1,4 @@
1
- import { download, getJsonFileData, getUTC, insertOpenSearchData, listFileByPath, sendMessageToQueue, signedUrl, sqsReceive } from 'tango-app-api-middleware';
1
+ import { download, fileUpload, getJsonFileData, getUTC, insertOpenSearchData, listFileByPath, sendMessageToQueue, signedUrl, sqsReceive } from 'tango-app-api-middleware';
2
2
  import { aggregateZoneUserAudit, createZoneUserAudit, findOneZoneUserAudit } from '../service/zoneUserAudit.service.js';
3
3
  import { logger } from 'tango-app-api-middleware';
4
4
  import { aggregateAssignZoneAudit } from '../service/assignZoneAudit.service.js';
@@ -10,7 +10,7 @@ import { aggregateUserAudit, findOneUserAudit, updateOneUserAudit } from '../ser
10
10
  import { aggregateAssignAudit } from '../service/assignAudit.service.js';
11
11
  import { createAuditLog, findOneAuditLog } from '../service/auditLog.service.js';
12
12
  import { mapCustomer, mapEmployee, mapJunk, splitB20000, splitE0, splitG20000 } from '../validation/audit.validation.js';
13
- import { aggregateClient } from '../service/client.service.js';
13
+ import { aggregateClient, findClient } from '../service/client.service.js';
14
14
  import { aggregateAuditClientData } from '../service/auditClientData.service.js';
15
15
  import _ from 'lodash';
16
16
  import { listQueue } from 'tango-app-api-middleware/src/utils/aws/sqs.js';
@@ -426,14 +426,14 @@ export async function save( req, res ) {
426
426
 
427
427
  if ( mappingUpload?.statusCode ) {
428
428
  logger.error( {
429
- error: `ERROR IN UPLOAD PATH: ${inputData.storeId}/${inputData.fileDate}/${bucket.masterJsonFile}`,
429
+ error: `ERROR IN UPLOAD PATH: ${inputData.storeId}/${inputData.zoneName}/${inputData.fileDate}/${bucket.masterJsonFile}`,
430
430
  type: 'UPLOAD_ERROR',
431
431
  } );
432
432
  return res.sendError( mappingUpload, 500 );
433
433
  }
434
434
 
435
435
  let getUserAuditData = await findOneUserAudit( {
436
- _id: new mongoose.Types.ObjectId( inputData.auditId ),
436
+ _id: inputData.auditId,
437
437
  } );
438
438
  const isoDate = getUserAuditData.startTime;
439
439
  const currentTime = dayjs();
@@ -441,7 +441,7 @@ export async function save( req, res ) {
441
441
  const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
442
442
 
443
443
  await updateOneUserAudit(
444
- { _id: new mongoose.Types.ObjectId( inputData.auditId ) },
444
+ { _id: inputData.auditId },
445
445
  {
446
446
  auditStatus: 'completed',
447
447
  endTime: Date.now(),
@@ -481,7 +481,7 @@ export async function save( req, res ) {
481
481
  storeConfig.auditConfigs.ratio
482
482
  ) && inputData.auditType == 'Audit' ) {
483
483
  logger.info(
484
- `Hit in Reaudit pushing queue Store Id=${inputData.storeId},File Date=${inputData.fileDate}, /n \nQueue Name = ${clientData[0].auditConfigs.queueName}`,
484
+ `Hit in Reaudit pushing queue Store Id=${inputData.storeId},zone Name = ${inputData.zoneName}File Date=${inputData.fileDate}, /n \nQueue Name = ${clientData[0].auditConfigs.queueName}`,
485
485
  'Reaudit',
486
486
  );
487
487
 
@@ -501,7 +501,7 @@ export async function save( req, res ) {
501
501
 
502
502
  if ( sqsQueue.statusCode ) {
503
503
  logger.error( {
504
- error: `ERROR IN UPLOAD PATH: ${inputData.storeId}/${inputData.fileDate}/${bucket.masterJsonFile}`,
504
+ error: `ERROR IN UPLOAD PATH: ${inputData.storeId}/${inputData.zoneName}/${inputData.fileDate}/${bucket.masterJsonFile}`,
505
505
  type: 'UPLOAD_ERROR',
506
506
  } );
507
507
  return res.sendError( mappingUpload, 500 );
@@ -543,7 +543,7 @@ export async function save( req, res ) {
543
543
  } catch ( error ) {
544
544
  const err = error.message || 'Internal Server Error';
545
545
  logger.error( { error: error, message: req.body, function: 'save' } );
546
- return res.sendError( err );
546
+ return res.sendError( err, 500 );
547
547
  }
548
548
  }
549
549