tango-app-api-infra 3.1.20 → 3.1.21

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.1.20",
3
+ "version": "3.1.21",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -219,7 +219,7 @@ export async function activityList( req, res ) {
219
219
  if ( req.user.userType === 'client' ) {
220
220
  query.forEach( ( e ) => {
221
221
  if ( e.$match ) {
222
- $match.$and.push( { 'dataMismatch.showToClient': true } );
222
+ e.$match.$and.push( { 'dataMismatch.showToClient': true } );
223
223
  }
224
224
  } );
225
225
  }
@@ -961,6 +961,7 @@ export async function allCounts( req, res ) {
961
961
  datamismatchCount: {
962
962
  $cond: [ { $or: [ { $eq: [ '$issueType', 'highcount' ] }, { $eq: [ '$issueType', 'lowcount' ] } ] }, 1, 0,
963
963
  ],
964
+
964
965
  },
965
966
  matCount: {
966
967
  $cond: [ { $and: [ { $eq: [ '$issueType', 'mat' ] } ] }, 1, 0,
@@ -980,6 +981,28 @@ export async function allCounts( req, res ) {
980
981
  },
981
982
  },
982
983
  ];
984
+
985
+ if ( req.user.userType === 'client' ) {
986
+ countQuery.forEach( ( item ) => {
987
+ if ( item.$project ) {
988
+ item.$project.datamismatchCount.$cond = [
989
+ {
990
+ $and: [
991
+ {
992
+ $or: [
993
+ { $eq: [ '$issueType', 'highcount' ] },
994
+ { $eq: [ '$issueType', 'lowcount' ] },
995
+ ],
996
+ },
997
+ { $eq: [ '$dataMismatch.showToClient', true ] },
998
+ ],
999
+ },
1000
+ 1,
1001
+ 0,
1002
+ ];
1003
+ }
1004
+ } );
1005
+ }
983
1006
  let result = await aggregateTangoTicket( countQuery );
984
1007
  res.sendSuccess( result );
985
1008
  } catch ( error ) {
@@ -1775,6 +1798,10 @@ export async function dataMismatchTable( req, res ) {
1775
1798
  },
1776
1799
 
1777
1800
  ];
1801
+
1802
+ if ( req.user.userType === 'client' ) {
1803
+ countFilter.push( { 'dataMismatch.showToClient': true } );
1804
+ }
1778
1805
  if ( inputData.clientId && inputData?.clientId?.length > 0 ) {
1779
1806
  countFilter.push( {
1780
1807
  'basicDetails.clientId': { $in: inputData.clientId },
@@ -1836,6 +1863,10 @@ export async function dataMismatchTable( req, res ) {
1836
1863
  { 'basicDetails.clientId': { $in: inputData.clientId } },
1837
1864
  { issueType: { $in: [ 'highcount', 'lowcount' ] } },
1838
1865
  ];
1866
+
1867
+ if ( req.user.userType === 'client' ) {
1868
+ filter.push( { 'dataMismatch.showToClient': true } );
1869
+ }
1839
1870
  const query = [
1840
1871
  {
1841
1872
  $match: {