tango-app-api-audit 3.4.14 → 3.4.16
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
|
@@ -1725,14 +1725,16 @@ export async function userAuditHistory( req, res ) {
|
|
|
1725
1725
|
logger.info( { mappedArrays: mappedArrays[0] } );
|
|
1726
1726
|
await download( mappedArrays[0], res );
|
|
1727
1727
|
return;
|
|
1728
|
+
} else {
|
|
1729
|
+
query.push( {
|
|
1730
|
+
$skip: offset,
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
$limit: limit,
|
|
1734
|
+
} );
|
|
1728
1735
|
}
|
|
1729
1736
|
|
|
1730
|
-
|
|
1731
|
-
$skip: offset,
|
|
1732
|
-
},
|
|
1733
|
-
{
|
|
1734
|
-
$limit: limit,
|
|
1735
|
-
} );
|
|
1737
|
+
|
|
1736
1738
|
const result = await aggregateUserAudit( query );
|
|
1737
1739
|
|
|
1738
1740
|
return res.sendSuccess( { result: result, count: count.length } );
|
|
@@ -2304,6 +2306,11 @@ export async function userMetrics( req, res ) {
|
|
|
2304
2306
|
$and: filter,
|
|
2305
2307
|
},
|
|
2306
2308
|
},
|
|
2309
|
+
{
|
|
2310
|
+
$sort: {
|
|
2311
|
+
createdAt: -1,
|
|
2312
|
+
},
|
|
2313
|
+
},
|
|
2307
2314
|
{
|
|
2308
2315
|
$project: {
|
|
2309
2316
|
userId: 1,
|
|
@@ -2319,7 +2326,7 @@ export async function userMetrics( req, res ) {
|
|
|
2319
2326
|
},
|
|
2320
2327
|
{
|
|
2321
2328
|
$sort: {
|
|
2322
|
-
|
|
2329
|
+
createdAt: -1,
|
|
2323
2330
|
},
|
|
2324
2331
|
},
|
|
2325
2332
|
{
|
|
@@ -2330,8 +2337,8 @@ export async function userMetrics( req, res ) {
|
|
|
2330
2337
|
totalCompletedFiles: { $sum: '$totalCompletedFiles' },
|
|
2331
2338
|
beforeCount: { $sum: '$beforeCount' },
|
|
2332
2339
|
afterCount: { $sum: '$afterCount' },
|
|
2333
|
-
checkIntime: { $
|
|
2334
|
-
checkOutTime: { $first: '$endTime' },
|
|
2340
|
+
checkIntime: { $last: '$startTime' },
|
|
2341
|
+
checkOutTime: { $first: { $ifNull: [ '$endTime', '$startTime' ] } },
|
|
2335
2342
|
createdAt: { $first: '$createdAt' },
|
|
2336
2343
|
to: { $last: '$createdAt' },
|
|
2337
2344
|
|
|
@@ -1909,14 +1909,16 @@ export async function userAuditHistory( req, res ) {
|
|
|
1909
1909
|
logger.info( { mappedArrays: mappedArrays[0] } );
|
|
1910
1910
|
await download( mappedArrays[0], res );
|
|
1911
1911
|
return;
|
|
1912
|
+
} else {
|
|
1913
|
+
query.push( {
|
|
1914
|
+
$skip: offset,
|
|
1915
|
+
},
|
|
1916
|
+
{
|
|
1917
|
+
$limit: limit,
|
|
1918
|
+
} );
|
|
1912
1919
|
}
|
|
1913
1920
|
|
|
1914
|
-
|
|
1915
|
-
$skip: offset,
|
|
1916
|
-
},
|
|
1917
|
-
{
|
|
1918
|
-
$limit: limit,
|
|
1919
|
-
} );
|
|
1921
|
+
|
|
1920
1922
|
const result = [ 'mobile-detection', 'uniform-detection' ].includes( inputData.moduleType )? await aggregateUserEmpDetection( query ) : await aggregateBinaryAudit( query );
|
|
1921
1923
|
|
|
1922
1924
|
return res.sendSuccess( { result: result, count: count.length } );
|
|
@@ -2908,6 +2910,11 @@ export async function userMetrics( req, res ) {
|
|
|
2908
2910
|
$and: filter,
|
|
2909
2911
|
},
|
|
2910
2912
|
},
|
|
2913
|
+
{
|
|
2914
|
+
$sort: {
|
|
2915
|
+
createdAt: -1,
|
|
2916
|
+
},
|
|
2917
|
+
},
|
|
2911
2918
|
|
|
2912
2919
|
{
|
|
2913
2920
|
$project: {
|
|
@@ -2928,7 +2935,7 @@ export async function userMetrics( req, res ) {
|
|
|
2928
2935
|
},
|
|
2929
2936
|
{
|
|
2930
2937
|
$sort: {
|
|
2931
|
-
|
|
2938
|
+
createdAt: -1,
|
|
2932
2939
|
},
|
|
2933
2940
|
},
|
|
2934
2941
|
{
|
|
@@ -2939,8 +2946,8 @@ export async function userMetrics( req, res ) {
|
|
|
2939
2946
|
totalCompletedFiles: { $sum: '$totalCompletedFiles' },
|
|
2940
2947
|
beforeCount: { $sum: '$beforeCount' },
|
|
2941
2948
|
afterCount: { $sum: '$afterCount' },
|
|
2942
|
-
checkIntime: { $
|
|
2943
|
-
checkOutTime: { $first: '$endTime' },
|
|
2949
|
+
checkIntime: { $last: '$startTime' },
|
|
2950
|
+
checkOutTime: { $first: { $ifNull: [ '$endTime', '$startTime' ] } },
|
|
2944
2951
|
moduleType: { $last: '$moduleType' },
|
|
2945
2952
|
value: { $last: '$value' },
|
|
2946
2953
|
createdAt: { $first: '$createdAt' },
|