tango-app-api-infra 3.0.95-dev → 3.0.98-dev

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-infra",
3
- "version": "3.0.95-dev",
3
+ "version": "3.0.98-dev",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -345,6 +345,7 @@ export async function infraIssuesTable( req, res ) {
345
345
  clientId: '$basicDetails.clientId',
346
346
  ticketId: 1,
347
347
  storeName: '$basicDetails.storeName',
348
+ clientName: '$basicDetails.clientName',
348
349
  status: 1,
349
350
  createdAt: 1,
350
351
  issueIdentifiedDate: '$ticketDetails.issueIdentifiedDate',
@@ -380,6 +381,7 @@ export async function infraIssuesTable( req, res ) {
380
381
  storeName: 1,
381
382
  createdAt: 1,
382
383
  ticketId: 1,
384
+ clientName: 1,
383
385
  actionBy: '$primaryIssue.actionBy',
384
386
  issueIdentifiedDate: { $ifNull: [ '$issueIdentifiedDate', '' ] },
385
387
  issueClosedDate: { $ifNull: [ '$issueClosedDate', '' ] },
@@ -396,6 +398,7 @@ export async function infraIssuesTable( req, res ) {
396
398
  ticketId: { $first: '$ticketId' },
397
399
  actionBy: { $first: '$actionBy' },
398
400
  storeName: { $first: '$storeName' },
401
+ clientName: { $first: '$clientName' },
399
402
  createdAt: { $first: '$createdAt' },
400
403
  issueIdentifiedDate: { $last: '$issueIdentifiedDate' },
401
404
  issueClosedDate: { $last: '$issueClosedDate' },
@@ -512,13 +515,13 @@ export async function infraIssuesTable( req, res ) {
512
515
  const exportdata = [];
513
516
  result.forEach( ( element ) => {
514
517
  exportdata.push( {
515
- 'CREATED AT': element.createdAt,
516
- 'STORE ID': element.storeId,
517
- 'STORE NAME': element.storeName,
518
- 'PRIMARY ISSUE': element.primaryIssue,
519
- 'SUB ISSUE': element.secondaryIssue,
520
- 'ISSUE IDENTIFIED ON': dayjs( element.issueIdentifiedDate ).tz( 'Asia/Kolkata' ).format( 'YYYY-MM-DD HH:mm A' ),
521
- 'STATUS': element.status,
518
+ 'Created On': element.createdAt,
519
+ 'StoreID': element.storeId,
520
+ 'StoreName': element.storeName,
521
+ 'Primary Issue': element.primaryIssue,
522
+ 'Sub Issue': element.secondaryIssue,
523
+ 'Issue Identified on': element.issueIdentifiedDate? dayjs( element.issueIdentifiedDate ).tz( 'Asia/Kolkata' ).format( 'YYYY-MM-DD HH:mm A' ):'',
524
+ 'Status': element.status,
522
525
  } );
523
526
  } );
524
527
  await download( exportdata, res );
@@ -758,10 +761,10 @@ export async function InstallationIssuesTable( req, res ) {
758
761
  const exportdata = [];
759
762
  storesList.forEach( ( element ) => {
760
763
  exportdata.push( {
761
- 'CLIENT NAME': element.clientName,
762
- 'STORE ID': element.storeId,
763
- 'STORE NAME': element.storeName,
764
- 'STATUS': element.status,
764
+ 'Client Name': element.clientName,
765
+ 'Store ID': element.storeId,
766
+ 'Store Name': element.storeName,
767
+ 'Status': element.status,
765
768
  } );
766
769
  } );
767
770
  await download( exportdata, res );
@@ -1330,23 +1333,18 @@ export async function overViewTable( req, res ) {
1330
1333
  ];
1331
1334
  if ( inputData.searchValue ) {
1332
1335
  filter.push( {
1333
-
1334
1336
  $or: [
1335
- { 'basicDetails.clientName': { $regex: req.body.searchValue, $options: 'i' } },
1336
- { 'basicDetails.storeId': { $regex: req.body.searchValue, $options: 'i' } },
1337
- { 'basicDetails.storeName': { $regex: req.body.searchValue, $options: 'i' } },
1337
+ { 'clientName': { $regex: req.body.searchValue, $options: 'i' } },
1338
+ { 'storeId': { $regex: req.body.searchValue, $options: 'i' } },
1339
+ { 'storeName': { $regex: req.body.searchValue, $options: 'i' } },
1338
1340
  { 'status': { $regex: req.body.searchValue, $options: 'i' } },
1339
1341
  ],
1340
-
1341
1342
  } );
1342
1343
  }
1343
- if ( inputData.sortColumName ) {
1344
+ if ( inputData.sortColumnName ) {
1344
1345
  const sortBy = inputData.sortBy || -1;
1345
1346
  query.push( {
1346
- $sort: {
1347
- [inputData.sortColumName == 'storeId' ? 'basicDetails.storeId' :
1348
- inputData.sortColumName == 'clientName' ? 'basicDetails.clientName' :
1349
- inputData.sortColumName == 'storeName' ? 'basicDetails.storeName' : inputData.sortColumName]: sortBy,
1347
+ $sort: { [inputData.sortColumnName]: sortBy,
1350
1348
  },
1351
1349
  } );
1352
1350
  }
@@ -1364,22 +1362,16 @@ export async function overViewTable( req, res ) {
1364
1362
  return res.sendError( 'No Data Found', 204 );
1365
1363
  }
1366
1364
  if ( inputData.isExport ) {
1367
- const resultChunk = await chunkArray( count, 10 );
1368
- const promises = resultChunk.map( async ( chunk ) => {
1369
- const list = [];
1370
- for ( let i = 0; i < chunk.length; i++ ) {
1371
- list.push( {
1372
- 'Client Name': chunk[i]?.clientName,
1373
- 'Store ID': chunk[i]?.storeId,
1374
- 'Store Name': chunk[i]?.storeName,
1375
- 'Status': chunk[i]?.status,
1376
- } );
1377
- }
1378
- return list;
1365
+ const exportdata = [];
1366
+ count.forEach( ( element ) => {
1367
+ exportdata.push( {
1368
+ 'ClientName': element.clientName,
1369
+ 'Store ID': element.storeId,
1370
+ 'Store Name': element.storeName,
1371
+ 'Status': element.status,
1372
+ } );
1379
1373
  } );
1380
- const temp = await Promise.all( promises );
1381
- const exportResult = temp.flat();
1382
- await download( exportResult, res );
1374
+ await download( exportdata, res );
1383
1375
  return;
1384
1376
  }
1385
1377
  return res.sendSuccess( { result: result, count: count.length } );