tango-app-api-audit 1.0.63 → 1.0.64

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.63",
3
+ "version": "1.0.64",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -31,9 +31,9 @@ import {
31
31
  } from 'tango-app-api-middleware/src/utils/aws/sqs.js';
32
32
  import {
33
33
  aggregateStoreAudit,
34
- // findOneStoreAudit,
34
+ findOneStoreAudit,
35
35
  updateOneStoreAudit,
36
- updateStoreAudit,
36
+ updateManyStoreAudit,
37
37
  } from '../service/storeAudit.service.js';
38
38
  import _ from 'lodash';
39
39
  import {
@@ -431,7 +431,7 @@ export async function getAuditFile( req, res ) {
431
431
  moduleType: inputData.moduleType,
432
432
  };
433
433
  reauditInsert = await createUserAudit( record );
434
- await updateStoreAudit( query, storeRecord );
434
+ await updateManyStoreAudit( query, storeRecord );
435
435
  } else {
436
436
  reauditInsert = userDetails[0];
437
437
  }
@@ -567,7 +567,7 @@ export async function getAuditFile( req, res ) {
567
567
  };
568
568
 
569
569
  insertData = await createUserAudit( record );
570
- await updateStoreAudit( query, storeRecord );
570
+ await updateManyStoreAudit( query, storeRecord );
571
571
  } else {
572
572
  insertData = userDetails[0];
573
573
  }
@@ -1220,13 +1220,12 @@ export async function save( req, res ) {
1220
1220
  const bucket = JSON.parse( process.env.BUCKET );
1221
1221
  const sqs = JSON.parse( process.env.SQS );
1222
1222
  const inputData = req.body;
1223
- // let storeAuditData = await findOneStoreAudit( {
1224
- // storeId: inputData.storeId,
1225
- // fileDate: inputData.fileDate,
1226
- // moduleType: inputData.moduleType,
1227
- // zoneName: inputData.zoneName,
1228
- // auditType: inputData.auditType,
1229
- // } );
1223
+ let storeAuditData = await findOneStoreAudit( {
1224
+ storeId: inputData.storeId,
1225
+ fileDate: inputData.fileDate,
1226
+ moduleType: inputData.moduleType,
1227
+ zoneName: inputData.zoneName,
1228
+ } );
1230
1229
  // logger.info( { storeAuditData: storeAuditData } );
1231
1230
  // if ( storeAuditData==null ) {
1232
1231
  // logger.error( {
@@ -4,8 +4,8 @@ export function updateOneStoreAudit( query, record ) {
4
4
  return storeAuditModel.updateOne( query, { $set: record } );
5
5
  }
6
6
 
7
- export function updateStoreAudit( query, record ) {
8
- return storeAuditModel.update( query, { $set: record }, { upsert: true } );
7
+ export function updateManyStoreAudit( query, record ) {
8
+ return storeAuditModel.updateMany( query, { $set: record }, { upsert: true } );
9
9
  }
10
10
 
11
11
  export function createStoreAudit( record ) {