tango-app-api-audit 3.4.0-alpha.3 → 3.4.0-alpha.4
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
CHANGED
|
@@ -2083,11 +2083,11 @@ export async function userMetrics( req, res ) {
|
|
|
2083
2083
|
tempId: 1,
|
|
2084
2084
|
question: 1,
|
|
2085
2085
|
answer: 1,
|
|
2086
|
-
mappingPerc: { $round: [
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
] },
|
|
2086
|
+
// mappingPerc: { $round: [
|
|
2087
|
+
// { $multiply: [
|
|
2088
|
+
// { $divide: [ '$afterCount', '$beforeCount' ] }, 100,
|
|
2089
|
+
// ] }, 2,
|
|
2090
|
+
// ] },
|
|
2091
2091
|
checkIntime: 1,
|
|
2092
2092
|
checkOutTime: 1,
|
|
2093
2093
|
differenceInSeconds: {
|
|
@@ -2104,7 +2104,7 @@ export async function userMetrics( req, res ) {
|
|
|
2104
2104
|
afterCount: 1,
|
|
2105
2105
|
checkIntime: 1,
|
|
2106
2106
|
checkOutTime: 1,
|
|
2107
|
-
mappingPerc: 1,
|
|
2107
|
+
// mappingPerc: 1,
|
|
2108
2108
|
streamName: 1,
|
|
2109
2109
|
tempId: 1,
|
|
2110
2110
|
question: 1,
|
|
@@ -2124,7 +2124,7 @@ export async function userMetrics( req, res ) {
|
|
|
2124
2124
|
afterCount: 1,
|
|
2125
2125
|
checkIntime: 1,
|
|
2126
2126
|
checkOutTime: 1,
|
|
2127
|
-
mappingPerc: 1,
|
|
2127
|
+
// mappingPerc: 1,
|
|
2128
2128
|
streamName: 1,
|
|
2129
2129
|
tempId: 1,
|
|
2130
2130
|
question: 1,
|
|
@@ -2164,7 +2164,7 @@ export async function userMetrics( req, res ) {
|
|
|
2164
2164
|
checkIntime: 1,
|
|
2165
2165
|
zoneName: 1,
|
|
2166
2166
|
checkOutTime: 1,
|
|
2167
|
-
mappingPerc: 1,
|
|
2167
|
+
// mappingPerc: 1,
|
|
2168
2168
|
streamName: 1,
|
|
2169
2169
|
tempId: 1,
|
|
2170
2170
|
question: 1,
|
|
@@ -2209,7 +2209,7 @@ export async function userMetrics( req, res ) {
|
|
|
2209
2209
|
totalCompletedFiles: 1,
|
|
2210
2210
|
beforeCount: 1,
|
|
2211
2211
|
afterCount: 1,
|
|
2212
|
-
mappingPerc: 1,
|
|
2212
|
+
// mappingPerc: 1,
|
|
2213
2213
|
streamName: 1,
|
|
2214
2214
|
tempId: 1,
|
|
2215
2215
|
question: 1,
|
|
@@ -2275,6 +2275,10 @@ export async function userMetrics( req, res ) {
|
|
|
2275
2275
|
'check OutTime': '$checkOutTime',
|
|
2276
2276
|
'working Hours': '$workingHours',
|
|
2277
2277
|
'Mapping Percentage': '$mappingPerc',
|
|
2278
|
+
'Customer ID': '$tempId',
|
|
2279
|
+
'Stream Name': '$streamName',
|
|
2280
|
+
'Question': '$question',
|
|
2281
|
+
'Answer': '$answer',
|
|
2278
2282
|
},
|
|
2279
2283
|
},
|
|
2280
2284
|
);
|
|
@@ -2293,3 +2297,319 @@ export async function userMetrics( req, res ) {
|
|
|
2293
2297
|
return res.sendError( err, 500 );
|
|
2294
2298
|
}
|
|
2295
2299
|
}
|
|
2300
|
+
|
|
2301
|
+
export async function pendingSummaryTable( req, res ) {
|
|
2302
|
+
try {
|
|
2303
|
+
const inputData = req.body;
|
|
2304
|
+
const limit = inputData.limit || 10;
|
|
2305
|
+
const offset = inputData.offset ? ( inputData.offset - 1 ) * limit : 0;
|
|
2306
|
+
const dateRange = await getUTC( new Date( inputData.fromDate ), new Date( inputData.toDate ) );
|
|
2307
|
+
let filters =[
|
|
2308
|
+
{ fileDateISO: { $gte: dateRange.start } },
|
|
2309
|
+
{ fileDateISO: { $lte: dateRange.end } },
|
|
2310
|
+
{ auditStatus: { $ne: 'completed' } },
|
|
2311
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
2312
|
+
|
|
2313
|
+
];
|
|
2314
|
+
|
|
2315
|
+
if ( inputData.clientId.length > 0 ) {
|
|
2316
|
+
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
if ( inputData.filterByAuditType.length > 0 ) {
|
|
2320
|
+
filters.push( { auditType: { $in: inputData.filterByAuditType } } );
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
if ( inputData.filterByStatus.length > 0 ) {
|
|
2324
|
+
filters.push( { auditStatus: { $in: inputData.filterByStatus } } );
|
|
2325
|
+
}
|
|
2326
|
+
const query =[
|
|
2327
|
+
{
|
|
2328
|
+
$match: {
|
|
2329
|
+
$and: filters,
|
|
2330
|
+
},
|
|
2331
|
+
|
|
2332
|
+
},
|
|
2333
|
+
{
|
|
2334
|
+
$project: {
|
|
2335
|
+
_id: 0,
|
|
2336
|
+
storeId: 1,
|
|
2337
|
+
streamName: 1,
|
|
2338
|
+
tempId: 1,
|
|
2339
|
+
question: 1,
|
|
2340
|
+
answer: 1,
|
|
2341
|
+
userCommands: 1,
|
|
2342
|
+
fileDate: 1,
|
|
2343
|
+
moduleType: 1,
|
|
2344
|
+
beforeCount: 1,
|
|
2345
|
+
startTime: { $dateToString: {
|
|
2346
|
+
format: '%Y-%m-%d %H:%M:%S',
|
|
2347
|
+
date: '$startTime',
|
|
2348
|
+
timezone: 'Asia/Kolkata',
|
|
2349
|
+
},
|
|
2350
|
+
|
|
2351
|
+
},
|
|
2352
|
+
auditType: 1,
|
|
2353
|
+
auditStatus: 1,
|
|
2354
|
+
userId: 1,
|
|
2355
|
+
},
|
|
2356
|
+
},
|
|
2357
|
+
{
|
|
2358
|
+
$lookup: {
|
|
2359
|
+
from: 'users',
|
|
2360
|
+
let: { userId: '$userId' },
|
|
2361
|
+
pipeline: [
|
|
2362
|
+
{
|
|
2363
|
+
$match: {
|
|
2364
|
+
$expr: {
|
|
2365
|
+
$eq: [ '$_id', '$$userId' ],
|
|
2366
|
+
},
|
|
2367
|
+
},
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
$project: {
|
|
2371
|
+
userName: 1,
|
|
2372
|
+
userEmail: '$email',
|
|
2373
|
+
},
|
|
2374
|
+
},
|
|
2375
|
+
], as: 'user',
|
|
2376
|
+
},
|
|
2377
|
+
},
|
|
2378
|
+
{
|
|
2379
|
+
$unwind: {
|
|
2380
|
+
path: '$user',
|
|
2381
|
+
preserveNullAndEmptyArrays: true,
|
|
2382
|
+
},
|
|
2383
|
+
},
|
|
2384
|
+
{
|
|
2385
|
+
$project: {
|
|
2386
|
+
storeId: 1,
|
|
2387
|
+
streamName: 1,
|
|
2388
|
+
tempId: 1,
|
|
2389
|
+
question: 1,
|
|
2390
|
+
answer: 1,
|
|
2391
|
+
userCommands: 1,
|
|
2392
|
+
fileDate: 1,
|
|
2393
|
+
moduleType: 1,
|
|
2394
|
+
beforeCount: 1,
|
|
2395
|
+
startTime: 1,
|
|
2396
|
+
endTime: 1,
|
|
2397
|
+
auditType: 1,
|
|
2398
|
+
auditStatus: 1,
|
|
2399
|
+
userName: '$user.userName',
|
|
2400
|
+
userEmail: '$user.userEmail',
|
|
2401
|
+
|
|
2402
|
+
},
|
|
2403
|
+
},
|
|
2404
|
+
];
|
|
2405
|
+
if ( inputData.searchValue && inputData.searchValue!== '' ) {
|
|
2406
|
+
query.push( {
|
|
2407
|
+
$match: {
|
|
2408
|
+
$or: [
|
|
2409
|
+
{ storeId: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2410
|
+
{ fileDate: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2411
|
+
{ auditType: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2412
|
+
{ auditStatus: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2413
|
+
{ userName: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2414
|
+
{ userEmail: { $regex: inputData.searchValue, $options: 'i' } },
|
|
2415
|
+
],
|
|
2416
|
+
|
|
2417
|
+
},
|
|
2418
|
+
} );
|
|
2419
|
+
}
|
|
2420
|
+
if ( inputData.sortColumnName ) {
|
|
2421
|
+
const sortBy = inputData.sortBy || -1;
|
|
2422
|
+
const sortColumn = inputData.sortColumnName;
|
|
2423
|
+
query.push( {
|
|
2424
|
+
$sort: { [sortColumn]: sortBy },
|
|
2425
|
+
},
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
const count = inputData.moduleType.includes( [ 'uniform-detection', 'mobile-detection' ] )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
2429
|
+
if ( count.length == 0 ) {
|
|
2430
|
+
return res.sendError( 'No Data Found', 204 );
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
if ( inputData.isExport ) {
|
|
2434
|
+
query.push( { $limit: 10000 } );
|
|
2435
|
+
} else {
|
|
2436
|
+
query.push( {
|
|
2437
|
+
$skip: offset,
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
$limit: limit,
|
|
2441
|
+
} );
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
const result = inputData.moduleType.includes( [ 'uniform-detection', 'mobile-detection' ] )?await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
2445
|
+
if ( inputData.isExport ) {
|
|
2446
|
+
const exportdata = [];
|
|
2447
|
+
result.forEach( ( element ) => {
|
|
2448
|
+
if ( element.moduleType == 'zone' ) {
|
|
2449
|
+
exportdata.push( {
|
|
2450
|
+
'Store ID': element.storeId,
|
|
2451
|
+
'Stream Name': element.streamName,
|
|
2452
|
+
'Customer ID': element.tempId,
|
|
2453
|
+
'Question': question,
|
|
2454
|
+
'Answer': element.answer,
|
|
2455
|
+
'userComments': element.userCommands,
|
|
2456
|
+
'File Date': element.fileDate,
|
|
2457
|
+
'Product Type': element.moduleType,
|
|
2458
|
+
'Audit Type': element.auditType,
|
|
2459
|
+
'Before Count': element.beforeCount,
|
|
2460
|
+
'Start Time': element.startTime,
|
|
2461
|
+
'User Name': element.userName,
|
|
2462
|
+
'User Email': element.userEmail,
|
|
2463
|
+
'Status': element.auditStatus,
|
|
2464
|
+
} );
|
|
2465
|
+
} else {
|
|
2466
|
+
exportdata.push( {
|
|
2467
|
+
'Store ID': element.storeId,
|
|
2468
|
+
'Stream Name': element.streamName,
|
|
2469
|
+
'Customer ID': element.tempId,
|
|
2470
|
+
'Question': question,
|
|
2471
|
+
'Answer': element.answer,
|
|
2472
|
+
'userComments': element.userCommands,
|
|
2473
|
+
'File Date': element.fileDate,
|
|
2474
|
+
'Product Type': element.moduleType,
|
|
2475
|
+
'Audit Type': element.auditType,
|
|
2476
|
+
'Before Count': element.beforeCount,
|
|
2477
|
+
'Start Time': element.startTime,
|
|
2478
|
+
'User Name': element.userName,
|
|
2479
|
+
'User Email': element.userEmail,
|
|
2480
|
+
'Status': element.auditStatus,
|
|
2481
|
+
} );
|
|
2482
|
+
}
|
|
2483
|
+
} );
|
|
2484
|
+
await download( exportdata, res );
|
|
2485
|
+
return;
|
|
2486
|
+
}
|
|
2487
|
+
return res.sendSuccess( { result: result, count: count.length } );
|
|
2488
|
+
} catch ( error ) {
|
|
2489
|
+
const err = error.message || 'Internal Server Error';
|
|
2490
|
+
logger.error( { error: error, message: req.body, function: 'pendingSummaryTable' } );
|
|
2491
|
+
return res.sendError( err, 500 );
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
export async function overAllAuditSummary( req, res ) {
|
|
2496
|
+
try {
|
|
2497
|
+
const inputData = req.body;
|
|
2498
|
+
let temp = {
|
|
2499
|
+
installedStores: 0,
|
|
2500
|
+
auditStores: 0,
|
|
2501
|
+
inprogressStores: 0,
|
|
2502
|
+
completedStores: 0,
|
|
2503
|
+
auditInprogress: 0,
|
|
2504
|
+
reAuditInprogress: 0,
|
|
2505
|
+
draft: 0,
|
|
2506
|
+
assigned: 0,
|
|
2507
|
+
notAssigned: 0,
|
|
2508
|
+
auditCompleted: 0,
|
|
2509
|
+
reAuditCompleted: 0,
|
|
2510
|
+
|
|
2511
|
+
};
|
|
2512
|
+
const dateRange = await getUTC( new Date( inputData.fromDate ), new Date( inputData.toDate ) );
|
|
2513
|
+
let filters =[
|
|
2514
|
+
{ fileDateISO: { $gte: dateRange.start } },
|
|
2515
|
+
{ fileDateISO: { $lte: dateRange.end } },
|
|
2516
|
+
{ moduleType: { $eq: inputData.moduleType },
|
|
2517
|
+
},
|
|
2518
|
+
];
|
|
2519
|
+
if ( inputData.clientId.length > 0 ) {
|
|
2520
|
+
filters.push( { clientId: { $in: inputData.clientId } } );
|
|
2521
|
+
}
|
|
2522
|
+
const storeQuery = inputData.clientId.length? { 'edge.firstFile': true, 'clientId': { $in: inputData. clientId } } : { 'edge.firstFile': true };
|
|
2523
|
+
temp.installedStores = await countDocumentsStore( storeQuery );
|
|
2524
|
+
const auditClientDataQuery =[
|
|
2525
|
+
{
|
|
2526
|
+
$match: {
|
|
2527
|
+
$and: filters,
|
|
2528
|
+
},
|
|
2529
|
+
|
|
2530
|
+
},
|
|
2531
|
+
{
|
|
2532
|
+
$group: {
|
|
2533
|
+
_id: null,
|
|
2534
|
+
totalFilesCount: { $sum: 1 },
|
|
2535
|
+
},
|
|
2536
|
+
},
|
|
2537
|
+
{
|
|
2538
|
+
$project: {
|
|
2539
|
+
_id: 0,
|
|
2540
|
+
totalFilesCount: 1,
|
|
2541
|
+
},
|
|
2542
|
+
},
|
|
2543
|
+
];
|
|
2544
|
+
const auditClientData = await aggregateAuditStoreData( auditClientDataQuery );
|
|
2545
|
+
if ( auditClientData.length >0 ) {
|
|
2546
|
+
temp.auditStores = auditClientData[0].totalFilesCount;
|
|
2547
|
+
}
|
|
2548
|
+
const storeAuditQuery =[
|
|
2549
|
+
{
|
|
2550
|
+
$match: {
|
|
2551
|
+
$and: filters,
|
|
2552
|
+
},
|
|
2553
|
+
|
|
2554
|
+
},
|
|
2555
|
+
{
|
|
2556
|
+
$project: {
|
|
2557
|
+
completedStores: { $cond: [ { $eq: [ '$status', 'completed' ] }, 1, 0 ] },
|
|
2558
|
+
auditInprogress: { $cond: [ { $and: [ { $in: [ '$status', [ 'inprogress' ] ] }, { $eq: [ '$auditType', 'Audit' ] } ] }, 1, 0 ] },
|
|
2559
|
+
reAuditInprogress: { $cond: [ { $and: [ { $in: [ '$status', [ 'inprogress' ] ] }, { $eq: [ '$auditType', 'ReAudit' ] } ] }, 1, 0 ] },
|
|
2560
|
+
draft: { $cond: [ { $eq: [ '$status', 'drafted' ] }, 1, 0 ] },
|
|
2561
|
+
assigned: { $cond: [ { $eq: [ '$status', 'assigned' ] }, 1, 0 ] },
|
|
2562
|
+
exceptNoAssigned: { $cond: { if: { $not: { $in: [ '$status', [ 'skipped', 'not_assign' ] ] } }, then: 1, else: 0 } },
|
|
2563
|
+
auditCompleted: { $cond: [ { $and: [ { $in: [ '$status', [ 'completed' ] ] }, { $eq: [ '$auditType', 'Audit' ] } ] }, 1, 0 ] },
|
|
2564
|
+
reAuditCompleted: { $cond: [ { $and: [ { $in: [ '$status', [ 'completed' ] ] }, { $eq: [ '$auditType', 'ReAudit' ] } ] }, 1, 0 ] },
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
},
|
|
2568
|
+
},
|
|
2569
|
+
{
|
|
2570
|
+
$group: {
|
|
2571
|
+
_id: null,
|
|
2572
|
+
completedStores: { $sum: '$completedStores' },
|
|
2573
|
+
auditInprogress: { $sum: '$auditInprogress' },
|
|
2574
|
+
reAuditInprogress: { $sum: '$reAuditInprogress' },
|
|
2575
|
+
draft: { $sum: '$draft' },
|
|
2576
|
+
assigned: { $sum: '$assigned' },
|
|
2577
|
+
exceptNoAssigned: { $sum: '$exceptNoAssigned' },
|
|
2578
|
+
auditCompleted: { $sum: '$auditCompleted' },
|
|
2579
|
+
reAuditCompleted: { $sum: '$reAuditCompleted' },
|
|
2580
|
+
},
|
|
2581
|
+
},
|
|
2582
|
+
{
|
|
2583
|
+
$project: {
|
|
2584
|
+
completedStores: 1,
|
|
2585
|
+
inprogressStores: { $subtract: [ temp.auditStores, '$completedStores' ] },
|
|
2586
|
+
auditInprogress: 1,
|
|
2587
|
+
reAuditInprogress: 1,
|
|
2588
|
+
draft: 1,
|
|
2589
|
+
assigned: 1,
|
|
2590
|
+
exceptNoAssigned: { $subtract: [ temp.auditStores, '$exceptNoAssigned' ] },
|
|
2591
|
+
auditCompleted: 1,
|
|
2592
|
+
reAuditCompleted: 1,
|
|
2593
|
+
},
|
|
2594
|
+
},
|
|
2595
|
+
];
|
|
2596
|
+
const storeAudit = await aggregateStoreAudit( storeAuditQuery );
|
|
2597
|
+
if ( storeAudit.length > 0 ) {
|
|
2598
|
+
temp.inprogressStores= storeAudit[0].inprogressStores;
|
|
2599
|
+
temp.completedStores = storeAudit[0].completedStores;
|
|
2600
|
+
temp.auditInprogress = storeAudit[0].auditInprogress;
|
|
2601
|
+
temp.reAuditInprogress = storeAudit[0].reAuditInprogress;
|
|
2602
|
+
temp.draft = storeAudit[0].draft;
|
|
2603
|
+
temp.assigned = storeAudit[0].assigned;
|
|
2604
|
+
temp.notAssigned = storeAudit[0].exceptNoAssigned;
|
|
2605
|
+
temp.auditCompleted = storeAudit[0].auditCompleted;
|
|
2606
|
+
temp.reAuditCompleted = storeAudit[0].reAuditCompleted;
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
return res.sendSuccess( { result: temp } );
|
|
2610
|
+
} catch ( error ) {
|
|
2611
|
+
const err = error.message || 'Internal Server Error';
|
|
2612
|
+
logger.error( { error: error, message: req.body, function: 'overAllAuditSummary' } );
|
|
2613
|
+
return res.sendError( err, 500 );
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import j2s from 'joi-to-swagger';
|
|
2
|
-
import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema } from '../dtos/traxAudit.dtos.js';
|
|
2
|
+
import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema, pendingSummaryTableSchema } from '../dtos/traxAudit.dtos.js';
|
|
3
3
|
|
|
4
4
|
export const traxAuditDocs = {
|
|
5
5
|
|
|
@@ -178,4 +178,26 @@ export const traxAuditDocs = {
|
|
|
178
178
|
},
|
|
179
179
|
},
|
|
180
180
|
},
|
|
181
|
+
'/v3/trax-audit/metrics/pending-summary-table': {
|
|
182
|
+
post: {
|
|
183
|
+
tags: [ 'Trax Audit' ],
|
|
184
|
+
description: `Get overall user taken data with some filters `,
|
|
185
|
+
operationId: 'metrics/pending-summary-table',
|
|
186
|
+
parameters: {},
|
|
187
|
+
requestBody: {
|
|
188
|
+
content: {
|
|
189
|
+
'application/json': {
|
|
190
|
+
schema: j2s( pendingSummaryTableSchema ).swagger,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
responses: {
|
|
195
|
+
200: { description: 'Successful' },
|
|
196
|
+
401: { description: 'Unauthorized User' },
|
|
197
|
+
422: { description: 'Field Error' },
|
|
198
|
+
500: { description: 'Server Error' },
|
|
199
|
+
204: { description: 'Not Found' },
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
181
203
|
};
|
|
@@ -184,3 +184,37 @@ export const userMetricsSchema = joi.object(
|
|
|
184
184
|
export const userMetricsValid = {
|
|
185
185
|
body: userMetricsSchema,
|
|
186
186
|
};
|
|
187
|
+
|
|
188
|
+
export const pendingSummaryTableSchema = joi.object(
|
|
189
|
+
{
|
|
190
|
+
fromDate: joi.string().required(),
|
|
191
|
+
toDate: joi.string().required(),
|
|
192
|
+
clientId: joi.array().optional(),
|
|
193
|
+
limit: joi.number().optional(),
|
|
194
|
+
offset: joi.number().optional(),
|
|
195
|
+
searchValue: joi.string().optional().allow( '' ),
|
|
196
|
+
filterByStatus: joi.array().required(),
|
|
197
|
+
moduleType: joi.string().required(),
|
|
198
|
+
filterByAuditType: joi.array().optional(),
|
|
199
|
+
sortColumnName: joi.string().optional(),
|
|
200
|
+
sortBy: joi.number().optional(),
|
|
201
|
+
isExport: joi.boolean().optional(),
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
export const pendingSummaryTableValid = {
|
|
206
|
+
body: pendingSummaryTableSchema,
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export const overAllAuditSummarySchema = joi.object(
|
|
210
|
+
{
|
|
211
|
+
fromDate: joi.string().required(),
|
|
212
|
+
toDate: joi.string().required(),
|
|
213
|
+
clientId: joi.array().optional(),
|
|
214
|
+
moduleType: joi.string().required(),
|
|
215
|
+
},
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
export const overAllAuditSummaryValid = {
|
|
219
|
+
body: overAllAuditSummarySchema,
|
|
220
|
+
};
|
|
@@ -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 } from '../dtos/traxAudit.dtos.js';
|
|
3
|
+
import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid } from '../dtos/traxAudit.dtos.js';
|
|
4
4
|
import { isExistsQueue } from '../validation/audit.validation.js';
|
|
5
|
-
import { clientMetrics, getAuditFile, getDetectionAuditFile, saveBinary, storeMetrics, userAuditHistory, userMetrics, workSpace } from '../controllers/traxAudit.controllers.js';
|
|
5
|
+
import { clientMetrics, getAuditFile, getDetectionAuditFile, overAllAuditSummary, pendingSummaryTable, saveBinary, storeMetrics, userAuditHistory, userMetrics, workSpace } from '../controllers/traxAudit.controllers.js';
|
|
6
6
|
import { validateBinaryAudit } from '../validation/traxAuditValidation.js';
|
|
7
7
|
|
|
8
8
|
export const traxAuditRouter = Router();
|
|
@@ -25,5 +25,7 @@ traxAuditRouter.post( '/metrics/user-audit-history', isAllowedSessionHandler, va
|
|
|
25
25
|
traxAuditRouter.post( '/metrics/client-metrics', isAllowedSessionHandler, validate( clientMetricsValid ), clientMetrics );
|
|
26
26
|
traxAuditRouter.post( '/metrics/store-metrics', isAllowedSessionHandler, validate( storeMetricsValid ), storeMetrics );
|
|
27
27
|
traxAuditRouter.post( '/metrics/user-metrics', isAllowedSessionHandler, validate( userMetricsValid ), userMetrics );
|
|
28
|
+
traxAuditRouter.post( '/metrics/pending-summary-table', isAllowedSessionHandler, validate( pendingSummaryTableValid ), pendingSummaryTable );
|
|
29
|
+
traxAuditRouter.post( '/metrics/overall-audit-summary', isAllowedSessionHandler, validate( overAllAuditSummaryValid ), overAllAuditSummary );
|
|
28
30
|
|
|
29
31
|
export default traxAuditRouter;
|