tango-app-api-audit 3.3.0-beta.1 → 3.3.0-beta.2

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/README.md CHANGED
@@ -1,29 +1,29 @@
1
- # README #
2
-
3
- This README would normally document whatever steps are necessary to get your application up and running.
4
-
5
- ### What is this repository for? ###
6
-
7
- * Quick summary
8
- * Version
9
- * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10
-
11
- ### How do I get set up? ###
12
-
13
- * Summary of set up
14
- * Configuration
15
- * Dependencies
16
- * Database configuration
17
- * How to run tests
18
- * Deployment instructions
19
-
20
- ### Contribution guidelines ###
21
-
22
- * Writing tests
23
- * Code review
24
- * Other guidelines
25
-
26
- ### Who do I talk to? ###
27
-
28
- * Repo owner or admin
1
+ # README #
2
+
3
+ This README would normally document whatever steps are necessary to get your application up and running.
4
+
5
+ ### What is this repository for? ###
6
+
7
+ * Quick summary
8
+ * Version
9
+ * [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
10
+
11
+ ### How do I get set up? ###
12
+
13
+ * Summary of set up
14
+ * Configuration
15
+ * Dependencies
16
+ * Database configuration
17
+ * How to run tests
18
+ * Deployment instructions
19
+
20
+ ### Contribution guidelines ###
21
+
22
+ * Writing tests
23
+ * Code review
24
+ * Other guidelines
25
+
26
+ ### Who do I talk to? ###
27
+
28
+ * Repo owner or admin
29
29
  * Other community or team contact
package/package.json CHANGED
@@ -1,40 +1,40 @@
1
- {
2
- "name": "tango-app-api-audit",
3
- "version": "3.3.0-beta.1",
4
- "description": "audit & audit metrics apis",
5
- "main": "index.js",
6
- "type": "module",
7
- "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node index.js\""
9
- },
10
- "engines": {
11
- "node": ">=18.10.0"
12
- },
13
- "author": "praveenraj",
14
- "license": "ISC",
15
- "dependencies": {
16
- "adm-zip": "^0.5.15",
17
- "aws-sdk": "^2.1643.0",
18
- "dayjs": "^1.11.11",
19
- "dotenv": "^16.4.5",
20
- "express": "^4.19.2",
21
- "handlebars": "^4.7.8",
22
- "joi-to-swagger": "^6.2.0",
23
- "lodash": "^4.17.21",
24
- "mongodb": "^6.7.0",
25
- "nodemon": "^3.1.3",
26
- "swagger-ui-express": "^5.0.1",
27
- "tango-api-schema": "^2.0.157",
28
- "tango-app-api-middleware": "^3.3.0-alpha.0",
29
- "winston": "^3.13.0",
30
- "winston-daily-rotate-file": "^5.0.0"
31
- },
32
- "devDependencies": {
33
- "eslint": "^8.57.0",
34
- "eslint-config-google": "^0.14.0",
35
- "eslint-config-semistandard": "^17.0.0",
36
- "eslint-config-standard": "^17.1.0",
37
- "eslint-plugin-import": "^2.29.1",
38
- "eslint-plugin-promise": "^6.2.0"
39
- }
40
- }
1
+ {
2
+ "name": "tango-app-api-audit",
3
+ "version": "3.3.0-beta.2",
4
+ "description": "audit & audit metrics apis",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "start": "nodemon --exec \"eslint --fix . && node index.js\""
9
+ },
10
+ "engines": {
11
+ "node": ">=18.10.0"
12
+ },
13
+ "author": "praveenraj",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "adm-zip": "^0.5.15",
17
+ "aws-sdk": "^2.1643.0",
18
+ "dayjs": "^1.11.11",
19
+ "dotenv": "^16.4.5",
20
+ "express": "^4.19.2",
21
+ "handlebars": "^4.7.8",
22
+ "joi-to-swagger": "^6.2.0",
23
+ "lodash": "^4.17.21",
24
+ "mongodb": "^6.7.0",
25
+ "nodemon": "^3.1.3",
26
+ "swagger-ui-express": "^5.0.1",
27
+ "tango-api-schema": "^2.0.159",
28
+ "tango-app-api-middleware": "^3.1.32",
29
+ "winston": "^3.13.0",
30
+ "winston-daily-rotate-file": "^5.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "eslint": "^8.57.0",
34
+ "eslint-config-google": "^0.14.0",
35
+ "eslint-config-semistandard": "^17.0.0",
36
+ "eslint-config-standard": "^17.1.0",
37
+ "eslint-plugin-import": "^2.29.1",
38
+ "eslint-plugin-promise": "^6.2.0"
39
+ }
40
+ }
@@ -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: [
@@ -2625,7 +2627,7 @@ export async function overAllAuditSummary( req, res ) {
2625
2627
  let temp = {
2626
2628
  installedStores: 0,
2627
2629
  auditStores: 0,
2628
- inprogreseStores: 0,
2630
+ inprogressStores: 0,
2629
2631
  completedStores: 0,
2630
2632
  auditInprogress: 0,
2631
2633
  reAuditInprogress: 0,
@@ -2722,7 +2724,7 @@ export async function overAllAuditSummary( req, res ) {
2722
2724
  ];
2723
2725
  const storeAudit = await aggregateStoreAudit( storeAuditQuery );
2724
2726
  if ( storeAudit.length > 0 ) {
2725
- temp.inprogreseStores= storeAudit[0].inprogreseStores;
2727
+ temp.inprogressStores= storeAudit[0].inprogressStores;
2726
2728
  temp.completedStores = storeAudit[0].completedStores;
2727
2729
  temp.auditInprogress = storeAudit[0].auditInprogress;
2728
2730
  temp.reAuditInprogress = storeAudit[0].reAuditInprogress;
@@ -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 ) {
@@ -1,10 +1,10 @@
1
- import auditStoreDataModel from 'tango-api-schema/schema/auditStoreData.model.js';
2
-
3
-
4
- export function aggregateAuditStoreData( query ) {
5
- return auditStoreDataModel.aggregate( query, { collation: { locale: 'en', strength: 2 } } );
6
- }
7
-
8
- export function findOneStoreData( query, fields, sort ) {
9
- return auditStoreDataModel.findOne( query, fields ).sort( sort );
10
- }
1
+ import auditStoreDataModel from 'tango-api-schema/schema/auditStoreData.model.js';
2
+
3
+
4
+ export function aggregateAuditStoreData( query ) {
5
+ return auditStoreDataModel.aggregate( query, { collation: { locale: 'en', strength: 2 } } );
6
+ }
7
+
8
+ export function findOneStoreData( query, fields, sort ) {
9
+ return auditStoreDataModel.findOne( query, fields ).sort( sort );
10
+ }