tango-app-api-audit 3.4.0-alpha.16 → 3.4.0-alpha.18

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.0-alpha.16",
3
+ "version": "3.4.0-alpha.18",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -198,7 +198,8 @@ export async function getAuditFile( req, res ) {
198
198
  const bucket = JSON.parse( process.env.BUCKET );
199
199
  const openSearch = JSON.parse( process.env.OPENSEARCH );
200
200
  const inputData = req.query;
201
- const data = await getDate( new Date(), new Date() );
201
+ const previousDate = new Date(new Date() - 1);
202
+ const data = await getDate(previousDate, new Date() );
202
203
  logger.info( { data: data, function: 'data', newDate: new Date() } );
203
204
  logger.info( { userId: req.user._id, queueName: inputData.queueName, moduleType: inputData.moduleType } );
204
205
  const start = data.start;
@@ -753,10 +754,9 @@ export async function workSpace( req, res ) {
753
754
  const filter =[
754
755
  { status: { $in: [ 'active', 'hold' ] } },
755
756
  { 'auditConfigs.audit': { $eq: true } },
757
+ { clientId: { $in: inputData.clientId } }
756
758
  ];
757
- if ( inputData?.clientId?.length > 0 ) {
758
- filter.push( { clientId: { $in: inputData.clientId } } );
759
- }
759
+
760
760
  const temp = [];
761
761
  const clientQuery = [
762
762
  {
@@ -808,7 +808,7 @@ export async function workSpace( req, res ) {
808
808
 
809
809
  const clientDetails = await aggregateClient( clientQuery );
810
810
  const clientList = clientDetails.map( ( i ) => i.clientId );
811
- const fileDate = dayjs( dateRange.start ).subtract( 1, 'days' );
811
+ const fileDate = dayjs( dateRange.start ).subtract( 1, 'days' ); //dayjs( dateRange.start );
812
812
  const getStoreData = await findOneStoreData(
813
813
  {},
814
814
  { fileDate: 1 },
@@ -1456,6 +1456,7 @@ export async function userAuditHistory( req, res ) {
1456
1456
  {
1457
1457
  moduleType: { $eq: inputData.moduleType },
1458
1458
  },
1459
+ { clientId: { $in: inputData.clientId } }
1459
1460
  ];
1460
1461
 
1461
1462
  if ( inputData.dateType == 'fileDate' ) {
@@ -1487,9 +1488,6 @@ export async function userAuditHistory( req, res ) {
1487
1488
  auditStatus: { $in: inputData.filterByStatus },
1488
1489
  } );
1489
1490
  }
1490
- if ( inputData?.clientId?.length > 0 ) {
1491
- filter.push( { clientId: { $in: inputData.clientId } } );
1492
- }
1493
1491
  const query = [
1494
1492
  {
1495
1493
  $match: {
@@ -1926,11 +1924,9 @@ export async function storeMetrics( req, res ) {
1926
1924
  { fileDateISO: { $gte: dateRange.start } },
1927
1925
  { fileDateISO: { $lte: dateRange.end } },
1928
1926
  { moduleType: { $eq: inputData.moduleType } },
1927
+ { clientId: { $in: inputData.filterByClientId } }
1929
1928
 
1930
1929
  ];
1931
- if ( inputData.filterByClientId && inputData.filterByClientId?.length > 0 ) {
1932
- filter.push( { clientId: { $in: inputData.filterByClientId } } );
1933
- }
1934
1930
 
1935
1931
  if ( inputData.filterByStoreId && inputData.filterByStoreId?.length > 0 ) {
1936
1932
  filter.push( { storeId: { $in: inputData.filterByStoreId } } );
@@ -2482,13 +2478,10 @@ export async function pendingSummaryTable( req, res ) {
2482
2478
  { fileDateISO: { $lte: dateRange.end } },
2483
2479
  { auditStatus: { $ne: 'completed' } },
2484
2480
  { moduleType: { $eq: inputData.moduleType } },
2481
+ { clientId: { $in: inputData.clientId }},
2485
2482
 
2486
2483
  ];
2487
2484
 
2488
- if ( inputData.clientId.length > 0 ) {
2489
- filters.push( { clientId: { $in: inputData.clientId } } );
2490
- }
2491
-
2492
2485
  if ( inputData.filterByAuditType.length > 0 ) {
2493
2486
  filters.push( { auditType: { $in: inputData.filterByAuditType } } );
2494
2487
  }
@@ -2669,12 +2662,10 @@ export async function overAllAuditSummary( req, res ) {
2669
2662
  let filters =[
2670
2663
  { fileDateISO: { $gte: dateRange.start } },
2671
2664
  { fileDateISO: { $lte: dateRange.end } },
2672
- { moduleType: { $eq: inputData.moduleType },
2673
- },
2665
+ { moduleType: { $eq: inputData.moduleType }},
2666
+ { clientId: { $in: inputData.clientId } }
2674
2667
  ];
2675
- if ( inputData.clientId.length > 0 ) {
2676
- filters.push( { clientId: { $in: inputData.clientId } } );
2677
- }
2668
+
2678
2669
  const storeQuery = inputData.clientId.length? { 'edge.firstFile': true, 'clientId': { $in: inputData. clientId } } : { 'edge.firstFile': true };
2679
2670
  temp.installedStores = await countDocumentsStore( storeQuery );
2680
2671
  const auditClientDataQuery =[
@@ -2934,10 +2925,9 @@ export async function overViewCard( req, res ) {
2934
2925
  let filters =[
2935
2926
  { fileDateISO: { $gte: dateRange.start } },
2936
2927
  { fileDateISO: { $lte: dateRange.end } },
2928
+ { clientId: { $in: inputData.clientId } }
2937
2929
  ];
2938
- if ( inputData.clientId.length > 0 ) {
2939
- filters.push( { clientId: { $in: inputData.clientId } } );
2940
- }
2930
+
2941
2931
  const query =[
2942
2932
  {
2943
2933
  $match: {
@@ -3092,10 +3082,9 @@ export async function summarySplit( req, res ) {
3092
3082
  { fileDateISO: { $gte: dateRange.start } },
3093
3083
  { fileDateISO: { $lte: dateRange.end } },
3094
3084
  { moduleType: { $eq: inputData.moduleType } },
3085
+ { clientId: { $in: inputData.clientId } }
3095
3086
  ];
3096
- if ( inputData.clientId.length > 0 ) {
3097
- filters.push( { clientId: { $in: inputData.clientId } } );
3098
- }
3087
+
3099
3088
  const query =[
3100
3089
  {
3101
3090
  $match: {
@@ -3206,13 +3195,10 @@ export async function overviewTable( req, res ) {
3206
3195
  { fileDateISO: { $gte: dateRange.start } },
3207
3196
  { fileDateISO: { $lte: dateRange.end } },
3208
3197
  { moduleType: { $eq: inputData.moduleType } },
3198
+ { clientId: { $in: inputData.clientId } }
3209
3199
 
3210
3200
  ];
3211
3201
 
3212
- if ( inputData.clientId.length > 0 ) {
3213
- filters.push( { clientId: { $in: inputData.clientId } } );
3214
- }
3215
-
3216
3202
  if ( inputData.filterByAuditType.length > 0 ) {
3217
3203
  filters.push( { auditType: { $in: inputData.filterByAuditType } } );
3218
3204
  }
@@ -18,7 +18,8 @@ export async function getDetectionAuditFile( req, res ) {
18
18
  const bucket = JSON.parse( process.env.BUCKET );
19
19
  const openSearch = JSON.parse( process.env.OPENSEARCH );
20
20
  const inputData = req.query;
21
- const data = await getDate( new Date(), new Date() );
21
+ const previousDate = new Date(new Date() - 1);
22
+ const data = await getDate( previousDate, new Date() );
22
23
  logger.info( { data: data, function: 'data', newDate: new Date() } );
23
24
  logger.info( { userId: req.user._id, queueName: inputData.queueName, moduleType: inputData.moduleType } );
24
25
  const start = data.start;
@@ -471,10 +472,9 @@ export async function workSpace( req, res ) {
471
472
  const filter =[
472
473
  { status: { $in: [ 'active', 'hold' ] } },
473
474
  { 'auditConfigs.audit': { $eq: true } },
475
+ { clientId: { $in: inputData.clientId } }
474
476
  ];
475
- if ( inputData?.clientId?.length > 0 ) {
476
- filter.push( { clientId: { $in: inputData.clientId } } );
477
- }
477
+
478
478
  const temp = [];
479
479
  const clientQuery = [
480
480
  {
@@ -903,7 +903,8 @@ export async function getAuditFile( req, res ) {
903
903
  try {
904
904
  const inputData = req.query;
905
905
  const openSearch = JSON.parse( process.env.OPENSEARCH );
906
- const data = await getDate( new Date(), new Date() );
906
+ const previousDate = new Date(new Date() - 1);
907
+ const data = await getDate( previousDate, new Date() );
907
908
  const start = data.start;
908
909
  const end = data.end;
909
910
  let msg = {};
@@ -1226,7 +1227,7 @@ export async function getAuditFile( req, res ) {
1226
1227
  export async function getUpdatedFile( req, res ) {
1227
1228
  try {
1228
1229
  const openSearch = JSON.parse( process.env.OPENSEARCH );
1229
- const inputData = req.query;
1230
+ const inputData = req.body;
1230
1231
  const msg = req?.TraxData?.sqs?.Body;
1231
1232
  logger.info( { msg: msg } );
1232
1233
  let result =[];
@@ -1387,7 +1388,7 @@ export async function getUpdatedFile( req, res ) {
1387
1388
  } );
1388
1389
  } catch ( error ) {
1389
1390
  const err = error.message || 'Internal Server Error';
1390
- logger.error( { error: error, data: req.query, function: 'getUpdatedFile' } );
1391
+ logger.error( { error: error, data: req.body, function: 'getUpdatedFile' } );
1391
1392
  return res.sendError( err, 500 );
1392
1393
  }
1393
1394
  }
@@ -1399,6 +1400,7 @@ export async function saveBinary( req, res ) {
1399
1400
  const currentTime = dayjs();
1400
1401
  const isoDateTime = dayjs( isoDate );
1401
1402
  const timeDifferenceInMinutes = currentTime.diff( isoDateTime, 'seconds' );
1403
+ const value = inputData.moduleType? inputData.moduleType.replace( /-/g, ' ' ) : '';
1402
1404
  switch ( inputData.moduleType ) {
1403
1405
  case 'unattended-customer':
1404
1406
  let unattendedquery ={
@@ -1421,7 +1423,7 @@ export async function saveBinary( req, res ) {
1421
1423
  return res.sendError( 'Update failed, it may be invalid request', 400 );
1422
1424
  }
1423
1425
  logger.info( 'update in binary data', { query: unattendedquery, update: update } );
1424
- res.sendSuccess( `Successfully update in ${inputData.moduleType} ` );
1426
+ return res.sendSuccess( `Successfully updated in ${value}` );
1425
1427
 
1426
1428
  break;
1427
1429
 
@@ -1445,7 +1447,7 @@ export async function saveBinary( req, res ) {
1445
1447
  return res.sendError( 'Update failed, it may be invalid request', 400 );
1446
1448
  }
1447
1449
  logger.info( 'update in binary data', { query: leftquery, update: leftupdate } );
1448
- res.sendSuccess( `Successfully update in ${inputData.moduleType} ` );
1450
+ return res.sendSuccess( `Successfully updated in ${value}` );
1449
1451
 
1450
1452
  break;
1451
1453
 
@@ -1469,14 +1471,13 @@ export async function saveBinary( req, res ) {
1469
1471
  return res.sendError( 'Update failed, it may be invalid request', 400 );
1470
1472
  }
1471
1473
  logger.info( 'update in binary data', { query: cameraquery, update: cameraupdate } );
1472
- res.sendSuccess( `Successfully update in ${inputData.moduleType} ` );
1474
+ return res.sendSuccess( `Successfully updated in ${value}` );
1473
1475
 
1474
1476
  break;
1475
1477
 
1476
1478
  default:
1477
1479
  res.sendError( 'no data', 204 );
1478
- break
1479
- ;
1480
+ break;
1480
1481
  }
1481
1482
  } catch ( error ) {
1482
1483
  const err = error.mesage || 'Internal Server Error';
@@ -1496,6 +1497,7 @@ export async function userAuditHistory( req, res ) {
1496
1497
  let filter = [
1497
1498
  { userId: { $eq: userId } },
1498
1499
  { moduleType: { $eq: inputData.moduleType } },
1500
+ { clientId: { $in: inputData.clientId } }
1499
1501
  ];
1500
1502
 
1501
1503
  if ( inputData.dateType == 'fileDate' ) {
@@ -1528,9 +1530,7 @@ export async function userAuditHistory( req, res ) {
1528
1530
  auditStatus: { $in: inputData.filterByStatus },
1529
1531
  } );
1530
1532
  }
1531
- if ( inputData?.clientId?.length > 0 ) {
1532
- filter.push( { clientId: { $in: inputData.clientId } } );
1533
- }
1533
+
1534
1534
  const query = [
1535
1535
  {
1536
1536
  $match: {
@@ -1724,16 +1724,16 @@ export async function userAuditHistory( req, res ) {
1724
1724
  switch ( inputData.moduleType ) {
1725
1725
  case 'camera-angle-change':
1726
1726
  temp['stream Name'] = element.streamName;
1727
- temp['User Comments'] = element.userCommands;
1727
+ temp['User Comments'] = element.userComments;
1728
1728
  break;
1729
1729
  case 'unattended-customer':
1730
1730
  temp['Customer ID'] = element.tempId;
1731
1731
  temp['Question'] = element.question;
1732
- temp['User Comments'] = element.userCommands;
1732
+ temp['User Comments'] = element.userComments;
1733
1733
  break;
1734
1734
  case 'left-in-middle':
1735
1735
  temp['Question'] = element.question;
1736
- temp['User Comments'] = element.userCommands;
1736
+ temp['User Comments'] = element.userComments;
1737
1737
  break;
1738
1738
  case 'uniform-detection':
1739
1739
  temp['Before Count'] = element.beforeCount;
@@ -2005,11 +2005,9 @@ export async function storeMetrics( req, res ) {
2005
2005
  { fileDateISO: { $gte: dateRange.start } },
2006
2006
  { fileDateISO: { $lte: dateRange.end } },
2007
2007
  { moduleType: { $eq: inputData.moduleType } },
2008
+ { clientId: { $in: inputData.filterByClientId } }
2008
2009
 
2009
2010
  ];
2010
- if ( inputData.filterByClientId && inputData.filterByClientId?.length > 0 ) {
2011
- filter.push( { clientId: { $in: inputData.filterByClientId } } );
2012
- }
2013
2011
 
2014
2012
  if ( inputData.filterByStoreId && inputData.filterByStoreId?.length > 0 ) {
2015
2013
  filter.push( { storeId: { $in: inputData.filterByStoreId } } );
@@ -2073,6 +2071,7 @@ export async function storeMetrics( req, res ) {
2073
2071
  },
2074
2072
  tempId: 1,
2075
2073
  streamName: 1,
2074
+ userComments: 1,
2076
2075
  question: 1,
2077
2076
  questionType: 1,
2078
2077
  answer: 1,
@@ -2163,6 +2162,7 @@ export async function storeMetrics( req, res ) {
2163
2162
  streamName: 1,
2164
2163
  question: 1,
2165
2164
  questionType: 1,
2165
+ userComments: 1,
2166
2166
  answer: 1,
2167
2167
  moduleType: 1,
2168
2168
  value: 1,
@@ -2258,6 +2258,7 @@ export async function storeMetrics( req, res ) {
2258
2258
  streamName: 1,
2259
2259
  question: 1,
2260
2260
  questionType: 1,
2261
+ userComments: 1,
2261
2262
  answer: 1,
2262
2263
  // userId: {
2263
2264
  // $arrayElemAt: [ '$userId', { $subtract: [ { $size: '$userId' }, 1 ] } ], //need to check if no data
@@ -2346,6 +2347,7 @@ export async function storeMetrics( req, res ) {
2346
2347
  streamName: 1,
2347
2348
  question: 1,
2348
2349
  questionType: 1,
2350
+ userComments: 1,
2349
2351
  answer: 1,
2350
2352
  moduleType: 1,
2351
2353
  value: 1,
@@ -2406,6 +2408,7 @@ export async function storeMetrics( req, res ) {
2406
2408
  { question: { $regex: inputData.searchValue, $options: 'i' } },
2407
2409
  { answer: { $regex: inputData.searchValue, $options: 'i' } },
2408
2410
  { auditStatus: { $regex: inputData.searchValue, $options: 'i' } },
2411
+ { userComments: { $regex: inputData.searchValue, $options: 'i' } },
2409
2412
  ],
2410
2413
  },
2411
2414
  } );
@@ -2453,16 +2456,16 @@ export async function storeMetrics( req, res ) {
2453
2456
  switch ( inputData.moduleType ) {
2454
2457
  case 'camera-angle-change':
2455
2458
  temp['stream Name'] = element.streamName;
2456
- temp['User Comments'] = element.auditStatus;
2459
+ temp['User Comments'] = element.userComments;
2457
2460
  break;
2458
2461
  case 'unattended-customer':
2459
2462
  temp['Customer ID'] = element.tempId;
2460
2463
  temp['Question'] = element.question;
2461
- temp['User Comments'] = element.auditStatus;
2464
+ temp['User Comments'] = element.userComments;
2462
2465
  break;
2463
2466
  case 'left-in-middle':
2464
2467
  temp['Question'] = element.question;
2465
- temp['User Comments'] = element.userCommands;
2468
+ temp['User Comments'] = element.userComments;
2466
2469
  temp['Status'] = element.auditStatus;
2467
2470
  break;
2468
2471
  case 'mobile-detection':
@@ -2809,13 +2812,10 @@ export async function pendingSummaryTable( req, res ) {
2809
2812
  { fileDateISO: { $lte: dateRange.end } },
2810
2813
  { auditStatus: { $ne: 'completed' } },
2811
2814
  { moduleType: { $eq: inputData.moduleType } },
2815
+ { clientId: { $in: inputData.clientId } }
2812
2816
 
2813
2817
  ];
2814
2818
 
2815
- if ( inputData.clientId.length > 0 ) {
2816
- filters.push( { clientId: { $in: inputData.clientId } } );
2817
- }
2818
-
2819
2819
  if ( inputData.filterByAuditType.length > 0 ) {
2820
2820
  filters.push( { auditType: { $in: inputData.filterByAuditType } } );
2821
2821
  }
@@ -3014,12 +3014,10 @@ export async function overAllAuditSummary( req, res ) {
3014
3014
  let filters =[
3015
3015
  { fileDateISO: { $gte: dateRange.start } },
3016
3016
  { fileDateISO: { $lte: dateRange.end } },
3017
- { moduleType: { $eq: inputData.moduleType },
3018
- },
3017
+ { moduleType: { $eq: inputData.moduleType }},
3018
+ { clientId: { $in: inputData.clientId } }
3019
3019
  ];
3020
- if ( inputData.clientId.length > 0 ) {
3021
- filters.push( { clientId: { $in: inputData.clientId } } );
3022
- }
3020
+
3023
3021
  const storeQuery = inputData.clientId.length? { 'edge.firstFile': true, 'clientId': { $in: inputData. clientId } } : { 'edge.firstFile': true };
3024
3022
  temp.installedStores = await countDocumentsStore( storeQuery );
3025
3023
  const auditClientDataQuery =[
@@ -3183,10 +3181,9 @@ export async function summarySplit( req, res ) {
3183
3181
  { fileDateISO: { $gte: dateRange.start } },
3184
3182
  { fileDateISO: { $lte: dateRange.end } },
3185
3183
  { moduleType: { $eq: inputData.moduleType } },
3184
+ { clientId: { $in: inputData.clientId } }
3186
3185
  ];
3187
- if ( inputData.clientId.length > 0 ) {
3188
- filters.push( { clientId: { $in: inputData.clientId } } );
3189
- }
3186
+
3190
3187
  const query =[
3191
3188
  {
3192
3189
  $match: {
@@ -3297,13 +3294,10 @@ export async function overviewTable( req, res ) {
3297
3294
  { fileDateISO: { $gte: dateRange.start } },
3298
3295
  { fileDateISO: { $lte: dateRange.end } },
3299
3296
  { moduleType: { $eq: inputData.moduleType } },
3297
+ { clientId: { $in: inputData.clientId } }
3300
3298
 
3301
3299
  ];
3302
3300
 
3303
- if ( inputData.clientId.length > 0 ) {
3304
- filters.push( { clientId: { $in: inputData.clientId } } );
3305
- }
3306
-
3307
3301
  if ( inputData.filterByAuditType.length > 0 ) {
3308
3302
  filters.push( { auditType: { $in: inputData.filterByAuditType } } );
3309
3303
  }
@@ -3461,16 +3455,16 @@ export async function overviewTable( req, res ) {
3461
3455
  switch ( inputData.moduleType ) {
3462
3456
  case 'camera-angle-change':
3463
3457
  temp['stream Name'] = element.streamName;
3464
- temp['User Comments'] = element.userCommands;
3458
+ temp['User Comments'] = element.userComments;
3465
3459
  break;
3466
3460
  case 'unattended-customer':
3467
3461
  temp['Customer ID'] = element.tempId;
3468
3462
  temp['Question'] = element.question;
3469
- temp['User Comments'] = element.userCommands;
3463
+ temp['User Comments'] = element.userComments;
3470
3464
  break;
3471
3465
  case 'left-in-middle':
3472
3466
  temp['Question'] = element.question;
3473
- temp['User Comments'] = element.userCommands;
3467
+ temp['User Comments'] = element.userComments;
3474
3468
  break;
3475
3469
  case 'mobile-detection':
3476
3470
  temp['Before Count'] = element.beforeCount;
@@ -44,54 +44,17 @@ export const traxAuditDocs = {
44
44
  },
45
45
  },
46
46
  '/v3/trax-audit/get-updated-file': {
47
- get: {
47
+ post: {
48
48
  tags: [ 'Trax Audit' ],
49
49
  description: 'Get a file via queue message',
50
50
  operationId: 'get-updated-file',
51
- parameters: [
52
- {
53
- in: 'query',
54
- name: 'storeId',
55
- scema: j2s( getUpdatedFileSchema ).swagger,
56
- require: true,
57
- },
58
- {
59
- in: 'query',
60
- name: 'fileDate',
61
- scema: j2s( getUpdatedFileSchema ).swagger,
62
- require: true,
63
- },
64
- {
65
- in: 'query',
66
- name: 'moduleType',
67
- scema: j2s( getUpdatedFileSchema ).swagger,
68
- require: true,
69
- },
70
- {
71
- in: 'query',
72
- name: 'auditId',
73
- scema: j2s( getUpdatedFileSchema ).swagger,
74
- require: true,
75
- },
76
- {
77
- in: 'query',
78
- name: 'streamName',
79
- scema: j2s( getUpdatedFileSchema ).swagger,
80
- require: false,
81
- },
82
- {
83
- in: 'query',
84
- name: 'question',
85
- scema: j2s( getUpdatedFileSchema ).swagger,
86
- require: false,
87
- },
88
- {
89
- in: 'query',
90
- name: 'tempId',
91
- scema: j2s( getUpdatedFileSchema ).swagger,
92
- require: false,
51
+ requestBody: {
52
+ content: {
53
+ 'application/json': {
54
+ schema: j2s( getUpdatedFileSchema ).swagger,
55
+ },
93
56
  },
94
- ],
57
+ },
95
58
  responses: {
96
59
  200: { description: 'Successful' },
97
60
  401: { description: 'Unauthorized User' },
@@ -14,7 +14,7 @@ export const clientValid = {
14
14
 
15
15
  // store
16
16
  export const auditStoreSchema = joi.object( {
17
- clientId: joi.array().required(),
17
+ clientId: joi.array().items( joi.string().required() ).required(),
18
18
  limit: joi.number().optional(),
19
19
  offset: joi.number().optional(),
20
20
  } );
@@ -107,7 +107,7 @@ export const saveValid = {
107
107
  export const workSpaceSchema = joi.object( {
108
108
  searchValue: joi.string().optional().allow( '' ),
109
109
  moduleType: joi.string().required(),
110
- clientId: joi.array().optional(),
110
+ clientId: joi.array().items( joi.string().required() ).required(),
111
111
  offset: joi.number().optional(),
112
112
  limit: joi.number().optional(),
113
113
  isExport: joi.boolean().optional(),
@@ -126,7 +126,7 @@ export const userAuditHistorySchema = joi.object( {
126
126
  fromDate: joi.string().required(),
127
127
  toDate: joi.string().required(),
128
128
  dateType: joi.string().required(),
129
- clientId: joi.array().optional(),
129
+ clientId: joi.array().items( joi.string().required() ).required(),
130
130
  filterByStoreId: joi.array().required(),
131
131
  moduleType: joi.string().required(),
132
132
  filterByAuditType: joi.array().optional(),
@@ -165,7 +165,7 @@ export const storeMetricsSchema = joi.object( {
165
165
  fromDate: joi.string().required(),
166
166
  toDate: joi.string().required(),
167
167
  searchValue: joi.string().optional().allow( '' ),
168
- filterByClientId: joi.array().required(),
168
+ filterByClientId: joi.array().items( joi.string().required() ).required(),
169
169
  filterByStoreId: joi.array().optional(),
170
170
  filterByStatus: joi.array().optional(),
171
171
  filterByAuditType: joi.array().optional(),
@@ -203,7 +203,7 @@ export const userMetricsValid = {
203
203
  export const pendingSummaryTableSchema = joi.object( {
204
204
  fromDate: joi.string().required(),
205
205
  toDate: joi.string().required(),
206
- clientId: joi.array().optional(),
206
+ clientId: joi.array().items( joi.string().required() ).required(),
207
207
  limit: joi.number().optional(),
208
208
  offset: joi.number().optional(),
209
209
  searchValue: joi.string().optional().allow( '' ),
@@ -222,7 +222,7 @@ export const pendingSummaryTableValid = {
222
222
  export const overviewTableSchema = joi.object( {
223
223
  fromDate: joi.string().required(),
224
224
  toDate: joi.string().required(),
225
- clientId: joi.array().optional(),
225
+ clientId: joi.array().items( joi.string().required() ).required(),
226
226
  limit: joi.number().optional(),
227
227
  offset: joi.number().optional(),
228
228
  searchValue: joi.string().optional().allow( '' ),
@@ -241,7 +241,7 @@ export const overviewTableValid = {
241
241
  export const overAllAuditSummarySchema = joi.object( {
242
242
  fromDate: joi.string().required(),
243
243
  toDate: joi.string().required(),
244
- clientId: joi.array().optional(),
244
+ clientId: joi.array().items( joi.string().required() ).required(),
245
245
  moduleType: joi.string().required(),
246
246
  } );
247
247
 
@@ -268,7 +268,7 @@ export const reTriggerValid = {
268
268
  export const overViewCardSchema = joi.object( {
269
269
  fromDate: joi.string().required(),
270
270
  toDate: joi.string().required(),
271
- clientId: joi.array().optional(),
271
+ clientId: joi.array().items( joi.string().required() ).required(),
272
272
  } );
273
273
 
274
274
  export const overViewCardValid = {
@@ -278,7 +278,7 @@ export const overViewCardValid = {
278
278
  export const summarySplitSchema = joi.object( {
279
279
  fromDate: joi.string().required(),
280
280
  toDate: joi.string().required(),
281
- clientId: joi.array().optional(),
281
+ clientId: joi.array().items( joi.string().required() ).required(),
282
282
  moduleType: joi.string().required(),
283
283
  } );
284
284
 
@@ -25,7 +25,7 @@ export const getUpdatedFileSchema = joi.object(
25
25
  );
26
26
 
27
27
  export const getUpdatedFileValid = {
28
- query: getUpdatedFileSchema,
28
+ body: getUpdatedFileSchema,
29
29
  };
30
30
 
31
31
  export const getDetectionFileSchema = joi.object( {
@@ -101,7 +101,7 @@ export const workSpaceSchema = joi.object(
101
101
  {
102
102
  searchValue: joi.string().optional().allow( '' ),
103
103
  moduleType: joi.string().required(),
104
- clientId: joi.array().optional(),
104
+ clientId: joi.array().items( joi.string().required() ).required(),
105
105
  offset: joi.number().optional(),
106
106
  limit: joi.number().optional(),
107
107
  isExport: joi.boolean().optional(),
@@ -120,7 +120,7 @@ export const userAuditHistorySchema = joi.object(
120
120
  fromDate: joi.string().required(),
121
121
  toDate: joi.string().required(),
122
122
  dateType: joi.string().required(),
123
- clientId: joi.array().optional(),
123
+ clientId: joi.array().items( joi.string().required() ).required(),
124
124
  filterByStoreId: joi.array().required(),
125
125
  moduleType: joi.string().required(),
126
126
  filterByAuditType: joi.array().optional(),
@@ -164,7 +164,7 @@ export const storeMetricsSchema = joi.object(
164
164
  fromDate: joi.string().required(),
165
165
  toDate: joi.string().required(),
166
166
  searchValue: joi.string().optional().allow( '' ),
167
- filterByClientId: joi.array().required(),
167
+ filterByClientId: joi.array().items( joi.string().required() ).required(),
168
168
  filterByStoreId: joi.array().optional(),
169
169
  filterByStatus: joi.array().optional(),
170
170
  filterByAuditType: joi.array().optional(),
@@ -205,7 +205,7 @@ export const pendingSummaryTableSchema = joi.object(
205
205
  {
206
206
  fromDate: joi.string().required(),
207
207
  toDate: joi.string().required(),
208
- clientId: joi.array().optional(),
208
+ clientId: joi.array().items( joi.string().required() ).required(),
209
209
  limit: joi.number().optional(),
210
210
  offset: joi.number().optional(),
211
211
  searchValue: joi.string().optional().allow( '' ),
@@ -226,7 +226,7 @@ export const overAllAuditSummarySchema = joi.object(
226
226
  {
227
227
  fromDate: joi.string().required(),
228
228
  toDate: joi.string().required(),
229
- clientId: joi.array().optional(),
229
+ clientId: joi.array().items( joi.string().required() ).required(),
230
230
  moduleType: joi.string().required(),
231
231
  },
232
232
  );
@@ -239,7 +239,7 @@ export const summarySplitSchema = joi.object(
239
239
  {
240
240
  fromDate: joi.string().required(),
241
241
  toDate: joi.string().required(),
242
- clientId: joi.array().optional(),
242
+ clientId: joi.array().items( joi.string().required() ).required(),
243
243
  moduleType: joi.string().optional(),
244
244
  },
245
245
  );
@@ -252,7 +252,7 @@ export const overviewTableSchema = joi.object(
252
252
  {
253
253
  fromDate: joi.string().required(),
254
254
  toDate: joi.string().required(),
255
- clientId: joi.array().optional(),
255
+ clientId: joi.array().items( joi.string().required() ).required(),
256
256
  limit: joi.number().optional(),
257
257
  offset: joi.number().optional(),
258
258
  searchValue: joi.string().optional().allow( '' ),
@@ -18,7 +18,7 @@ traxAuditRouter.post( '/work-space', isAllowedSessionHandler, validate( workSpac
18
18
 
19
19
  // Y/n
20
20
  traxAuditRouter.get( '/get-file', isAllowedSessionHandler, validate( getFileValid ), isExistsQueue, getAuditFile );
21
- traxAuditRouter.get( '/get-updated-file', isAllowedSessionHandler, validate( getUpdatedFileValid ), isTraxAuditDocumentExist, getUpdatedFile );
21
+ traxAuditRouter.post( '/get-updated-file', isAllowedSessionHandler, validate( getUpdatedFileValid ), isTraxAuditDocumentExist, getUpdatedFile );
22
22
  traxAuditRouter.post( '/save-binary-audit', isAllowedSessionHandler, validate( saveValid ), validateBinaryAudit, saveBinary );
23
23
 
24
24
  // metrcis
@@ -59,7 +59,7 @@ export async function validateBinaryAudit( req, res, next ) {
59
59
 
60
60
  export async function isTraxAuditDocumentExist( req, res, next ) {
61
61
  try {
62
- const inputData = req.query;
62
+ const inputData = req.body;
63
63
  let query = {};
64
64
  switch ( inputData.moduleType ) {
65
65
  case 'unattended-customer':