tango-app-api-audit 3.4.21 → 3.4.22

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.21",
3
+ "version": "3.4.22",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4805,6 +4805,42 @@ export async function auditViewLogs( req, res ) {
4805
4805
  },
4806
4806
  };
4807
4807
  break;
4808
+ case 'hygiene':
4809
+ logsQuery = {
4810
+ 'size': 100,
4811
+ 'query': {
4812
+ 'bool': {
4813
+ 'must': [
4814
+ {
4815
+ 'term': {
4816
+ 'logData.fileDate.keyword': inputData.fileDate,
4817
+ },
4818
+ },
4819
+ {
4820
+ 'term': {
4821
+ 'logData.storeId.keyword': inputData.storeId,
4822
+ },
4823
+ },
4824
+ {
4825
+ 'term': {
4826
+ 'logData.moduleType.keyword': inputData.moduleType,
4827
+ },
4828
+ },
4829
+ {
4830
+ 'term': {
4831
+ 'logData.zoneName.keyword': inputData.zoneName,
4832
+ },
4833
+ },
4834
+ {
4835
+ 'terms': {
4836
+ 'logSubType.keyword': [ 'auditDone', 'reTrigger' ],
4837
+ },
4838
+ },
4839
+ ],
4840
+ },
4841
+ },
4842
+ };
4843
+ break;
4808
4844
  case 'camera-angle-change':
4809
4845
  logsQuery = {
4810
4846
  'size': 100,
@@ -3067,7 +3067,30 @@ export async function summarySplit( req, res ) {
3067
3067
  { moduleType: { $eq: inputData.moduleType } },
3068
3068
  { clientId: { $in: inputData.clientId } },
3069
3069
  ];
3070
+ const totalQuery = [
3071
+ {
3072
+ $match: {
3073
+ $and: filters,
3074
+ },
3070
3075
 
3076
+ },
3077
+ {
3078
+ $group: {
3079
+ _id: null,
3080
+ total: { $sum: 1 },
3081
+ },
3082
+ },
3083
+ {
3084
+ $project: {
3085
+ _id: 0,
3086
+ total: 1,
3087
+ },
3088
+ },
3089
+ ];
3090
+ const totalCount = await aggregateTraxAuditData( totalQuery );
3091
+ if ( totalCount.length == 0 ) {
3092
+ return res.sendError( 'No Data Found', 204 );
3093
+ }
3071
3094
 
3072
3095
  const binaryAuditQuery =[
3073
3096
  {
@@ -3194,28 +3217,8 @@ export async function summarySplit( req, res ) {
3194
3217
  },
3195
3218
  },
3196
3219
  ];
3197
- const totalQuery = [
3198
- {
3199
- $match: {
3200
- $and: filters,
3201
- },
3202
3220
 
3203
- },
3204
- {
3205
- $group: {
3206
- _id: null,
3207
- total: { $sum: 1 },
3208
- },
3209
- },
3210
- {
3211
- $project: {
3212
- _id: 0,
3213
- total: 1,
3214
- },
3215
- },
3216
- ];
3217
3221
  const result = [ 'mobile-detection', 'uniform-detection', 'hygiene' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryAuditQuery );
3218
- const totalCount = await aggregateTraxAuditData( totalQuery );
3219
3222
  result[0].totalCount = totalCount[0]?.total;
3220
3223
  return res.sendSuccess( { result: result.length> 0? result[0]: temp } );
3221
3224
  } catch ( error ) {