tango-app-api-infra 3.0.64-dev → 3.0.66-dev
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/index.js +1 -4
- package/package.json +5 -3
- package/src/controllers/clientInfra.controller.js +7 -39
- package/src/controllers/infra.controllers.js +103 -676
- package/src/controllers/internalInfra.controller.js +103 -557
- package/src/controllers/storeInfra.controlller.js +7 -37
- package/src/controllers/userInfra.controller.js +22 -75
- package/src/docs/infra.docs.js +28 -0
- package/src/dtos/infra.dtos.js +12 -0
- package/src/routes/infra.routes.js +8 -25
- package/src/routes/internalInfra.routes.js +1 -4
- package/src/services/tangoTicket.service.js +0 -3
- package/src/validations/infra.validation.js +7 -53
- package/src/controllers/dataMismatch.controller.js +0 -23
- package/src/controllers/employeeTraning.controller.js +0 -50
- package/src/routes/dataMismatch.routes.js +0 -10
- package/src/routes/employeetrainig.routes.js +0 -17
package/index.js
CHANGED
|
@@ -5,10 +5,7 @@ import { internalInfraRouter } from './src/routes/internalInfra.routes.js';
|
|
|
5
5
|
import { userInfraRouter } from './src/routes/userInfra.routes.js';
|
|
6
6
|
import { storeInfraRouter } from './src/routes/storeInfra.routes.js';
|
|
7
7
|
import { clientInfraRouter } from './src/routes/clientInfra.routes.js';
|
|
8
|
-
import { employeeTrainigRouter } from './src/routes/employeetrainig.routes.js';
|
|
9
|
-
import { dataMismatchTicketRouter } from './src/routes/dataMismatch.routes.js';
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
export { infraRouter, internalInfraRouter, userInfraRouter, storeInfraRouter, dataMismatchTicketRouter, clientInfraRouter, employeeTrainigRouter };
|
|
9
|
+
export { infraRouter, internalInfraRouter, userInfraRouter, storeInfraRouter, clientInfraRouter };
|
|
13
10
|
|
|
14
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-infra",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.66-dev",
|
|
4
4
|
"description": "infra",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,10 +22,12 @@
|
|
|
22
22
|
"express-fileupload": "^1.5.0",
|
|
23
23
|
"handlebars": "^4.7.8",
|
|
24
24
|
"html-pdf-node": "^1.0.8",
|
|
25
|
+
"joi-to-swagger": "^6.2.0",
|
|
25
26
|
"mongodb": "^6.4.0",
|
|
26
27
|
"nodemon": "^3.1.0",
|
|
27
|
-
"
|
|
28
|
-
"tango-
|
|
28
|
+
"swagger-ui-express": "^5.0.0",
|
|
29
|
+
"tango-api-schema": "^2.0.93",
|
|
30
|
+
"tango-app-api-middleware": "^1.0.61-dev",
|
|
29
31
|
"winston": "^3.12.0",
|
|
30
32
|
"winston-daily-rotate-file": "^5.0.0"
|
|
31
33
|
},
|
|
@@ -10,7 +10,7 @@ import { getOpenSearchData } from 'tango-app-api-middleware';
|
|
|
10
10
|
export async function infraCard( req, res ) {
|
|
11
11
|
try {
|
|
12
12
|
let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
|
|
13
|
-
let storeCount = await countDocumentsStore( {
|
|
13
|
+
let storeCount = await countDocumentsStore( { clientId: { $in: req.body.clientId }, status: 'active' } );
|
|
14
14
|
let infraStoreCount = await aggregateTangoTicket( [
|
|
15
15
|
{
|
|
16
16
|
$match: {
|
|
@@ -46,14 +46,13 @@ export async function infraCard( req, res ) {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
] );
|
|
49
|
-
|
|
50
49
|
let query = [ {
|
|
51
50
|
$match: {
|
|
52
51
|
$and: [
|
|
53
52
|
{ issueType: 'infra' },
|
|
54
|
-
{ status: { $ne: 'closed' } },
|
|
55
53
|
{ 'ticketDetails.issueStatus': 'identified' },
|
|
56
54
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
55
|
+
{ 'ticketDetails.issueStatus': 'identified' },
|
|
57
56
|
{ createdAt: { $gte: date.start } },
|
|
58
57
|
{ createdAt: { $lte: date.end } },
|
|
59
58
|
],
|
|
@@ -149,15 +148,9 @@ export async function infraCard( req, res ) {
|
|
|
149
148
|
}
|
|
150
149
|
export async function installationCard( req, res ) {
|
|
151
150
|
try {
|
|
152
|
-
let onboardedCount = await countDocumentsStore( {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
],
|
|
156
|
-
} );
|
|
157
|
-
let installedCount = await countDocumentsStore( { 'clientId': { $in: req.body.clientId },
|
|
158
|
-
'edge.firstFile': true, 'status': 'active' } );
|
|
159
|
-
let deactiveCount = await countDocumentsStore( { 'clientId': { $in: req.body.clientId },
|
|
160
|
-
'status': 'deactive' } );
|
|
151
|
+
let onboardedCount = await countDocumentsStore( { clientId: { $in: req.body.clientId } } );
|
|
152
|
+
let installedCount = await countDocumentsStore( { 'clientId': { $in: req.body.clientId }, 'edge.deployed': true } );
|
|
153
|
+
|
|
161
154
|
let yettoInstallCount = await aggregateTangoTicket( [
|
|
162
155
|
{
|
|
163
156
|
$match: {
|
|
@@ -214,19 +207,9 @@ export async function installationCard( req, res ) {
|
|
|
214
207
|
issueIdentifiedBy: 1,
|
|
215
208
|
primaryIssue: '$primaryIssue.reasons.primaryIssue',
|
|
216
209
|
},
|
|
217
|
-
}, {
|
|
218
|
-
$group: {
|
|
219
|
-
_id: '$ticketId',
|
|
220
|
-
ticketId: { $first: '$ticketId' },
|
|
221
|
-
issueStatus: { $last: '$issueStatus' },
|
|
222
|
-
ticketType: { $last: '$ticketType' },
|
|
223
|
-
issueIdentifiedBy: { $last: '$issueIdentifiedBy' },
|
|
224
|
-
primaryIssue: { $last: '$primaryIssue' },
|
|
225
|
-
},
|
|
226
210
|
},
|
|
227
211
|
];
|
|
228
212
|
let installFailedCount = await aggregateTangoTicket( query );
|
|
229
|
-
|
|
230
213
|
let issueList = await findinfraReason( { parentId: { '$exists': false } } );
|
|
231
214
|
const categoryCounts = {};
|
|
232
215
|
let response;
|
|
@@ -251,14 +234,13 @@ export async function installationCard( req, res ) {
|
|
|
251
234
|
}
|
|
252
235
|
res.sendSuccess( {
|
|
253
236
|
onboardedStoresCount: onboardedCount,
|
|
254
|
-
inactiveStoresCount: deactiveCount,
|
|
255
237
|
installedStoresCount: installedCount,
|
|
256
238
|
yettoInstallCount: yettoInstallCount.length,
|
|
257
239
|
installFailedCount: installFailedCount.length,
|
|
258
240
|
infraIssues: response,
|
|
259
241
|
} );
|
|
260
242
|
} catch ( error ) {
|
|
261
|
-
logger.error( { error: error, function: '
|
|
243
|
+
logger.error( { error: error, function: 'infraCard' } );
|
|
262
244
|
return res.sendError( error, 500 );
|
|
263
245
|
}
|
|
264
246
|
}
|
|
@@ -269,7 +251,6 @@ export async function infraIssuesTable( req, res ) {
|
|
|
269
251
|
$match: {
|
|
270
252
|
$and: [
|
|
271
253
|
{ issueType: 'infra' },
|
|
272
|
-
{ status: { $ne: 'closed' } },
|
|
273
254
|
{ 'basicDetails.clientId': { $in: req.body.clientId } },
|
|
274
255
|
{ 'ticketDetails.issueStatus': 'identified' },
|
|
275
256
|
{ createdAt: { $gte: date.start } },
|
|
@@ -462,18 +443,6 @@ export async function InstallationIssuesTable( req, res ) {
|
|
|
462
443
|
primaryIssue: { $ifNull: [ '$primaryIssue.reasons.primaryIssue', '-' ] },
|
|
463
444
|
},
|
|
464
445
|
},
|
|
465
|
-
{
|
|
466
|
-
$group: {
|
|
467
|
-
_id: '$storeId',
|
|
468
|
-
createdAt: { $first: '$createdAt' },
|
|
469
|
-
clientName: { $first: '$clientName' },
|
|
470
|
-
storeId: { $first: '$storeId' },
|
|
471
|
-
clientId: { $first: '$clientId' },
|
|
472
|
-
storeName: { $first: '$storeName' },
|
|
473
|
-
status: { $last: '$status' },
|
|
474
|
-
primaryIssue: { $last: '$primaryIssue' },
|
|
475
|
-
},
|
|
476
|
-
},
|
|
477
446
|
];
|
|
478
447
|
if ( req.body.searchValue && req.body.searchValue !== '' ) {
|
|
479
448
|
query.push( {
|
|
@@ -690,7 +659,6 @@ export async function hourWiseDownstores( req, res ) {
|
|
|
690
659
|
let query = [ {
|
|
691
660
|
$match: {
|
|
692
661
|
clientId: req.body.clientId,
|
|
693
|
-
status: 'active',
|
|
694
662
|
},
|
|
695
663
|
},
|
|
696
664
|
{
|
|
@@ -793,7 +761,7 @@ function downStoresCheck( data, inputData ) {
|
|
|
793
761
|
const average = sum / streamwiseDowntime.length;
|
|
794
762
|
obj[obj.startTime + '-' + obj.endTime] = Math.round( average );
|
|
795
763
|
} else {
|
|
796
|
-
obj[obj.startTime + '-' + obj.endTime] =
|
|
764
|
+
obj[obj.startTime + '-' + obj.endTime] = 0;
|
|
797
765
|
}
|
|
798
766
|
|
|
799
767
|
timewise.push( obj );
|