tango-app-api-audit 3.4.0-alpha.5 → 3.4.0-alpha.6
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 +1 -1
- package/src/controllers/audit.controllers.js +14 -37
- package/src/controllers/traxAudit.controllers.js +20 -85
- package/src/docs/traxAudit.docs.js +1 -23
- package/src/dtos/audit.dtos.js +8 -8
- package/src/dtos/traxAudit.dtos.js +0 -14
- package/src/routes/traxAudit.routes.js +2 -3
package/package.json
CHANGED
|
@@ -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: {
|
|
@@ -2219,20 +2207,17 @@ export async function userMetrics( req, res ) {
|
|
|
2219
2207
|
filter.push(
|
|
2220
2208
|
{ updatedAt: { $gte: dateRangeUpdatedAt.start } },
|
|
2221
2209
|
{ updatedAt: { $lte: dateRangeUpdatedAt.end } },
|
|
2210
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
2222
2211
|
|
|
2223
2212
|
);
|
|
2224
2213
|
} else {
|
|
2225
2214
|
filter.push(
|
|
2226
2215
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2227
2216
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2217
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
2228
2218
|
|
|
2229
2219
|
);
|
|
2230
2220
|
}
|
|
2231
|
-
if ( inputData?.filterByModuleType?.length> 0 ) {
|
|
2232
|
-
filter.push(
|
|
2233
|
-
{ moduleType: { $in: inputData.filterByModuleType } },
|
|
2234
|
-
);
|
|
2235
|
-
}
|
|
2236
2221
|
if ( inputData?.filterByStatus?.length> 0 ) {
|
|
2237
2222
|
filter.push(
|
|
2238
2223
|
{ auditStatus: { $in: inputData.filterByStatus } },
|
|
@@ -2489,6 +2474,7 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2489
2474
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2490
2475
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2491
2476
|
{ auditStatus: { $ne: 'completed' } },
|
|
2477
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
2492
2478
|
|
|
2493
2479
|
];
|
|
2494
2480
|
|
|
@@ -2496,10 +2482,6 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2496
2482
|
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
2497
2483
|
}
|
|
2498
2484
|
|
|
2499
|
-
if ( inputData.filterByModuleType.length > 0 ) {
|
|
2500
|
-
filters.push( { moduleType: { $in: inputData.filterByModuleType } } );
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
2485
|
if ( inputData.filterByAuditType.length > 0 ) {
|
|
2504
2486
|
filters.push( { auditType: { $in: inputData.filterByAuditType } } );
|
|
2505
2487
|
}
|
|
@@ -2680,7 +2662,7 @@ export async function overAllAuditSummary( req, res ) {
|
|
|
2680
2662
|
let filters =[
|
|
2681
2663
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2682
2664
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2683
|
-
{ moduleType: { $
|
|
2665
|
+
{ moduleType: { $eq: inputData.moduleType },
|
|
2684
2666
|
},
|
|
2685
2667
|
];
|
|
2686
2668
|
if ( inputData.clientId.length > 0 ) {
|
|
@@ -3030,13 +3012,11 @@ export async function summarySplit( req, res ) {
|
|
|
3030
3012
|
let filters =[
|
|
3031
3013
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3032
3014
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3015
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
3033
3016
|
];
|
|
3034
3017
|
if ( inputData.clientId.length > 0 ) {
|
|
3035
3018
|
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
3036
3019
|
}
|
|
3037
|
-
if ( inputData?.moduleType?.length > 0 ) {
|
|
3038
|
-
filters.push( { moduleType: { $in: inputData.moduleType } } );
|
|
3039
|
-
}
|
|
3040
3020
|
const query =[
|
|
3041
3021
|
{
|
|
3042
3022
|
$match: {
|
|
@@ -3146,6 +3126,7 @@ export async function overviewTable( req, res ) {
|
|
|
3146
3126
|
let filters =[
|
|
3147
3127
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3148
3128
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3129
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
3149
3130
|
|
|
3150
3131
|
];
|
|
3151
3132
|
|
|
@@ -3153,10 +3134,6 @@ export async function overviewTable( req, res ) {
|
|
|
3153
3134
|
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
3154
3135
|
}
|
|
3155
3136
|
|
|
3156
|
-
if ( inputData.filterByModuleType.length > 0 ) {
|
|
3157
|
-
filters.push( { moduleType: { $in: inputData.filterByModuleType } } );
|
|
3158
|
-
}
|
|
3159
|
-
|
|
3160
3137
|
if ( inputData.filterByAuditType.length > 0 ) {
|
|
3161
3138
|
filters.push( { auditType: { $in: inputData.filterByAuditType } } );
|
|
3162
3139
|
}
|
|
@@ -10,6 +10,7 @@ import { aggregateAssignAudit } from '../service/assignAudit.service.js';
|
|
|
10
10
|
import { aggregateStoreEmpDetection } from '../service/storeEmpDetection.service.js';
|
|
11
11
|
import { listQueue } from 'tango-app-api-middleware/src/utils/aws/sqs.js';
|
|
12
12
|
import _ from 'lodash';
|
|
13
|
+
import mongoose from 'mongoose';
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
export async function getDetectionAuditFile( req, res ) {
|
|
@@ -1782,6 +1783,7 @@ export async function storeMetrics( req, res ) {
|
|
|
1782
1783
|
// userId: {
|
|
1783
1784
|
// $arrayElemAt: [ '$userId', { $subtract: [ { $size: '$userId' }, 1 ] } ], //need to check if no data
|
|
1784
1785
|
// },
|
|
1786
|
+
userId: 1,
|
|
1785
1787
|
auditType: 1,
|
|
1786
1788
|
beforeCount: 1,
|
|
1787
1789
|
afterCount: { $ifNull: [ '$afterCount', null ] },
|
|
@@ -1793,6 +1795,7 @@ export async function storeMetrics( req, res ) {
|
|
|
1793
1795
|
}, null ] },
|
|
1794
1796
|
timeSpent: 1,
|
|
1795
1797
|
status: 1,
|
|
1798
|
+
auditStatus: 1,
|
|
1796
1799
|
},
|
|
1797
1800
|
},
|
|
1798
1801
|
{
|
|
@@ -1900,6 +1903,7 @@ export async function storeMetrics( req, res ) {
|
|
|
1900
1903
|
|
|
1901
1904
|
},
|
|
1902
1905
|
status: 1,
|
|
1906
|
+
auditStatus: 1,
|
|
1903
1907
|
},
|
|
1904
1908
|
},
|
|
1905
1909
|
|
|
@@ -1920,6 +1924,7 @@ export async function storeMetrics( req, res ) {
|
|
|
1920
1924
|
{ tempId: { $regex: inputData.searchValue, $options: 'i' } },
|
|
1921
1925
|
{ question: { $regex: inputData.searchValue, $options: 'i' } },
|
|
1922
1926
|
{ answer: { $regex: inputData.searchValue, $options: 'i' } },
|
|
1927
|
+
{ auditStatus: { $regex: inputData.searchValue, $options: 'i' } },
|
|
1923
1928
|
],
|
|
1924
1929
|
},
|
|
1925
1930
|
} );
|
|
@@ -1968,6 +1973,7 @@ export async function storeMetrics( req, res ) {
|
|
|
1968
1973
|
'Accuracy': element.accuracy,
|
|
1969
1974
|
'Time Spent': element.timeSpent,
|
|
1970
1975
|
'Status': element.status,
|
|
1976
|
+
'Audit Status': element.auditStatus,
|
|
1971
1977
|
} );
|
|
1972
1978
|
} else {
|
|
1973
1979
|
exportdata.push( {
|
|
@@ -1985,6 +1991,7 @@ export async function storeMetrics( req, res ) {
|
|
|
1985
1991
|
'Accuracy': element.accuracy,
|
|
1986
1992
|
'Time Spent': element.timeSpent,
|
|
1987
1993
|
'Status': element.status,
|
|
1994
|
+
'Audit Status': element.auditStatus,
|
|
1988
1995
|
} );
|
|
1989
1996
|
}
|
|
1990
1997
|
} );
|
|
@@ -2054,6 +2061,7 @@ export async function userMetrics( req, res ) {
|
|
|
2054
2061
|
totalCompletedFiles: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, 1, 0 ] },
|
|
2055
2062
|
beforeCount: 1,
|
|
2056
2063
|
afterCount: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, '$afterCount', 0 ] },
|
|
2064
|
+
auditStatus: 1,
|
|
2057
2065
|
},
|
|
2058
2066
|
},
|
|
2059
2067
|
{
|
|
@@ -2070,6 +2078,7 @@ export async function userMetrics( req, res ) {
|
|
|
2070
2078
|
tempId: { $last: '$tempId' },
|
|
2071
2079
|
question: { $last: '$question' },
|
|
2072
2080
|
answer: { $last: '$answer' },
|
|
2081
|
+
auditStatus: { $last: '$auditStatus' },
|
|
2073
2082
|
|
|
2074
2083
|
},
|
|
2075
2084
|
},
|
|
@@ -2095,6 +2104,7 @@ export async function userMetrics( req, res ) {
|
|
|
2095
2104
|
differenceInSeconds: {
|
|
2096
2105
|
$divide: [ { $subtract: [ '$checkOutTime', '$checkIntime' ] }, 1000 ],
|
|
2097
2106
|
},
|
|
2107
|
+
auditStatus: 1,
|
|
2098
2108
|
},
|
|
2099
2109
|
},
|
|
2100
2110
|
{
|
|
@@ -2114,6 +2124,7 @@ export async function userMetrics( req, res ) {
|
|
|
2114
2124
|
hours: { $floor: { $divide: [ '$differenceInSeconds', 3600 ] } },
|
|
2115
2125
|
minutes: { $floor: { $divide: [ { $mod: [ '$differenceInSeconds', 3600 ] }, 60 ] } },
|
|
2116
2126
|
seconds: { $mod: [ '$differenceInSeconds', 60 ] },
|
|
2127
|
+
auditStatus: 1,
|
|
2117
2128
|
},
|
|
2118
2129
|
},
|
|
2119
2130
|
{
|
|
@@ -2152,7 +2163,7 @@ export async function userMetrics( req, res ) {
|
|
|
2152
2163
|
else: { $toString: { $round: [ '$seconds', 0 ] } },
|
|
2153
2164
|
},
|
|
2154
2165
|
},
|
|
2155
|
-
|
|
2166
|
+
auditStatus: 1,
|
|
2156
2167
|
},
|
|
2157
2168
|
},
|
|
2158
2169
|
{
|
|
@@ -2174,6 +2185,7 @@ export async function userMetrics( req, res ) {
|
|
|
2174
2185
|
workingHours: {
|
|
2175
2186
|
$concat: [ '$hours', ':', '$minutes', ':', '$seconds' ],
|
|
2176
2187
|
},
|
|
2188
|
+
auditStatus: 1,
|
|
2177
2189
|
},
|
|
2178
2190
|
},
|
|
2179
2191
|
{
|
|
@@ -2231,6 +2243,7 @@ export async function userMetrics( req, res ) {
|
|
|
2231
2243
|
},
|
|
2232
2244
|
},
|
|
2233
2245
|
workingHours: 1,
|
|
2246
|
+
auditStatus: 1,
|
|
2234
2247
|
},
|
|
2235
2248
|
},
|
|
2236
2249
|
];
|
|
@@ -2281,6 +2294,7 @@ export async function userMetrics( req, res ) {
|
|
|
2281
2294
|
'Stream Name': '$streamName',
|
|
2282
2295
|
'Question': '$question',
|
|
2283
2296
|
'Answer': '$answer',
|
|
2297
|
+
'Audit Status': '$auditStatus',
|
|
2284
2298
|
},
|
|
2285
2299
|
},
|
|
2286
2300
|
);
|
|
@@ -2616,90 +2630,6 @@ export async function overAllAuditSummary( req, res ) {
|
|
|
2616
2630
|
}
|
|
2617
2631
|
}
|
|
2618
2632
|
|
|
2619
|
-
export async function overViewCard( req, res ) {
|
|
2620
|
-
try {
|
|
2621
|
-
const inputData = req.body;
|
|
2622
|
-
const temp = {
|
|
2623
|
-
totalCount: 0,
|
|
2624
|
-
auditFileCount: 0,
|
|
2625
|
-
ReAuditFileCount: 0,
|
|
2626
|
-
inprogressCount: 0,
|
|
2627
|
-
completedCount: 0,
|
|
2628
|
-
pendingCount: 0,
|
|
2629
|
-
};
|
|
2630
|
-
|
|
2631
|
-
const dateRange = await getUTC( new Date( inputData.fromDate ), new Date( inputData.toDate ) );
|
|
2632
|
-
let filters =[
|
|
2633
|
-
{ fileDateISO: { $gte: dateRange.start } },
|
|
2634
|
-
{ fileDateISO: { $lte: dateRange.end } },
|
|
2635
|
-
];
|
|
2636
|
-
if ( inputData.clientId.length > 0 ) {
|
|
2637
|
-
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
2638
|
-
}
|
|
2639
|
-
const query =[
|
|
2640
|
-
{
|
|
2641
|
-
$match: {
|
|
2642
|
-
$and: filters,
|
|
2643
|
-
},
|
|
2644
|
-
|
|
2645
|
-
},
|
|
2646
|
-
{
|
|
2647
|
-
$project: {
|
|
2648
|
-
auditFileCount: {
|
|
2649
|
-
$cond: [
|
|
2650
|
-
{ $eq: [ '$auditType', 'Audit' ] }, 1, 0,
|
|
2651
|
-
],
|
|
2652
|
-
},
|
|
2653
|
-
ReAuditFileCount: {
|
|
2654
|
-
$cond: [
|
|
2655
|
-
{ $eq: [ '$auditType', 'ReAudit' ] }, 1, 0,
|
|
2656
|
-
],
|
|
2657
|
-
},
|
|
2658
|
-
inprogressCount: {
|
|
2659
|
-
$cond: [
|
|
2660
|
-
{ $ne: [ '$status', 'completed' ] }, 1, 0,
|
|
2661
|
-
],
|
|
2662
|
-
},
|
|
2663
|
-
completedCount: {
|
|
2664
|
-
$cond: [
|
|
2665
|
-
{ $eq: [ '$status', 'completed' ] }, 1, 0,
|
|
2666
|
-
],
|
|
2667
|
-
},
|
|
2668
|
-
},
|
|
2669
|
-
},
|
|
2670
|
-
{
|
|
2671
|
-
$group: {
|
|
2672
|
-
_id: { fileDate: '$fileDate', clientId: '$clientId' },
|
|
2673
|
-
totalCount: { $sum: 1 },
|
|
2674
|
-
auditFileCount: { $sum: '$auditFileCount' },
|
|
2675
|
-
ReAuditFileCount: { $sum: '$ReAuditFileCount' },
|
|
2676
|
-
inprogressCount: { $sum: '$inprogressCount' },
|
|
2677
|
-
completedCount: { $sum: '$completedCount' },
|
|
2678
|
-
|
|
2679
|
-
},
|
|
2680
|
-
},
|
|
2681
|
-
{
|
|
2682
|
-
$project: {
|
|
2683
|
-
_id: 0,
|
|
2684
|
-
totalCount: 1,
|
|
2685
|
-
auditFileCount: 1,
|
|
2686
|
-
ReAuditFileCount: 1,
|
|
2687
|
-
inprogressCount: 1,
|
|
2688
|
-
completedCount: 1,
|
|
2689
|
-
notAssigned: { $subtract: [ '$totalCount', { $add: [ '$inprogressCount', '$completedCount' ] } ] },
|
|
2690
|
-
},
|
|
2691
|
-
},
|
|
2692
|
-
];
|
|
2693
|
-
const result = inputData.moduleType.includes( [ 'uniform-detection', 'mobile-detection' ] )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
2694
|
-
logger.info( { result: result } );
|
|
2695
|
-
return res.sendSuccess( { result: result.length> 0? result[0]: temp } );
|
|
2696
|
-
} catch ( error ) {
|
|
2697
|
-
const err = error.message || 'Internal Server Error';
|
|
2698
|
-
logger.error( { error: error, message: req.body, function: 'overViewCard' } );
|
|
2699
|
-
return res.sendError( err, 500 );
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
2633
|
export async function summarySplit( req, res ) {
|
|
2704
2634
|
try {
|
|
2705
2635
|
const inputData = req.body;
|
|
@@ -2870,6 +2800,7 @@ export async function overviewTable( req, res ) {
|
|
|
2870
2800
|
afterCount: 1,
|
|
2871
2801
|
auditType: 1,
|
|
2872
2802
|
status: 1,
|
|
2803
|
+
auditStatus: 1,
|
|
2873
2804
|
// userId: 1,
|
|
2874
2805
|
},
|
|
2875
2806
|
},
|
|
@@ -2915,6 +2846,7 @@ export async function overviewTable( req, res ) {
|
|
|
2915
2846
|
afterCount: 1,
|
|
2916
2847
|
auditType: 1,
|
|
2917
2848
|
status: 1,
|
|
2849
|
+
auditStatus: 1,
|
|
2918
2850
|
// userName: '$user.userName',
|
|
2919
2851
|
// userEmail: '$user.userEmail',
|
|
2920
2852
|
|
|
@@ -2930,6 +2862,7 @@ export async function overviewTable( req, res ) {
|
|
|
2930
2862
|
{ fileDate: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2931
2863
|
{ auditType: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2932
2864
|
{ status: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2865
|
+
{ auditStatus: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2933
2866
|
{ moduleType: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2934
2867
|
{ streamName: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2935
2868
|
{ tempId: { $regex: inputData.searchValue, $options: 'i' } },
|
|
@@ -2987,6 +2920,7 @@ export async function overviewTable( req, res ) {
|
|
|
2987
2920
|
// 'User Name': element.userName,
|
|
2988
2921
|
// 'User Email': element.userEmail,
|
|
2989
2922
|
'Status': element.status,
|
|
2923
|
+
'Audit Status': element.status,
|
|
2990
2924
|
} );
|
|
2991
2925
|
} else {
|
|
2992
2926
|
exportdata.push( {
|
|
@@ -3005,6 +2939,7 @@ export async function overviewTable( req, res ) {
|
|
|
3005
2939
|
// 'User Name': element.userName,
|
|
3006
2940
|
// 'User Email': element.userEmail,
|
|
3007
2941
|
'Status': element.status,
|
|
2942
|
+
'Audit Status': element.status,
|
|
3008
2943
|
} );
|
|
3009
2944
|
}
|
|
3010
2945
|
} );
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import j2s from 'joi-to-swagger';
|
|
2
|
-
import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema, pendingSummaryTableSchema, overAllAuditSummarySchema, overviewTableSchema, summarySplitSchema
|
|
2
|
+
import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema, pendingSummaryTableSchema, overAllAuditSummarySchema, overviewTableSchema, summarySplitSchema } from '../dtos/traxAudit.dtos.js';
|
|
3
3
|
|
|
4
4
|
export const traxAuditDocs = {
|
|
5
5
|
|
|
@@ -222,28 +222,6 @@ export const traxAuditDocs = {
|
|
|
222
222
|
},
|
|
223
223
|
},
|
|
224
224
|
},
|
|
225
|
-
'/v3/trax-audit/metrics/overview-card': {
|
|
226
|
-
post: {
|
|
227
|
-
tags: [ 'Trax Audit' ],
|
|
228
|
-
description: `Get overall high level audited files count`,
|
|
229
|
-
operationId: 'metrics/overview-card',
|
|
230
|
-
parameters: {},
|
|
231
|
-
requestBody: {
|
|
232
|
-
content: {
|
|
233
|
-
'application/json': {
|
|
234
|
-
schema: j2s( overViewCardSchema ).swagger,
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
responses: {
|
|
239
|
-
200: { description: 'Successful' },
|
|
240
|
-
401: { description: 'Unauthorized User' },
|
|
241
|
-
422: { description: 'Field Error' },
|
|
242
|
-
500: { description: 'Server Error' },
|
|
243
|
-
204: { description: 'Not Found' },
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
225
|
|
|
248
226
|
'/v3/trax-audit/metrics/summary-split-up': {
|
|
249
227
|
post: {
|
package/src/dtos/audit.dtos.js
CHANGED
|
@@ -148,7 +148,7 @@ export const userAuditHistorySchema = joi.object(
|
|
|
148
148
|
dateType: joi.string().required(),
|
|
149
149
|
clientId: joi.array().optional(),
|
|
150
150
|
filterByStoreId: joi.array().required(),
|
|
151
|
-
|
|
151
|
+
moduleType: joi.string().required(),
|
|
152
152
|
filterByAuditType: joi.array().optional(),
|
|
153
153
|
filterByStatus: joi.array().optional(),
|
|
154
154
|
searchValue: joi.string().optional().allow( '' ),
|
|
@@ -170,7 +170,7 @@ export const clientMetricsSchema = joi.object(
|
|
|
170
170
|
fromDate: joi.string().required(),
|
|
171
171
|
toDate: joi.string().required(),
|
|
172
172
|
searchValue: joi.string().optional().allow( '' ),
|
|
173
|
-
|
|
173
|
+
moduleType: joi.string().required(),
|
|
174
174
|
filterByClient: joi.array().required(),
|
|
175
175
|
filterByStatus: joi.array().optional(),
|
|
176
176
|
sortColumnName: joi.string().optional(),
|
|
@@ -195,7 +195,7 @@ export const storeMetricsSchema = joi.object(
|
|
|
195
195
|
filterByStoreId: joi.array().optional(),
|
|
196
196
|
filterByStatus: joi.array().optional(),
|
|
197
197
|
filterByAuditType: joi.array().optional(),
|
|
198
|
-
|
|
198
|
+
moduleType: joi.string().required(),
|
|
199
199
|
sortColumnName: joi.string().optional(),
|
|
200
200
|
sortBy: joi.number().optional(),
|
|
201
201
|
limit: joi.number().optional(),
|
|
@@ -215,7 +215,7 @@ export const userMetricsSchema = joi.object(
|
|
|
215
215
|
dateType: joi.string().required(),
|
|
216
216
|
searchValue: joi.string().optional().allow( '' ),
|
|
217
217
|
filterByUser: joi.array().optional(),
|
|
218
|
-
|
|
218
|
+
moduleType: joi.string().required(),
|
|
219
219
|
filterByStatus: joi.array().optional(),
|
|
220
220
|
sortColumnName: joi.string().optional(),
|
|
221
221
|
sortBy: joi.number().optional(),
|
|
@@ -238,7 +238,7 @@ export const pendingSummaryTableSchema = joi.object(
|
|
|
238
238
|
offset: joi.number().optional(),
|
|
239
239
|
searchValue: joi.string().optional().allow( '' ),
|
|
240
240
|
filterByStatus: joi.array().required(),
|
|
241
|
-
|
|
241
|
+
moduleType: joi.string().required(),
|
|
242
242
|
filterByAuditType: joi.array().optional(),
|
|
243
243
|
sortColumnName: joi.string().optional(),
|
|
244
244
|
sortBy: joi.number().optional(),
|
|
@@ -259,7 +259,7 @@ export const overviewTableSchema = joi.object(
|
|
|
259
259
|
offset: joi.number().optional(),
|
|
260
260
|
searchValue: joi.string().optional().allow( '' ),
|
|
261
261
|
filterByStatus: joi.array().optional(),
|
|
262
|
-
|
|
262
|
+
moduleType: joi.string().required(),
|
|
263
263
|
filterByAuditType: joi.array().optional(),
|
|
264
264
|
sortColumnName: joi.string().optional(),
|
|
265
265
|
sortBy: joi.number().optional(),
|
|
@@ -276,7 +276,7 @@ export const overAllAuditSummarySchema = joi.object(
|
|
|
276
276
|
fromDate: joi.string().required(),
|
|
277
277
|
toDate: joi.string().required(),
|
|
278
278
|
clientId: joi.array().optional(),
|
|
279
|
-
moduleType: joi.
|
|
279
|
+
moduleType: joi.string().required(),
|
|
280
280
|
},
|
|
281
281
|
);
|
|
282
282
|
|
|
@@ -319,7 +319,7 @@ export const summarySplitSchema = joi.object(
|
|
|
319
319
|
fromDate: joi.string().required(),
|
|
320
320
|
toDate: joi.string().required(),
|
|
321
321
|
clientId: joi.array().optional(),
|
|
322
|
-
moduleType: joi.
|
|
322
|
+
moduleType: joi.string().required(),
|
|
323
323
|
},
|
|
324
324
|
);
|
|
325
325
|
|
|
@@ -219,20 +219,6 @@ export const overAllAuditSummaryValid = {
|
|
|
219
219
|
body: overAllAuditSummarySchema,
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
export const overViewCardSchema = joi.object(
|
|
224
|
-
{
|
|
225
|
-
fromDate: joi.string().required(),
|
|
226
|
-
toDate: joi.string().required(),
|
|
227
|
-
clientId: joi.array().optional(),
|
|
228
|
-
moduleType: joi.string().required(),
|
|
229
|
-
},
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
export const overViewCardValid = {
|
|
233
|
-
body: overViewCardSchema,
|
|
234
|
-
};
|
|
235
|
-
|
|
236
222
|
export const summarySplitSchema = joi.object(
|
|
237
223
|
{
|
|
238
224
|
fromDate: joi.string().required(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
2
|
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
3
|
-
import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid, summarySplitValid, overviewTableValid
|
|
3
|
+
import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid, summarySplitValid, overviewTableValid } from '../dtos/traxAudit.dtos.js';
|
|
4
4
|
import { isExistsQueue } from '../validation/audit.validation.js';
|
|
5
|
-
import { clientMetrics, getAuditFile, getDetectionAuditFile, overAllAuditSummary,
|
|
5
|
+
import { clientMetrics, getAuditFile, getDetectionAuditFile, overAllAuditSummary, overviewTable, pendingSummaryTable, saveBinary, storeMetrics, summarySplit, userAuditHistory, userMetrics, workSpace } from '../controllers/traxAudit.controllers.js';
|
|
6
6
|
import { validateBinaryAudit } from '../validation/traxAuditValidation.js';
|
|
7
7
|
|
|
8
8
|
export const traxAuditRouter = Router();
|
|
@@ -30,7 +30,6 @@ traxAuditRouter.post( '/metrics/overall-audit-summary', isAllowedSessionHandler,
|
|
|
30
30
|
|
|
31
31
|
// summary
|
|
32
32
|
|
|
33
|
-
traxAuditRouter.post( '/metrics/overview-card', isAllowedSessionHandler, validate( overViewCardValid ), overViewCard );
|
|
34
33
|
traxAuditRouter.post( '/metrics/summary-split-up', isAllowedSessionHandler, validate( summarySplitValid ), summarySplit );
|
|
35
34
|
traxAuditRouter.post( '/metrics/overview-table', isAllowedSessionHandler, validate( overviewTableValid ), overviewTable );
|
|
36
35
|
|