tango-app-api-trax 1.0.0-alpha.2 → 1.0.0-alpha.3
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 +3 -2
- package/package.json +4 -2
- package/src/controllers/teaxFlag.controller.js +460 -0
- package/src/controllers/trax.controller.js +8423 -0
- package/src/controllers/traxDashboard.controllers.js +173 -0
- package/src/dtos/validation.dtos.js +49 -193
- package/src/routes/trax.routes.js +228 -0
- package/src/routes/traxDashboard.routes.js +3 -1
- package/src/routes/traxFlag.router.js +11 -0
- package/src/services/checklist.service.js +31 -0
- package/src/services/checklistAssign.service.js +31 -0
- package/src/services/checklistQuestion.service.js +27 -0
- package/src/services/domain.service.js +28 -0
- package/src/services/processedchecklist.services.js +7 -0
- package/src/services/processedchecklistconfig.services.js +8 -0
- package/src/services/store.service.js +27 -0
- package/src/services/ticket.service.js +15 -0
- package/src/services/user.service.js +25 -0
|
@@ -1226,3 +1226,176 @@ export const monthlyGraph = async ( req, res ) => {
|
|
|
1226
1226
|
return res.sendError( { error: error }, 500 );
|
|
1227
1227
|
}
|
|
1228
1228
|
};
|
|
1229
|
+
|
|
1230
|
+
export const flagDetectionCards = async ( req, res ) => {
|
|
1231
|
+
try {
|
|
1232
|
+
let reqestData = req.body;
|
|
1233
|
+
let fromDate = new Date( reqestData.fromDate );
|
|
1234
|
+
let toDate = new Date( reqestData.toDate );
|
|
1235
|
+
let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
|
|
1236
|
+
toDate = new Date( toDate.getTime() - userTimezoneOffset );
|
|
1237
|
+
toDate.setUTCHours( 23, 59, 59, 59 );
|
|
1238
|
+
let result = {};
|
|
1239
|
+
|
|
1240
|
+
let findQuery = [];
|
|
1241
|
+
let findAndQuery = [];
|
|
1242
|
+
findAndQuery.push(
|
|
1243
|
+
{ client_id: reqestData.clientId },
|
|
1244
|
+
{ store_id: { $in: reqestData.storeId } },
|
|
1245
|
+
{ date_iso: { $gte: fromDate } },
|
|
1246
|
+
{ date_iso: { $lte: toDate } },
|
|
1247
|
+
);
|
|
1248
|
+
|
|
1249
|
+
if ( reqestData.groupByType == 'checklist' ) {
|
|
1250
|
+
findAndQuery.push( { sourceCheckList_id: new mongoose.Types.ObjectId( reqestData.groupByValue ) } );
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
if ( reqestData.groupByType == 'user' ) {
|
|
1254
|
+
findAndQuery.push( { userEmail: reqestData.groupByValue } );
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
if ( reqestData.groupByType == 'store' ) {
|
|
1258
|
+
findAndQuery.push( { store_id: reqestData.groupByValue } );
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
1262
|
+
|
|
1263
|
+
findQuery.push( {
|
|
1264
|
+
$project: {
|
|
1265
|
+
sourceCheckList_id: 1,
|
|
1266
|
+
checkListId: 1,
|
|
1267
|
+
checkListName: 1,
|
|
1268
|
+
storeCount: 1,
|
|
1269
|
+
createdBy: 1,
|
|
1270
|
+
createdByName: 1,
|
|
1271
|
+
checklistStatus: 1,
|
|
1272
|
+
timeFlag: 1,
|
|
1273
|
+
questionFlag: 1,
|
|
1274
|
+
mobileDetectionFlag: 1,
|
|
1275
|
+
storeOpenCloseFlag: 1,
|
|
1276
|
+
uniformDetectionFlag: 1,
|
|
1277
|
+
checkListType: 1,
|
|
1278
|
+
scheduleRepeatedType: 1,
|
|
1279
|
+
date_string: 1,
|
|
1280
|
+
date_iso: 1,
|
|
1281
|
+
},
|
|
1282
|
+
} );
|
|
1283
|
+
|
|
1284
|
+
findQuery.push( {
|
|
1285
|
+
$group: {
|
|
1286
|
+
_id: '$date_string',
|
|
1287
|
+
date_iso: { $last: '$date_iso' },
|
|
1288
|
+
storeCount: { $max: '$storeCount' },
|
|
1289
|
+
submittedChecklist: {
|
|
1290
|
+
$sum: {
|
|
1291
|
+
$cond: [ { $eq: [ '$checklistStatus', 'submit' ] }, 1, 0 ],
|
|
1292
|
+
},
|
|
1293
|
+
},
|
|
1294
|
+
flaggedChecklist: {
|
|
1295
|
+
$sum: {
|
|
1296
|
+
$cond: [ {
|
|
1297
|
+
$or: [
|
|
1298
|
+
{ $gt: [ '$timeFlag', 0 ] },
|
|
1299
|
+
{ $gt: [ '$questionFlag', 0 ] },
|
|
1300
|
+
{ $gt: [ '$mobileDetectionFlag', 0 ] },
|
|
1301
|
+
{ $gt: [ '$storeOpenCloseFlag', 0 ] },
|
|
1302
|
+
{ $gt: [ '$uniformDetectionFlag', 0 ] },
|
|
1303
|
+
],
|
|
1304
|
+
}, 1, 0 ],
|
|
1305
|
+
},
|
|
1306
|
+
},
|
|
1307
|
+
checkListType: { $last: '$checkListType' },
|
|
1308
|
+
},
|
|
1309
|
+
} );
|
|
1310
|
+
|
|
1311
|
+
let getTotalCount = await processedchecklistService.aggregate( findQuery );
|
|
1312
|
+
if ( !getTotalCount.length ) {
|
|
1313
|
+
return res.sendError( { error: 'No Data Found' }, 204 );
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
if ( reqestData.sortColumnName && reqestData.sortColumnName != '' && reqestData.sortBy && reqestData.sortBy !='' ) {
|
|
1317
|
+
findQuery.push( { $sort: { [reqestData.sortColumnName]: reqestData.sortBy } } );
|
|
1318
|
+
} else {
|
|
1319
|
+
findQuery.push( { $sort: { ['date_iso']: 1 } } );
|
|
1320
|
+
}
|
|
1321
|
+
let getmonthlyData = await processedchecklistService.aggregate( findQuery );
|
|
1322
|
+
|
|
1323
|
+
result.monthlyData = getmonthlyData;
|
|
1324
|
+
return res.sendSuccess( result );
|
|
1325
|
+
} catch ( error ) {
|
|
1326
|
+
console.log( 'error =>', error );
|
|
1327
|
+
logger.error( { error: error, message: req.query, function: 'checklistPerformance' } );
|
|
1328
|
+
return res.sendError( { error: error }, 500 );
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
export const flagDetectionTables = async ( req, res ) => {
|
|
1333
|
+
try {
|
|
1334
|
+
let reqestData = req.body;
|
|
1335
|
+
let fromDate = new Date( reqestData.fromDate );
|
|
1336
|
+
let toDate = new Date( reqestData.toDate );
|
|
1337
|
+
let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
|
|
1338
|
+
toDate = new Date( toDate.getTime() - userTimezoneOffset );
|
|
1339
|
+
toDate.setUTCHours( 23, 59, 59, 59 );
|
|
1340
|
+
let result = {};
|
|
1341
|
+
|
|
1342
|
+
let findQuery = [];
|
|
1343
|
+
let findAndQuery = [];
|
|
1344
|
+
findAndQuery.push(
|
|
1345
|
+
{ sourceCheckList_id: new mongoose.Types.ObjectId( reqestData.sourceCheckList_id ) },
|
|
1346
|
+
{ client_id: reqestData.clientId },
|
|
1347
|
+
{ store_id: { $in: reqestData.storeId } },
|
|
1348
|
+
{ date_iso: { $gte: fromDate } },
|
|
1349
|
+
{ date_iso: { $lte: toDate } },
|
|
1350
|
+
{ checklistStatus: { $eq: 'submit' } },
|
|
1351
|
+
);
|
|
1352
|
+
|
|
1353
|
+
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
1354
|
+
|
|
1355
|
+
if ( reqestData.searchValue && reqestData.searchValue != '' ) {
|
|
1356
|
+
findQuery.push( { $match: { $or: [ { storeName: { $regex: reqestData.searchValue, $options: 'i' } } ] } } );
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
findQuery.push( {
|
|
1360
|
+
$project: {
|
|
1361
|
+
checkListName: 1,
|
|
1362
|
+
createdByName: 1,
|
|
1363
|
+
userName: 1,
|
|
1364
|
+
userEmail: 1,
|
|
1365
|
+
checklistStatus: 1,
|
|
1366
|
+
submitTime_string: 1,
|
|
1367
|
+
date_string: 1,
|
|
1368
|
+
storeName: 1,
|
|
1369
|
+
checkListType: 1,
|
|
1370
|
+
scheduleRepeatedType: 1,
|
|
1371
|
+
detectionFlag: { $sum: [ '$mobileDetectionFlag', '$storeOpenCloseFlag', '$uniformDetectionFlag' ] },
|
|
1372
|
+
date_iso: 1,
|
|
1373
|
+
store_id: 1,
|
|
1374
|
+
},
|
|
1375
|
+
} );
|
|
1376
|
+
|
|
1377
|
+
let getTotalCount = await processedchecklistService.aggregate( findQuery );
|
|
1378
|
+
if ( !getTotalCount.length ) {
|
|
1379
|
+
return res.sendError( { error: 'No Data Found' }, 204 );
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
if ( reqestData.sortColumnName && reqestData.sortColumnName != '' && reqestData.sortBy && reqestData.sortBy !='' ) {
|
|
1383
|
+
findQuery.push( { $sort: { [reqestData.sortColumnName]: reqestData.sortBy } } );
|
|
1384
|
+
} else {
|
|
1385
|
+
findQuery.push( { $sort: { ['date_iso']: -1 } } );
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
let limit = parseInt( reqestData?.limit ) || 10;
|
|
1389
|
+
let skip = limit * ( reqestData?.offset ) || 0;
|
|
1390
|
+
findQuery.push( { $skip: skip }, { $limit: limit } );
|
|
1391
|
+
let getChecklistPerformanceData = await processedchecklistService.aggregate( findQuery );
|
|
1392
|
+
|
|
1393
|
+
result.totalCount = getTotalCount.length;
|
|
1394
|
+
result.checklistInfo = getChecklistPerformanceData;
|
|
1395
|
+
return res.sendSuccess( result );
|
|
1396
|
+
} catch ( error ) {
|
|
1397
|
+
console.log( 'error =>', error );
|
|
1398
|
+
logger.error( { error: error, message: req.query, function: 'flagDetectionTables' } );
|
|
1399
|
+
return res.sendError( { error: error }, 500 );
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
@@ -1,226 +1,82 @@
|
|
|
1
1
|
import joi from 'joi';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
toDate: joi.string().required(),
|
|
9
|
-
valueType: joi.string().optional().allow( '' ),
|
|
10
|
-
nob: joi.boolean().optional().allow( '' ),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// Schema for Card Funnel
|
|
14
|
-
export const validateCardFunnelSchema = joi.object( {
|
|
15
|
-
...baseSchema,
|
|
16
|
-
} );
|
|
17
|
-
|
|
18
|
-
export const validateCardFunnelParams = {
|
|
19
|
-
body: validateCardFunnelSchema,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// Schema for Card Graph (extends baseSchema with additional fields)
|
|
23
|
-
export const validateCardGraphSchema = joi.object( {
|
|
24
|
-
...baseSchema,
|
|
25
|
-
dateType: joi.string().required(),
|
|
26
|
-
} );
|
|
27
|
-
|
|
28
|
-
export const validateCardGraphParams = {
|
|
29
|
-
body: validateCardGraphSchema,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const validateRecapVideoSchema = joi.object( {
|
|
33
|
-
clientId: joi.string().required(),
|
|
34
|
-
storeId: joi.array().required().empty(),
|
|
35
|
-
recapVideoDate: joi.string().required(),
|
|
36
|
-
valueType: joi.string().optional().allow( '' ),
|
|
37
|
-
nob: joi.boolean().optional().allow( '' ),
|
|
38
|
-
} );
|
|
39
|
-
|
|
40
|
-
export const validateRecapVideoParams = {
|
|
41
|
-
body: validateRecapVideoSchema,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const validateDensityDwellSchema = joi.object( {
|
|
45
|
-
...baseSchema,
|
|
46
|
-
dateRange: joi.number().required(),
|
|
47
|
-
} );
|
|
48
|
-
|
|
49
|
-
export const validateDensityDwellParams = {
|
|
50
|
-
body: validateDensityDwellSchema,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const validateOverallCardsSchema = joi.object( {
|
|
54
|
-
...baseSchema,
|
|
55
|
-
revenue: joi.number().required(),
|
|
56
|
-
processType: joi.string().required(),
|
|
3
|
+
export const checklistSchema = joi.object( {
|
|
4
|
+
checklistName: joi.string().required(),
|
|
5
|
+
checklistDescription: joi.string().required(),
|
|
6
|
+
sections: joi.array().required(),
|
|
7
|
+
submitType: joi.string().required(),
|
|
57
8
|
} );
|
|
58
9
|
|
|
59
|
-
export const
|
|
60
|
-
body:
|
|
10
|
+
export const checklistValidation = {
|
|
11
|
+
body: checklistSchema,
|
|
61
12
|
};
|
|
62
13
|
|
|
63
|
-
export const
|
|
64
|
-
|
|
65
|
-
processType: joi.string().required(),
|
|
14
|
+
export const checklistDetailsSchema = joi.object( {
|
|
15
|
+
checkListId: joi.string().required(),
|
|
66
16
|
} );
|
|
67
17
|
|
|
68
|
-
export const
|
|
69
|
-
|
|
18
|
+
export const checklistDetailsValidation = {
|
|
19
|
+
query: checklistDetailsSchema,
|
|
70
20
|
};
|
|
71
21
|
|
|
72
|
-
export const
|
|
73
|
-
|
|
74
|
-
limit: joi.number().required(),
|
|
75
|
-
offset: joi.number().required(),
|
|
76
|
-
processType: joi.string().required(),
|
|
22
|
+
export const duplicateSchema = joi.object( {
|
|
23
|
+
checklistId: joi.string().required(),
|
|
77
24
|
} );
|
|
78
25
|
|
|
79
|
-
export const
|
|
80
|
-
|
|
26
|
+
export const duplicateValidation = {
|
|
27
|
+
params: duplicateSchema,
|
|
81
28
|
};
|
|
82
29
|
|
|
83
|
-
export const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
30
|
+
export const updateChecklistSchema = joi.object( {
|
|
31
|
+
checklistName: joi.string().required(),
|
|
32
|
+
checklistDescription: joi.string().required(),
|
|
33
|
+
sections: joi.array().required(),
|
|
34
|
+
submitType: joi.string().required(),
|
|
88
35
|
} );
|
|
89
36
|
|
|
90
|
-
export const
|
|
91
|
-
body:
|
|
37
|
+
export const updateChecklistValidation = {
|
|
38
|
+
body: updateChecklistSchema,
|
|
39
|
+
params: duplicateSchema,
|
|
92
40
|
};
|
|
93
41
|
|
|
94
|
-
export const
|
|
95
|
-
|
|
96
|
-
|
|
42
|
+
export const runaiSchema = joi.object( {
|
|
43
|
+
checklistName: joi.string().optional().allow( '' ),
|
|
44
|
+
questionName: joi.string().optional().allow( '' ),
|
|
45
|
+
runAIDescription: joi.string().optional().allow( '' ),
|
|
46
|
+
answerType: joi.string().optional().allow( '' ),
|
|
47
|
+
referenceImage: joi.string().optional().allow( '' ),
|
|
97
48
|
} );
|
|
98
49
|
|
|
99
|
-
export const
|
|
100
|
-
body:
|
|
50
|
+
export const runaiValidation = {
|
|
51
|
+
body: runaiSchema,
|
|
101
52
|
};
|
|
102
53
|
|
|
103
|
-
export const
|
|
104
|
-
...baseSchema,
|
|
105
|
-
processType: joi.string().required(),
|
|
106
|
-
} );
|
|
107
|
-
|
|
108
|
-
export const validateBuyerChartParams = {
|
|
109
|
-
body: validateBuyerChartSchema,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export const validateFootfallDirectoryFoldersSchema = joi.object( {
|
|
54
|
+
export const checklistPageSchema = joi.object( {
|
|
113
55
|
clientId: joi.string().required(),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
export const validateFootfallDirectoryFoldersParams = {
|
|
122
|
-
body: validateFootfallDirectoryFoldersSchema,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export const validateFootfallDirectorySchema = joi.object( {
|
|
126
|
-
clientId: joi.string().required(),
|
|
127
|
-
storeId: joi.array().required().empty(),
|
|
128
|
-
footfallDate: joi.string().required(),
|
|
129
|
-
processType: joi.string().required(),
|
|
130
|
-
folderName: joi.string().required(),
|
|
131
|
-
valueType: joi.string().optional().allow( '' ),
|
|
132
|
-
nob: joi.boolean().optional().allow( '' ),
|
|
133
|
-
} );
|
|
134
|
-
|
|
135
|
-
export const validateFootfallDirectoryParams = {
|
|
136
|
-
body: validateFootfallDirectorySchema,
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export const validateSummaryTableSchema = joi.object( {
|
|
140
|
-
...baseSchema,
|
|
141
|
-
valueType: joi.string().required(),
|
|
56
|
+
startDate: joi.string().required(),
|
|
57
|
+
endDate: joi.string().required(),
|
|
58
|
+
limit: joi.string().required(),
|
|
59
|
+
offset: joi.string().required(),
|
|
60
|
+
sortColumn: joi.string().optional().allow( '' ),
|
|
61
|
+
sortBy: joi.string().optional().allow( '' ),
|
|
142
62
|
search: joi.string().optional().allow( '' ),
|
|
143
|
-
sortBy: joi.number().optional().allow( '' ),
|
|
144
|
-
sort: joi.string().optional().allow( '' ),
|
|
145
|
-
limit: joi.number().required(),
|
|
146
|
-
offset: joi.number().required(),
|
|
147
|
-
export: joi.boolean().required(),
|
|
148
|
-
} );
|
|
149
|
-
|
|
150
|
-
export const validateSummaryTableParams = {
|
|
151
|
-
body: validateSummaryTableSchema,
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export const validateFootfallTrendSchema = joi.object( {
|
|
155
|
-
...baseSchema,
|
|
156
|
-
dateType: joi.string().required(),
|
|
157
|
-
filterBy: joi.string().required(),
|
|
158
|
-
processType: joi.string().optional().allow( '' ),
|
|
159
|
-
forecast: joi.boolean().optional(),
|
|
160
|
-
limit: joi.number().required(),
|
|
161
|
-
offset: joi.number().required(),
|
|
162
|
-
sortBy: joi.number().optional().allow( '' ),
|
|
163
|
-
sort: joi.string().optional().allow( '' ),
|
|
164
63
|
} );
|
|
165
64
|
|
|
166
|
-
export const
|
|
167
|
-
body:
|
|
65
|
+
export const checklistPageValidation = {
|
|
66
|
+
body: checklistSchema,
|
|
168
67
|
};
|
|
169
68
|
|
|
170
|
-
export const
|
|
171
|
-
|
|
69
|
+
export const uploadUserSchema = joi.object( {
|
|
70
|
+
id: joi.string().required(),
|
|
71
|
+
assignedUsers: joi.array().required(),
|
|
72
|
+
uploadUser: joi.boolean().required(),
|
|
73
|
+
type: joi.string().optional().allow( '' ),
|
|
74
|
+
addUser: joi.boolean().optional(),
|
|
75
|
+
delete: joi.boolean().optional(),
|
|
172
76
|
} );
|
|
173
77
|
|
|
174
|
-
export const
|
|
175
|
-
body:
|
|
78
|
+
export const uploadUserValidation = {
|
|
79
|
+
body: uploadUserSchema,
|
|
176
80
|
};
|
|
177
81
|
|
|
178
|
-
export const validateStoresMapSchema = joi.object( {
|
|
179
|
-
clientId: joi.string().required(),
|
|
180
|
-
storeId: joi.array().required().empty(),
|
|
181
|
-
storeDate: joi.string().required(),
|
|
182
|
-
nob: joi.boolean().optional().allow( '' ),
|
|
183
|
-
} );
|
|
184
|
-
|
|
185
|
-
export const validateStoresMapParams = {
|
|
186
|
-
body: validateStoresMapSchema,
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export const validateperformanceMatrixSchema = joi.object( {
|
|
190
|
-
...baseSchema,
|
|
191
|
-
processtype1: joi.string().required(),
|
|
192
|
-
processtype2: joi.string().required(),
|
|
193
|
-
} );
|
|
194
|
-
|
|
195
|
-
export const validateperformanceMatrixParams = {
|
|
196
|
-
body: validateperformanceMatrixSchema,
|
|
197
|
-
};
|
|
198
82
|
|
|
199
|
-
export const validateHeaderSchema = joi.object( {
|
|
200
|
-
clientId: joi.string().required(),
|
|
201
|
-
city: joi.array().required(),
|
|
202
|
-
group: joi.array().required(),
|
|
203
|
-
} );
|
|
204
|
-
|
|
205
|
-
export const validateHeaderParams = {
|
|
206
|
-
body: validateHeaderSchema,
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
export const getMyProductSchema = joi.object( {
|
|
210
|
-
clientId: joi.string().required(),
|
|
211
|
-
storeId: joi.array().optional().empty(),
|
|
212
|
-
} );
|
|
213
|
-
|
|
214
|
-
export const getMyProductParams = {
|
|
215
|
-
body: getMyProductSchema,
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
export const getStoreCameraImageSchema = joi.object( {
|
|
219
|
-
clientId: joi.string().required(),
|
|
220
|
-
storeId: joi.array().optional().empty(),
|
|
221
|
-
storeDate: joi.string().required(),
|
|
222
|
-
} );
|
|
223
|
-
|
|
224
|
-
export const getStoreCameraImageParams = {
|
|
225
|
-
body: getStoreCameraImageSchema,
|
|
226
|
-
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
3
|
+
import { checklistValidation, checklistDetailsValidation, runaiValidation, checklistPageSchema, duplicateValidation, updateChecklistValidation, uploadUserValidation } from '../dtos/validation.dtos.js';
|
|
4
|
+
import * as traxController from '../controllers/trax.controller.js';
|
|
5
|
+
|
|
6
|
+
export const traxRouter = express.Router();
|
|
7
|
+
|
|
8
|
+
traxRouter
|
|
9
|
+
.get( '/checklist', isAllowedSessionHandler, validate( checklistPageSchema ), traxController.checklist )
|
|
10
|
+
.post( '/checklist/create', isAllowedSessionHandler, validate( checklistValidation ), traxController.create )
|
|
11
|
+
.get( '/getConfigDetails', isAllowedSessionHandler, validate( checklistDetailsValidation ), traxController.getConfigDetailsR2 )
|
|
12
|
+
.post( '/upload', isAllowedSessionHandler, traxController.uploadImageR2 )
|
|
13
|
+
.post( '/runAIInsert', isAllowedSessionHandler, validate( runaiValidation ), traxController.runAIInsert )
|
|
14
|
+
.get( '/duplicateChecklist/:checklistId', isAllowedSessionHandler, validate( duplicateValidation ), traxController.duplicateChecklist )
|
|
15
|
+
.put( '/checklist/update/:checklistId', isAllowedSessionHandler, validate( updateChecklistValidation ), traxController.update )
|
|
16
|
+
.post( '/validateUser', isAllowedSessionHandler, validate( uploadUserValidation ), traxController.validateUserV2 )
|
|
17
|
+
.get( '/userDetails/:checklistId', isAllowedSessionHandler, validate( duplicateValidation ), traxController.assignedUserDetails )
|
|
18
|
+
.post( '/checklistConfigure', isAllowedSessionHandler, traxController.updateConfigure )
|
|
19
|
+
.delete( '/deleteChecklist/:checklistId', isAllowedSessionHandler, validate( duplicateValidation ), traxController.deleteChecklist )
|
|
20
|
+
.put( '/publish/:checklistId', isAllowedSessionHandler, traxController.updatePublish );
|
|
21
|
+
|
|
22
|
+
// traxrouter.route( '/getuserlist' )
|
|
23
|
+
// .get( isAllowedSessionHandler, traxController.userlist );
|
|
24
|
+
|
|
25
|
+
// traxrouter.route( '/getzonelist' )
|
|
26
|
+
// .get( isAllowedSessionHandler, traxController.zonelist );
|
|
27
|
+
|
|
28
|
+
// traxrouter.route( '/checklistConfigure' )
|
|
29
|
+
// .post('/checklistConfigure', isAllowedSessionHandler, traxController.updateConfigure );
|
|
30
|
+
|
|
31
|
+
// traxrouter.route( '/deleteChecklist/:checklistId' )
|
|
32
|
+
// .delete('/deleteChecklist/:checklistId', isAllowedSessionHandler, traxController.deleteChecklist );
|
|
33
|
+
|
|
34
|
+
// traxrouter.route( '/deleteSection/:sectionId' )
|
|
35
|
+
// .delete( isAllowedSessionHandler, traxController.deleteSection );
|
|
36
|
+
|
|
37
|
+
// // traxrouter.route('/deleteQuestion/:questionId')
|
|
38
|
+
// // .delete(isAllowedSessionHandler, traxController.deleteQuestion)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// // traxrouter.route('/exportPdf')
|
|
42
|
+
// // .post(isAllowedSessionHandler, traxController.exportPdf_v3)
|
|
43
|
+
// // traxrouter.route('/pdfgenerate/:checklistId')
|
|
44
|
+
// // .get(isAllowedSessionHandler, traxController.pdfgenerate)
|
|
45
|
+
|
|
46
|
+
// traxrouter.route( '/pdfgenerate' )
|
|
47
|
+
// .post( isAllowedSessionHandler, traxController.pdfgenerateV2 );
|
|
48
|
+
|
|
49
|
+
// traxrouter.route( '/exportPdf' )
|
|
50
|
+
// .post( isAllowedSessionHandler, traxController.exportBulkPdf );
|
|
51
|
+
|
|
52
|
+
// // traxrouter.route('/checklistUser/:checklistId')
|
|
53
|
+
// // .get(isAllowedSessionHandler, traxController.assignedUserList)
|
|
54
|
+
|
|
55
|
+
// traxrouter.route( '/validateUser' )
|
|
56
|
+
// .post( isAllowedSessionHandler, traxController.validateUserV2 );
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// // traxrouter.route('/userDetails')
|
|
60
|
+
// // .get(isAllowedSessionHandler, traxController.getUserDetails)
|
|
61
|
+
|
|
62
|
+
// traxrouter.route( '/userDetails/:checklistId' )
|
|
63
|
+
// .get( isAllowedSessionHandler, traxController.assignedUserDetails );
|
|
64
|
+
|
|
65
|
+
// traxrouter.route( '/storeDetails' )
|
|
66
|
+
// .get( isAllowedSessionHandler, traxController.getStoreDetails );
|
|
67
|
+
|
|
68
|
+
// traxrouter.route( '/assignedSOPStore/:userId' )
|
|
69
|
+
// .put( isAllowedSessionHandler, traxController.updateStore );
|
|
70
|
+
|
|
71
|
+
// // /////////////////////////////////////////////////////////////////////
|
|
72
|
+
// // traxrouter.route( '/processedchecklistconfig/create' )
|
|
73
|
+
// // .post( acl.isPDusercheck, PCLconfig.PCLchecklistCreationValidator, PCLconfig.PCLconfigCreation_v1 );
|
|
74
|
+
|
|
75
|
+
// // ///////////////////Flags/////////////////////
|
|
76
|
+
// traxrouter.route( '/flags/list' )
|
|
77
|
+
// .post( isAllowedSessionHandler, traxController.flaginputValidater, traxController.getFlagList );
|
|
78
|
+
|
|
79
|
+
// traxrouter.route( '/flags/timeDelayFlagInsert' )
|
|
80
|
+
// .post( traxController.insertTimeDelayFlags );
|
|
81
|
+
|
|
82
|
+
// traxrouter.route( '/flags/questionFlagIinsert' )
|
|
83
|
+
// .post( traxController.insertQuestionsFlags );
|
|
84
|
+
|
|
85
|
+
// traxrouter.route( '/flags/detectionFlagIinsert' )
|
|
86
|
+
// .post( traxController.insertDetectionsFlags );
|
|
87
|
+
|
|
88
|
+
// traxrouter.route( '/flag/updateTimeDelay' )
|
|
89
|
+
// .put( traxController.updatetimeflag );
|
|
90
|
+
|
|
91
|
+
// traxrouter.route( '/flags/removechecklist/:checklistid' )
|
|
92
|
+
// .put( isAllowedSessionHandler, traxController.removeCheckList );
|
|
93
|
+
|
|
94
|
+
// traxrouter.route( '/flags/reinitiatechecklist/:checklistid' )
|
|
95
|
+
// .put( isAllowedSessionHandler, traxController.reinitiatechecklist );
|
|
96
|
+
|
|
97
|
+
// // ///////////////////Internal API/////////////////////
|
|
98
|
+
// traxrouter.route( '/internalapi/getCheckList' )
|
|
99
|
+
// .get( traxController.validatechecklist, traxController.checklistV1 );
|
|
100
|
+
|
|
101
|
+
// traxrouter.route( '/internalapi/updateCheckList' )
|
|
102
|
+
// .post( traxController.updatechecklist );
|
|
103
|
+
|
|
104
|
+
// // traxrouter.route( '/internalapi/checklist' )
|
|
105
|
+
// // .get( traxController.internalAPIChecklist );
|
|
106
|
+
|
|
107
|
+
// traxrouter.route( '/internalapi/getChecklistFromZipId' )
|
|
108
|
+
// .get( traxController.getChecklistFromZipId );
|
|
109
|
+
|
|
110
|
+
// traxrouter.route( '/internalapi/getChecklistDetails' )
|
|
111
|
+
// .post( traxController.getChecklistDetails );
|
|
112
|
+
|
|
113
|
+
// traxrouter.route( '/internalapi/getPDFCSVChecklistDetails' )
|
|
114
|
+
// .post( traxController.getPDFCSVChecklistDetails );
|
|
115
|
+
|
|
116
|
+
// traxrouter.route( '/internalapi/getDownloadDate' )
|
|
117
|
+
// .get( traxController.getDownloadDate );
|
|
118
|
+
|
|
119
|
+
// // //////////////////Reports//////////////////////
|
|
120
|
+
// traxrouter.route( '/reports/overallPerformance' )
|
|
121
|
+
// .post( isAllowedSessionHandler, traxController.reportsinputValidater, traxController.getReportoverallPerformance );
|
|
122
|
+
|
|
123
|
+
// traxrouter.route( '/reports/checklistData' )
|
|
124
|
+
// .post( isAllowedSessionHandler, traxController.reportsinputValidater, traxController.getReportChecklistData );
|
|
125
|
+
|
|
126
|
+
// traxrouter.route( '/reports/exportBulkchecklistData' )
|
|
127
|
+
// .post( isAllowedSessionHandler, traxController.reportsinputValidater, traxController.exportBulkchecklistData );
|
|
128
|
+
|
|
129
|
+
// traxrouter.route( '/reports/checklistGalleryChecklists' )
|
|
130
|
+
// .get( isAllowedSessionHandler, traxController.getChecklistGalleryChecklists );
|
|
131
|
+
|
|
132
|
+
// traxrouter.route( '/reports/checklistGalleryQuestions' )
|
|
133
|
+
// .post( isAllowedSessionHandler, traxController.checklistGalleryQuestions );
|
|
134
|
+
|
|
135
|
+
// traxrouter.route( '/reports/checklistGallery' )
|
|
136
|
+
// .post( isAllowedSessionHandler, traxController.getReportChecklistGalleryR2 );
|
|
137
|
+
|
|
138
|
+
// traxrouter.route( '/storeList' )
|
|
139
|
+
// .get( isAllowedSessionHandler, traxController.getSOPStoreList );
|
|
140
|
+
|
|
141
|
+
// traxrouter.route( '/checkLists' )
|
|
142
|
+
// .get( isAllowedSessionHandler, traxController.getSOPCheckList );
|
|
143
|
+
|
|
144
|
+
// // traxrouter.route('/getChecklistQuestionAnswers')
|
|
145
|
+
// // .get(isAllowedSessionHandler, traxController.getChecklistQuestionAnswers);
|
|
146
|
+
|
|
147
|
+
// // ////////////////// Dashboard/////////////////////
|
|
148
|
+
// // traxrouter.route( '/dashboard/cards' )
|
|
149
|
+
// // .post( isAllowedSessionHandler, sopValidater.dashboardChecklistValidater, traxController.cards );
|
|
150
|
+
|
|
151
|
+
// // traxrouter.route( '/dashboard/incidentLogs' )
|
|
152
|
+
// // .post( isAllowedSessionHandler, sopValidater.dashboardChecklistValidater, traxController.incidentLogs );
|
|
153
|
+
|
|
154
|
+
// // traxrouter.route( '/dashboard/totalChecklist' )
|
|
155
|
+
// // .post( isAllowedSessionHandler, sopValidater.dashboardChecklistValidater, traxController.totalChecklist );
|
|
156
|
+
|
|
157
|
+
// // traxrouter.route( '/dashboard/submittedChecklist' )
|
|
158
|
+
// // .post( isAllowedSessionHandler, sopValidater.dashboardChecklistValidater, traxController.submittedChecklist );
|
|
159
|
+
|
|
160
|
+
// // traxrouter.route( '/dashboard/flaggedCard' )
|
|
161
|
+
// // .post( isAllowedSessionHandler, sopValidater.dashboardChecklistValidater, traxController.flaggedCard );
|
|
162
|
+
|
|
163
|
+
// // traxrouter.route( '/dashboard/flaggedChecklist' )
|
|
164
|
+
// // .post( isAllowedSessionHandler, sopValidater.dashboardChecklistValidater, traxController.flaggedChecklist );
|
|
165
|
+
|
|
166
|
+
// // traxrouter.route( '/dashboard/topButtomPerformingStores' )
|
|
167
|
+
// // .post( isAllowedSessionHandler, sopValidater.dashboardChecklistValidater, traxController.topButtomPerformingStores );
|
|
168
|
+
|
|
169
|
+
// // traxrouter.route( '/dashboard/checklistPerformance' )
|
|
170
|
+
// // .post( isAllowedSessionHandler, sopValidater.checklistPerformanceValidater, traxController.checklistPerformance );
|
|
171
|
+
|
|
172
|
+
// traxrouter.route( '/dashboard/draftChecklist' )
|
|
173
|
+
// .post( isAllowedSessionHandler, traxController.draftChecklist );
|
|
174
|
+
|
|
175
|
+
// // traxrouter.route( '/dashboard/updateRead' )
|
|
176
|
+
// // .post( isAllowedSessionHandler, sopValidater.updateReadValidator, traxController.updateRead );
|
|
177
|
+
|
|
178
|
+
// // traxrouter.route( '/domainList' )
|
|
179
|
+
// // .get( isAllowedSessionHandler, domainController.domainList );
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
// // traxrouter.route( '/domainUpdate' )
|
|
183
|
+
// // .put( isAllowedSessionHandler, domainController.updateDomain );
|
|
184
|
+
|
|
185
|
+
// traxrouter.route( '/remainderEmail' )
|
|
186
|
+
// .post( traxController.remainderEmail );
|
|
187
|
+
|
|
188
|
+
// // //////////////////Control Centre//////////////////////
|
|
189
|
+
// traxrouter.route( '/controlcentre/timeseries' )
|
|
190
|
+
// .post( isAllowedSessionHandler, traxController.incidentTimeSeriesValidator, traxController.incidentTimeSeries, traxController.controlCentreTimeSeries );
|
|
191
|
+
|
|
192
|
+
// traxrouter.route( '/controlcentre/checklistList' )
|
|
193
|
+
// .get( isAllowedSessionHandler, traxController.checklistList );
|
|
194
|
+
|
|
195
|
+
// traxrouter.route( '/controlcentre/incidentChecklistsTable' )
|
|
196
|
+
// .post( isAllowedSessionHandler, traxController.incidentChecklistsTableValidator, traxController.incidentChecklistsTable );
|
|
197
|
+
|
|
198
|
+
// traxrouter.route( '/controlcentre/mobileDetections' )
|
|
199
|
+
// .post( isAllowedSessionHandler, traxController.mobileDetectionsValidator, traxController.mobileDetectionsR2 );
|
|
200
|
+
|
|
201
|
+
// traxrouter.route( '/controlcentre/uniformDetections' )
|
|
202
|
+
// .post( isAllowedSessionHandler, traxController.uniformDetectionsValidator, traxController.uniformDetectionsR2 );
|
|
203
|
+
|
|
204
|
+
// // traxrouter.route( '/flags/mobileDetectionsDownload' )
|
|
205
|
+
// // .post( isAllowedSessionHandler, traxController.mobileDetections_download_Validator, traxController.mobileDetectionsDownload );
|
|
206
|
+
|
|
207
|
+
// traxrouter.route( '/controlcentre/mobileDetections/activityLog' )
|
|
208
|
+
// .post( isAllowedSessionHandler, traxController.mobileDetectionsValidator, traxController.mobileDetectionsActivityLog );
|
|
209
|
+
|
|
210
|
+
// traxrouter.route( '/controlcentre/mobileDetections/eventUpdate' )
|
|
211
|
+
// .post( isAllowedSessionHandler, traxController.mobileDetectionsUpdate );
|
|
212
|
+
|
|
213
|
+
// traxrouter.route( '/controlcentre/mobileDetections/redirection' )
|
|
214
|
+
// .post( isAllowedSessionHandler, traxController.mobileDetectionsRedirection );
|
|
215
|
+
|
|
216
|
+
// traxrouter.route( '/showEdit' )
|
|
217
|
+
// .get( isAllowedSessionHandler, traxController.showEdit );
|
|
218
|
+
|
|
219
|
+
// traxrouter.route( '/insertDownloadRequest' )
|
|
220
|
+
// .post( isAllowedSessionHandler, traxController.insertdownloadRequest );
|
|
221
|
+
|
|
222
|
+
// // traxrouter.route( '/updateChecklistStatus' )
|
|
223
|
+
// // .post( acl.isPDusercheck, PCLconfig.updatePublish );
|
|
224
|
+
|
|
225
|
+
// // traxrouter.route( '/getStoreAddress' )
|
|
226
|
+
// // .post( acl.isPDusercheck, PCLconfig.getStoreAddress );
|
|
227
|
+
|
|
228
|
+
|