tango-app-api-audit 1.0.18 → 1.0.20
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
CHANGED
|
@@ -8,7 +8,9 @@ import clientRouter from './src/routes/client.routes.js';
|
|
|
8
8
|
import { clientDocs } from './src/docs/client.docs.js';
|
|
9
9
|
import { storeRouter } from './src/routes/store.routes.js';
|
|
10
10
|
import { storeDocs } from './src/docs/store.docs.js';
|
|
11
|
+
import { userDocs } from './src/docs/user.docs.js';
|
|
12
|
+
import { userRouter } from './src/routes/user.routes.js';
|
|
11
13
|
|
|
12
|
-
export { auditRouter, auditMetricsRouter, auditMetricsDocs, auditDocs, clientRouter, clientDocs, storeRouter, storeDocs };
|
|
14
|
+
export { auditRouter, auditMetricsRouter, auditMetricsDocs, auditDocs, clientRouter, clientDocs, storeRouter, storeDocs, userRouter, userDocs };
|
|
13
15
|
|
|
14
16
|
|
package/package.json
CHANGED
|
@@ -532,14 +532,25 @@ export async function userMetrics( req, res ) {
|
|
|
532
532
|
$and: filter,
|
|
533
533
|
},
|
|
534
534
|
},
|
|
535
|
+
{
|
|
536
|
+
$project: {
|
|
537
|
+
userId: 1,
|
|
538
|
+
fileDate: 1,
|
|
539
|
+
checkIntime: 1,
|
|
540
|
+
checkOutTime: 1,
|
|
541
|
+
totalCompletedFiles: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, 1, 0 ] },
|
|
542
|
+
beforeCount: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, '$beforeCount', 0 ] },
|
|
543
|
+
afterCount: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, '$afterCount', 0 ] },
|
|
544
|
+
},
|
|
545
|
+
},
|
|
535
546
|
{
|
|
536
547
|
$group: {
|
|
537
548
|
_id: { userId: '$userId', fileDate: '$fileDate' },
|
|
538
549
|
userId: { $first: '$userId' },
|
|
539
550
|
fileDate: { $first: '$fileDate' },
|
|
540
|
-
totalCompletedFiles: { $
|
|
541
|
-
beforeCount: { $
|
|
542
|
-
afterCount: { $
|
|
551
|
+
totalCompletedFiles: { $sum: '$totalCompletedFiles' },
|
|
552
|
+
beforeCount: { $sum: '$beforeCount' },
|
|
553
|
+
afterCount: { $sum: '$afterCount' },
|
|
543
554
|
checkIntime: { $first: '$createdAt' },
|
|
544
555
|
checkOutTime: { $last: '$createdAt' },
|
|
545
556
|
|
|
@@ -556,7 +567,7 @@ export async function userMetrics( req, res ) {
|
|
|
556
567
|
afterCount: 1,
|
|
557
568
|
mappingPerc: { $round: [
|
|
558
569
|
{ $multiply: [
|
|
559
|
-
{ $divide: [ '$afterCount', 'beforeCount' ] }, 100,
|
|
570
|
+
{ $divide: [ '$afterCount', '$beforeCount' ] }, 100,
|
|
560
571
|
] }, 2,
|
|
561
572
|
] },
|
|
562
573
|
checkIntime: 1,
|