tango-app-api-infra 3.8.1-beta.25 → 3.8.1-beta.26

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.8.1-beta.25",
3
+ "version": "3.8.1-beta.26",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3,7 +3,7 @@
3
3
  import { aggregateTangoTicket, createTangoTicket, findOneTangoTicket, updateOneTangoTicket, updateManyTangoTicket, findTangoTicket } from '../services/tangoTicket.service.js';
4
4
  import { createinfraReason, findinfraReason } from '../services/infraReason.service.js';
5
5
  import { updateOneStore, findStore } from '../services/store.service.js';
6
- import { logger, fileUpload, signedUrl, chunkArray, sendEmailWithSES, getOpenSearchData, insertOpenSearchData, download, getUTC } from 'tango-app-api-middleware';
6
+ import { logger, fileUpload, signedUrl, chunkArray, sendEmailWithSES, getOpenSearchData, insertOpenSearchData, download, getUTC, getOpenSearchCount } from 'tango-app-api-middleware';
7
7
  import { aggregateUser, findOneUser, updateOneUser } from '../services/user.service.js';
8
8
  import { findOneClient, updateoneClient } from '../services/client.service.js';
9
9
  import dayjs from 'dayjs';
@@ -1569,6 +1569,40 @@ export async function allCounts( req, res ) {
1569
1569
  } );
1570
1570
  }
1571
1571
  let result = await aggregateTangoTicket( countQuery );
1572
+
1573
+
1574
+ // get footfall directory ticket
1575
+
1576
+ const openSearch = JSON.parse( process.env.OPENSEARCH );
1577
+ let filter = [
1578
+ {
1579
+ terms: {
1580
+ 'clientId.keyword': Array.isArray( req?.body?.clientId ) ?
1581
+ req?.body?.clientId :
1582
+ req?.body?.clientId,
1583
+ },
1584
+ },
1585
+
1586
+ {
1587
+ range: {
1588
+ dateString: {
1589
+ gte: req?.body?.fromDate,
1590
+ lte: req?.body?.toDate,
1591
+ format: 'yyyy-MM-dd',
1592
+ },
1593
+ },
1594
+ },
1595
+ ];
1596
+
1597
+ const getCount = {
1598
+ query: {
1599
+ bool: {
1600
+ filter: filter,
1601
+ },
1602
+ },
1603
+ };
1604
+ const geteDataCount = await getOpenSearchCount( openSearch.footfallDirectory, getCount );
1605
+ result[0].footfallDirectory = geteDataCount?.body?.count || 0;
1572
1606
  res.sendSuccess( result );
1573
1607
  } catch ( error ) {
1574
1608
  logger.error( { error: error, function: 'allCounts' } );