tango-app-api-audit 3.3.0-alpha.19 → 3.3.0-alpha.20

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,11 +1,11 @@
1
1
  {
2
2
  "name": "tango-app-api-audit",
3
- "version": "3.3.0-alpha.19",
3
+ "version": "3.3.0-alpha.20",
4
4
  "description": "audit & audit metrics apis",
5
- "main": "app.js",
5
+ "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node app.js\""
8
+ "start": "nodemon --exec \"eslint --fix . && node index.js\""
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=18.10.0"
@@ -24,8 +24,8 @@
24
24
  "mongodb": "^6.7.0",
25
25
  "nodemon": "^3.1.3",
26
26
  "swagger-ui-express": "^5.0.1",
27
- "tango-api-schema": "^2.0.157",
28
- "tango-app-api-middleware": "^3.3.0-alpha.0",
27
+ "tango-api-schema": "^2.0.159",
28
+ "tango-app-api-middleware": "^3.1.32",
29
29
  "winston": "^3.13.0",
30
30
  "winston-daily-rotate-file": "^5.0.0"
31
31
  },
@@ -496,7 +496,6 @@ export async function getAuditFile( req, res ) {
496
496
  const list = await listFileByPath( fetchData );
497
497
  const folderPath = list.data;
498
498
  const nextQuery = list.pageToken;
499
- logger.info( { nextQuery: folderPath } );
500
499
  if ( folderPath?.length > 0 ) {
501
500
  for ( let i = 0; i < folderPath.length; i++ ) {
502
501
  const img = folderPath[i].Key.split( '/' );
@@ -762,6 +761,11 @@ export async function workSpace( req, res ) {
762
761
  $project: {
763
762
  clientName: 1,
764
763
  clientId: 1,
764
+ queueName: {
765
+ $cond: [
766
+ { $eq: [ inputData.moduleType, 'zone' ] }, '$auditConfigs.zoneQueueName', '$auditConfigs.trafficQueueName',
767
+ ],
768
+ },
765
769
  },
766
770
  },
767
771
  ];
@@ -818,7 +822,7 @@ export async function workSpace( req, res ) {
818
822
  clientId: { $last: '$clientId' },
819
823
  clientName: { $last: '$clientName' },
820
824
  installedStore: { $last: '$installedStore' },
821
- queueName: { $last: '$queueName' },
825
+ // queueName: { $last: '$queueName' },
822
826
  totalCount: { $sum: 1 },
823
827
  },
824
828
  },
@@ -1994,13 +1998,12 @@ export async function storeMetrics( req, res ) {
1994
1998
  auditType: 1,
1995
1999
  beforeCount: 1,
1996
2000
  afterCount: { $ifNull: [ '$afterCount', null ] },
1997
- accuracy: { $round: [
1998
- { $divide: [
1999
- { $multiply: [ { $ifNull: [ '$afterCount', 0 ] }, '$beforeCount' ] }, 100,
2000
- ] }, 2,
2001
+ accuracy: { $cond: [ { $eq: [ '$status', 'completed' ] }, { $round: [
2002
+ {
2003
+ $multiply: [ { $divide: [ '$afterCount', '$beforeCount' ] }, 100 ],
2004
+ }, 1,
2001
2005
  ],
2002
-
2003
- },
2006
+ }, null ] },
2004
2007
  timeSpent: 1,
2005
2008
  status: 1,
2006
2009
  },
@@ -2075,13 +2078,12 @@ export async function storeMetrics( req, res ) {
2075
2078
  auditType: 1,
2076
2079
  beforeCount: 1,
2077
2080
  afterCount: { $ifNull: [ '$afterCount', null ] },
2078
- accuracy: { $round: [
2079
- { $divide: [
2080
- { $multiply: [ { $ifNull: [ '$afterCount', 0 ] }, '$beforeCount' ] }, 100,
2081
- ] }, 1,
2081
+ accuracy: { $cond: [ { $eq: [ '$status', 'completed' ] }, { $round: [
2082
+ {
2083
+ $multiply: [ { $divide: [ '$afterCount', '$beforeCount' ] }, 100 ],
2084
+ }, 1,
2082
2085
  ],
2083
-
2084
- },
2086
+ }, null ] },
2085
2087
  timeSpent: {
2086
2088
 
2087
2089
  $cond: [
@@ -3275,7 +3277,7 @@ export async function totalNotAssignedCount( req, res ) {
3275
3277
  { createdAt: -1 },
3276
3278
  );
3277
3279
  const latestDate = getStoreData?.fileDate || dayjs( fileDate ).format( 'DD-MM-YYYY' );
3278
- const query =[
3280
+ const query = [
3279
3281
  {
3280
3282
  $match: {
3281
3283
  fileDate: { $eq: latestDate },
@@ -3364,7 +3366,7 @@ export async function totalNotAssignedCount( req, res ) {
3364
3366
  } else {
3365
3367
  notAssignedCount.totalAuditCount = getTotalcount[0].totalAuditCount;
3366
3368
  notAssignedCount.totalZoneCount = getTotalcount[0].totalZoneCount;
3367
- notAssignedCount.totalTrafficCount;
3369
+ notAssignedCount.totalTrafficCount= getTotalcount[0].totalTrafficCount;
3368
3370
  }
3369
3371
  return res.sendSuccess( { result: notAssignedCount } );
3370
3372
  } catch ( error ) {