tango-app-api-trax 1.0.0-beta-task.24 → 1.0.0-beta-task.25

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-trax",
3
- "version": "1.0.0-beta-task.24",
3
+ "version": "1.0.0-beta-task.25",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -36,10 +36,10 @@ async function LamdaServiceCall( url, data ) {
36
36
  export async function getchecklist( req, res ) {
37
37
  try {
38
38
  let url = JSON.parse( process.env.LAMBDAURL );
39
- console.log( url.checklistQuestion );
39
+
40
40
 
41
41
  let resultData = await LamdaServiceCall( url.checklistQuestion, req.body );
42
- console.log( resultData );
42
+
43
43
 
44
44
  if ( resultData ) {
45
45
  if ( resultData.status_code == '200' ) {
@@ -276,7 +276,7 @@ export async function approveChecklist( req, res ) {
276
276
  if ( req.body?.storeId?.length ) {
277
277
  query['store_id'] = { $in: req.body.storeId };
278
278
  }
279
- let checklistDetails = await processedChecklist.find( query, { _id: 1, checklistStatus: 1, storeName: 1 } );
279
+ let checklistDetails = await processedChecklist.find( query, { _id: 1, checklistStatus: 1, storeName: 1, store_id: 1, userEmail: 1 } );
280
280
  if ( !checklistDetails.length ) {
281
281
  return res.sendError( 'No data found', 204 );
282
282
  }
@@ -284,17 +284,20 @@ export async function approveChecklist( req, res ) {
284
284
  if ( idList.length ) {
285
285
  let updateResponse = await processedChecklist.updateMany( { _id: { $in: idList } }, { approvalStatus: true } );
286
286
  if ( updateResponse.modifiedCount || updateResponse.matchedCount ) {
287
+ let inputstores = checklistDetails.filter( ( data ) => data.checklistStatus == 'submit' );
288
+ console.log( inputstores );
287
289
  let params = {
288
290
  'payload': {
289
291
  sourceCheckList_id: req.body.sourceCheckList_id,
290
292
  fromDate: req.body.fromDate,
291
293
  toDate: req.body.toDate,
292
- store_id: req.body.storeId,
294
+ store_id: inputstores,
293
295
  },
294
296
  'upsert': {
295
297
  approvalStatus: true,
296
298
  },
297
299
  };
300
+
298
301
  const requestOptions = {
299
302
  method: 'POST',
300
303
  headers: {
@@ -443,7 +446,7 @@ export async function getLogs( req, res ) {
443
446
  response.push( initiatedstatus );
444
447
  response.push( userAnswer );
445
448
  }
446
-
449
+ response = response.sort( ( a, b ) => b.Timestamp - a.Timestamp );
447
450
 
448
451
  res.sendSuccess( response );
449
452
  } catch ( e ) {
@@ -465,7 +468,6 @@ export async function approvalstatus( req, res ) {
465
468
  let url = JSON.parse( process.env.LAMBDAURL );
466
469
  let resultData = await LamdaServiceCall( url.approvalstatus, req.body );
467
470
  if ( resultData ) {
468
- console.log( resultData.status_code );
469
471
  if ( resultData.status_code == '200' ) {
470
472
  return res.sendSuccess( resultData );
471
473
  }
@@ -478,7 +480,7 @@ export async function approvalstatus( req, res ) {
478
480
 
479
481
  let url = JSON.parse( process.env.LAMBDAURL );
480
482
  let resultData = await LamdaServiceCall( url.approvalstatus, req.body );
481
- console.log( resultData );
483
+
482
484
  if ( resultData ) {
483
485
  if ( resultData.status_code == '200' ) {
484
486
  return res.sendSuccess( resultData );
@@ -502,7 +504,7 @@ export const headerStoresV2 = async ( req, res ) => {
502
504
  let getRole = req.user.role;
503
505
  let getClientId = reqestData.clientId;
504
506
  let totalStores = await getStoresList( getUserEmail, getClientId, getUserType, getRole, req );
505
- console.log( totalStores.length );
507
+
506
508
 
507
509
  if ( totalStores && totalStores.length>0 ) {
508
510
  let storeQuery = [];