tango-app-api-audit 1.0.62 → 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
|
@@ -31,9 +31,9 @@ import {
|
|
|
31
31
|
} from 'tango-app-api-middleware/src/utils/aws/sqs.js';
|
|
32
32
|
import {
|
|
33
33
|
aggregateStoreAudit,
|
|
34
|
-
|
|
34
|
+
findOneStoreAudit,
|
|
35
35
|
updateOneStoreAudit,
|
|
36
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
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( {
|
|
@@ -1294,7 +1293,7 @@ export async function save( req, res ) {
|
|
|
1294
1293
|
// // moduleType: inputData.moduleType,
|
|
1295
1294
|
// // zoneName: inputData.zoneName,
|
|
1296
1295
|
// } );
|
|
1297
|
-
const isoDate = userAudit?.startTime;
|
|
1296
|
+
const isoDate = req.body.userAudit?.startTime;
|
|
1298
1297
|
const currentTime = dayjs();
|
|
1299
1298
|
const isoDateTime = dayjs( isoDate );
|
|
1300
1299
|
const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
|
|
@@ -1319,7 +1318,7 @@ export async function save( req, res ) {
|
|
|
1319
1318
|
|
|
1320
1319
|
let storeConfig = await findOneStore(
|
|
1321
1320
|
{
|
|
1322
|
-
storeId: userAudit?.storeId,
|
|
1321
|
+
storeId: req.body.userAudit?.storeId,
|
|
1323
1322
|
},
|
|
1324
1323
|
{
|
|
1325
1324
|
auditConfigs: 1,
|
|
@@ -4,8 +4,8 @@ export function updateOneStoreAudit( query, record ) {
|
|
|
4
4
|
return storeAuditModel.updateOne( query, { $set: record } );
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export function
|
|
8
|
-
return storeAuditModel.
|
|
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 ) {
|