tango-app-api-audit 3.4.0-alpha.1 → 3.4.0-alpha.10
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 +2 -2
- package/src/controllers/audit.controllers.js +19 -37
- package/src/controllers/traxAudit.controllers.js +2289 -6
- package/src/docs/traxAudit.docs.js +226 -1
- package/src/dtos/audit.dtos.js +8 -8
- package/src/dtos/traxAudit.dtos.js +160 -11
- package/src/routes/traxAudit.routes.js +25 -6
- package/src/service/binaryAudit.service.js +9 -1
- package/src/service/storeEmpDetection.service.js +6 -0
- package/src/service/traxAuditData.service.js +10 -0
- package/src/service/userEmpDetection.service.js +9 -1
- package/src/validation/traxAuditValidation.js +56 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-audit",
|
|
3
|
-
"version": "3.4.0-alpha.
|
|
3
|
+
"version": "3.4.0-alpha.10",
|
|
4
4
|
"description": "audit & audit metrics apis",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
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.1.
|
|
27
|
+
"tango-api-schema": "^2.1.7",
|
|
28
28
|
"tango-app-api-middleware": "^3.1.33",
|
|
29
29
|
"winston": "^3.13.0",
|
|
30
30
|
"winston-daily-rotate-file": "^5.0.0"
|
|
@@ -1450,6 +1450,9 @@ export async function userAuditHistory( req, res ) {
|
|
|
1450
1450
|
const dateRangeCreatedAt = await getDateWithCustomizeTime( new Date( inputData.fromDate ), new Date( inputData.toDate ) );
|
|
1451
1451
|
let filter = [
|
|
1452
1452
|
{ userId: { $eq: userId } },
|
|
1453
|
+
{
|
|
1454
|
+
moduleType: { $eq: inputData.moduleType },
|
|
1455
|
+
},
|
|
1453
1456
|
];
|
|
1454
1457
|
|
|
1455
1458
|
if ( inputData.dateType == 'fileDate' ) {
|
|
@@ -1464,12 +1467,6 @@ export async function userAuditHistory( req, res ) {
|
|
|
1464
1467
|
);
|
|
1465
1468
|
}
|
|
1466
1469
|
|
|
1467
|
-
if ( inputData.filterByModuleType?.length > 0 ) {
|
|
1468
|
-
filter.push( {
|
|
1469
|
-
moduleType: { $in: inputData.filterByModuleType },
|
|
1470
|
-
} );
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
1470
|
if ( inputData.filterByAuditType?.length > 0 ) {
|
|
1474
1471
|
filter.push( {
|
|
1475
1472
|
auditType: { $in: inputData.filterByAuditType },
|
|
@@ -1705,23 +1702,18 @@ export async function clientMetrics( req, res ) {
|
|
|
1705
1702
|
let filter = [
|
|
1706
1703
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
1707
1704
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
1705
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
1708
1706
|
];
|
|
1709
1707
|
|
|
1710
1708
|
let storeAuditFilter = [
|
|
1711
1709
|
{ $eq: [ '$clientId', '$$clientId' ] },
|
|
1712
1710
|
{ $eq: [ '$fileDate', '$$fileDate' ] },
|
|
1711
|
+
{
|
|
1712
|
+
$eq: [ '$moduleType', inputData.moduleType ],
|
|
1713
|
+
},
|
|
1713
1714
|
|
|
1714
1715
|
];
|
|
1715
1716
|
|
|
1716
|
-
if ( inputData?.filterByModuleType?.length> 0 ) {
|
|
1717
|
-
filter.push(
|
|
1718
|
-
{ moduleType: { $in: inputData.filterByModuleType } },
|
|
1719
|
-
);
|
|
1720
|
-
storeAuditFilter.push( {
|
|
1721
|
-
$in: [ '$moduleType', inputData.filterByModuleType ],
|
|
1722
|
-
} );
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
1717
|
if ( inputData?.filterByClient?.length> 0 ) {
|
|
1726
1718
|
filter.push(
|
|
1727
1719
|
{ clientId: { $in: inputData.filterByClient } },
|
|
@@ -1930,6 +1922,7 @@ export async function storeMetrics( req, res ) {
|
|
|
1930
1922
|
let filter = [
|
|
1931
1923
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
1932
1924
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
1925
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
1933
1926
|
|
|
1934
1927
|
];
|
|
1935
1928
|
if ( inputData.filterByClientId && inputData.filterByClientId?.length > 0 ) {
|
|
@@ -1948,11 +1941,6 @@ export async function storeMetrics( req, res ) {
|
|
|
1948
1941
|
filter.push( { auditType: { $in: inputData.filterByAuditType } } );
|
|
1949
1942
|
}
|
|
1950
1943
|
|
|
1951
|
-
if ( inputData.filterByModuleType && inputData.filterByModuleType?.length > 0 ) {
|
|
1952
|
-
filter.push( { moduleType: { $in: inputData.filterByModuleType } } );
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
1944
|
const query = [
|
|
1957
1945
|
{
|
|
1958
1946
|
$match: {
|
|
@@ -2175,6 +2163,8 @@ export async function storeMetrics( req, res ) {
|
|
|
2175
2163
|
'Zone Name': element.zoneName,
|
|
2176
2164
|
'User Name': element.userName,
|
|
2177
2165
|
'User Email': element.userEmail,
|
|
2166
|
+
'Before Count': element.beforeCount,
|
|
2167
|
+
'After Count': element.afterCount,
|
|
2178
2168
|
'Audit Type': element.auditType,
|
|
2179
2169
|
'Accuracy': element.accuracy,
|
|
2180
2170
|
'Time Spent': element.timeSpent,
|
|
@@ -2189,6 +2179,8 @@ export async function storeMetrics( req, res ) {
|
|
|
2189
2179
|
'Client Name': element.clientName,
|
|
2190
2180
|
'User Name': element.userName,
|
|
2191
2181
|
'User Email': element.userEmail,
|
|
2182
|
+
'Before Count': element.beforeCount,
|
|
2183
|
+
'After Count': element.afterCount,
|
|
2192
2184
|
'Audit Type': element.auditType,
|
|
2193
2185
|
'Accuracy': element.accuracy,
|
|
2194
2186
|
'Time Spent': element.timeSpent,
|
|
@@ -2219,20 +2211,17 @@ export async function userMetrics( req, res ) {
|
|
|
2219
2211
|
filter.push(
|
|
2220
2212
|
{ updatedAt: { $gte: dateRangeUpdatedAt.start } },
|
|
2221
2213
|
{ updatedAt: { $lte: dateRangeUpdatedAt.end } },
|
|
2214
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
2222
2215
|
|
|
2223
2216
|
);
|
|
2224
2217
|
} else {
|
|
2225
2218
|
filter.push(
|
|
2226
2219
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2227
2220
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2221
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
2228
2222
|
|
|
2229
2223
|
);
|
|
2230
2224
|
}
|
|
2231
|
-
if ( inputData?.filterByModuleType?.length> 0 ) {
|
|
2232
|
-
filter.push(
|
|
2233
|
-
{ moduleType: { $in: inputData.filterByModuleType } },
|
|
2234
|
-
);
|
|
2235
|
-
}
|
|
2236
2225
|
if ( inputData?.filterByStatus?.length> 0 ) {
|
|
2237
2226
|
filter.push(
|
|
2238
2227
|
{ auditStatus: { $in: inputData.filterByStatus } },
|
|
@@ -2489,6 +2478,7 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2489
2478
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2490
2479
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2491
2480
|
{ auditStatus: { $ne: 'completed' } },
|
|
2481
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
2492
2482
|
|
|
2493
2483
|
];
|
|
2494
2484
|
|
|
@@ -2496,10 +2486,6 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2496
2486
|
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
2497
2487
|
}
|
|
2498
2488
|
|
|
2499
|
-
if ( inputData.filterByModuleType.length > 0 ) {
|
|
2500
|
-
filters.push( { moduleType: { $in: inputData.filterByModuleType } } );
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
2489
|
if ( inputData.filterByAuditType.length > 0 ) {
|
|
2504
2490
|
filters.push( { auditType: { $in: inputData.filterByAuditType } } );
|
|
2505
2491
|
}
|
|
@@ -2680,7 +2666,7 @@ export async function overAllAuditSummary( req, res ) {
|
|
|
2680
2666
|
let filters =[
|
|
2681
2667
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2682
2668
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2683
|
-
{ moduleType: { $
|
|
2669
|
+
{ moduleType: { $eq: inputData.moduleType },
|
|
2684
2670
|
},
|
|
2685
2671
|
];
|
|
2686
2672
|
if ( inputData.clientId.length > 0 ) {
|
|
@@ -3030,13 +3016,11 @@ export async function summarySplit( req, res ) {
|
|
|
3030
3016
|
let filters =[
|
|
3031
3017
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3032
3018
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3019
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
3033
3020
|
];
|
|
3034
3021
|
if ( inputData.clientId.length > 0 ) {
|
|
3035
3022
|
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
3036
3023
|
}
|
|
3037
|
-
if ( inputData?.moduleType?.length > 0 ) {
|
|
3038
|
-
filters.push( { moduleType: { $in: inputData.moduleType } } );
|
|
3039
|
-
}
|
|
3040
3024
|
const query =[
|
|
3041
3025
|
{
|
|
3042
3026
|
$match: {
|
|
@@ -3146,6 +3130,7 @@ export async function overviewTable( req, res ) {
|
|
|
3146
3130
|
let filters =[
|
|
3147
3131
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3148
3132
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3133
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
3149
3134
|
|
|
3150
3135
|
];
|
|
3151
3136
|
|
|
@@ -3153,10 +3138,6 @@ export async function overviewTable( req, res ) {
|
|
|
3153
3138
|
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
3154
3139
|
}
|
|
3155
3140
|
|
|
3156
|
-
if ( inputData.filterByModuleType.length > 0 ) {
|
|
3157
|
-
filters.push( { moduleType: { $in: inputData.filterByModuleType } } );
|
|
3158
|
-
}
|
|
3159
|
-
|
|
3160
3141
|
if ( inputData.filterByAuditType.length > 0 ) {
|
|
3161
3142
|
filters.push( { auditType: { $in: inputData.filterByAuditType } } );
|
|
3162
3143
|
}
|
|
@@ -3323,6 +3304,7 @@ export async function totalNotAssignedCount( req, res ) {
|
|
|
3323
3304
|
totalAuditCount: 0,
|
|
3324
3305
|
totalZoneCount: 0,
|
|
3325
3306
|
totalTrafficCount: 0,
|
|
3307
|
+
totalTraxAuditCount: 0,
|
|
3326
3308
|
};
|
|
3327
3309
|
const getStoreData = await findOneStoreData(
|
|
3328
3310
|
{},
|