tango-app-api-audit 3.4.11-alpha.22 → 3.4.11-alpha.23
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
|
@@ -2320,11 +2320,17 @@ export async function userMetrics( req, res ) {
|
|
|
2320
2320
|
userId: 1,
|
|
2321
2321
|
fileDate: 1,
|
|
2322
2322
|
startTime: 1,
|
|
2323
|
-
endTime:
|
|
2323
|
+
endTime: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, '$endTime', '$$REMOVE' ] },
|
|
2324
2324
|
totalCompletedFiles: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, 1, 0 ] },
|
|
2325
2325
|
beforeCount: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, '$beforeCount', 0 ] },
|
|
2326
2326
|
afterCount: { $cond: [ { $eq: [ '$auditStatus', 'completed' ] }, '$afterCount', 0 ] },
|
|
2327
2327
|
createdAt: 1,
|
|
2328
|
+
// to: '$createdAt',
|
|
2329
|
+
},
|
|
2330
|
+
},
|
|
2331
|
+
{
|
|
2332
|
+
$sort: {
|
|
2333
|
+
endTime: -1,
|
|
2328
2334
|
},
|
|
2329
2335
|
},
|
|
2330
2336
|
{
|
|
@@ -2336,8 +2342,9 @@ export async function userMetrics( req, res ) {
|
|
|
2336
2342
|
beforeCount: { $sum: '$beforeCount' },
|
|
2337
2343
|
afterCount: { $sum: '$afterCount' },
|
|
2338
2344
|
checkIntime: { $first: '$startTime' },
|
|
2339
|
-
checkOutTime: { $
|
|
2345
|
+
checkOutTime: { $first: '$endTime' },
|
|
2340
2346
|
createdAt: { $first: '$createdAt' },
|
|
2347
|
+
to: { $last: '$createdAt' },
|
|
2341
2348
|
|
|
2342
2349
|
},
|
|
2343
2350
|
},
|
|
@@ -2373,6 +2380,7 @@ export async function userMetrics( req, res ) {
|
|
|
2373
2380
|
$divide: [ { $subtract: [ '$checkOutTime', '$checkIntime' ] }, 1000 ],
|
|
2374
2381
|
},
|
|
2375
2382
|
createdAt: 1,
|
|
2383
|
+
to: 1,
|
|
2376
2384
|
},
|
|
2377
2385
|
},
|
|
2378
2386
|
{
|
|
@@ -2389,6 +2397,7 @@ export async function userMetrics( req, res ) {
|
|
|
2389
2397
|
minutes: { $floor: { $divide: [ { $mod: [ '$differenceInSeconds', 3600 ] }, 60 ] } },
|
|
2390
2398
|
seconds: { $mod: [ '$differenceInSeconds', 60 ] },
|
|
2391
2399
|
createdAt: 1,
|
|
2400
|
+
to: 1,
|
|
2392
2401
|
},
|
|
2393
2402
|
},
|
|
2394
2403
|
{
|
|
@@ -2424,6 +2433,7 @@ export async function userMetrics( req, res ) {
|
|
|
2424
2433
|
},
|
|
2425
2434
|
},
|
|
2426
2435
|
createdAt: 1,
|
|
2436
|
+
to: 1,
|
|
2427
2437
|
},
|
|
2428
2438
|
},
|
|
2429
2439
|
{
|
|
@@ -2442,6 +2452,7 @@ export async function userMetrics( req, res ) {
|
|
|
2442
2452
|
$concat: [ '$hours', ':', '$minutes', ':', '$seconds' ],
|
|
2443
2453
|
},
|
|
2444
2454
|
createdAt: 1,
|
|
2455
|
+
to: 1,
|
|
2445
2456
|
},
|
|
2446
2457
|
},
|
|
2447
2458
|
{
|
|
@@ -2496,6 +2507,7 @@ export async function userMetrics( req, res ) {
|
|
|
2496
2507
|
},
|
|
2497
2508
|
workingHours: 1,
|
|
2498
2509
|
createdAt: 1,
|
|
2510
|
+
to: 1,
|
|
2499
2511
|
},
|
|
2500
2512
|
},
|
|
2501
2513
|
];
|
|
@@ -4734,6 +4746,7 @@ export async function auditViewLogs( req, res ) {
|
|
|
4734
4746
|
},
|
|
4735
4747
|
};
|
|
4736
4748
|
break;
|
|
4749
|
+
case 'uniform-detection':
|
|
4737
4750
|
case 'mobile-detection':
|
|
4738
4751
|
logsQuery = {
|
|
4739
4752
|
'size': 100,
|
package/src/docs/audit.docs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { auditStoreSchema, clientMetricsSchema, clientSchema, getDraftedDataSchema, getFileSchema, overAllAuditSummarySchema, overViewCardSchema, reTriggerValidSchema, saveDraftSchema, saveSchema, storeMetricsSchema, summarySplitSchema, userAuditHistorySchema, userMetricsSchema, userSchema, workSpaceSchema, auditImageValidSchema, pendingSummaryTableSchema, overviewTableSchema } from '../dtos/audit.dtos.js';
|
|
1
|
+
import { auditStoreSchema, clientMetricsSchema, clientSchema, getDraftedDataSchema, getFileSchema, overAllAuditSummarySchema, overViewCardSchema, reTriggerValidSchema, saveDraftSchema, saveSchema, storeMetricsSchema, summarySplitSchema, userAuditHistorySchema, userMetricsSchema, userSchema, workSpaceSchema, auditImageValidSchema, pendingSummaryTableSchema, overviewTableSchema, auditViewlogSchema } from '../dtos/audit.dtos.js';
|
|
2
2
|
import j2s from 'joi-to-swagger';
|
|
3
3
|
|
|
4
4
|
export const auditDocs = {
|
|
@@ -544,6 +544,47 @@ export const auditDocs = {
|
|
|
544
544
|
},
|
|
545
545
|
},
|
|
546
546
|
},
|
|
547
|
+
'/v3/audit/audit-view-logs': {
|
|
548
|
+
get: {
|
|
549
|
+
tags: [ 'Audit Mapping' ],
|
|
550
|
+
description: `Get log for a store audit details`,
|
|
551
|
+
operationId: 'audit-view-logs',
|
|
552
|
+
parameters: [
|
|
553
|
+
{
|
|
554
|
+
in: 'query',
|
|
555
|
+
name: 'fileDate',
|
|
556
|
+
scema: j2s( auditViewlogSchema ).swagger,
|
|
557
|
+
require: true,
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
in: 'query',
|
|
561
|
+
name: 'storeId',
|
|
562
|
+
scema: j2s( auditViewlogSchema ).swagger,
|
|
563
|
+
require: true,
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
in: 'query',
|
|
567
|
+
name: 'moduleType',
|
|
568
|
+
scema: j2s( auditViewlogSchema ).swagger,
|
|
569
|
+
require: true,
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
in: 'query',
|
|
573
|
+
name: 'zoneName',
|
|
574
|
+
scema: j2s( auditViewlogSchema ).swagger,
|
|
575
|
+
require: false,
|
|
576
|
+
},
|
|
577
|
+
],
|
|
578
|
+
responses: {
|
|
579
|
+
200: { description: 'Successful' },
|
|
580
|
+
401: { description: 'Unauthorized User' },
|
|
581
|
+
422: { description: 'Field Error' },
|
|
582
|
+
500: { description: 'Server Error' },
|
|
583
|
+
204: { description: 'Not Found' },
|
|
584
|
+
},
|
|
585
|
+
|
|
586
|
+
},
|
|
587
|
+
},
|
|
547
588
|
'/v3/audit/get-user-credit': {
|
|
548
589
|
get: {
|
|
549
590
|
tags: [ 'Audit User Wallet' ],
|
package/src/dtos/audit.dtos.js
CHANGED
|
@@ -239,6 +239,17 @@ export const overviewTableValid = {
|
|
|
239
239
|
body: overviewTableSchema,
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
+
export const auditViewlogSchema = joi.object( {
|
|
243
|
+
fileDate: joi.string().required(),
|
|
244
|
+
storeId: joi.string().required(),
|
|
245
|
+
moduleType: joi.string().required(),
|
|
246
|
+
zoneName: joi.string().optional(),
|
|
247
|
+
} );
|
|
248
|
+
|
|
249
|
+
export const auditViewLogValid = {
|
|
250
|
+
query: auditViewlogSchema,
|
|
251
|
+
};
|
|
252
|
+
|
|
242
253
|
export const overAllAuditSummarySchema = joi.object( {
|
|
243
254
|
fromDate: joi.string().required(),
|
|
244
255
|
toDate: joi.string().required(),
|
|
@@ -2,7 +2,7 @@ import express from 'express';
|
|
|
2
2
|
import { isAuditDocumentExist, isAuditInputFolderExist, isAuditUser, isExistsQueue, validateUserAudit } from '../validation/audit.validation.js';
|
|
3
3
|
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
4
4
|
import { auditImages, auditStoreList, auditUserList, clientMetrics, clients, getAuditFile, getDraftedData, overAllAuditSummary, overViewCard, overviewTable, pendingSummaryTable, reTrigger, save, saveDraft, storeMetrics, summarySplit, totalNotAssignedCount, userAuditHistory, userMetrics, workSpace, getUserAuditCount, getUserAuditCountMTD, auditViewLogs, getUserCredit } from '../controllers/audit.controllers.js';
|
|
5
|
-
import { auditStoreValid, clientMetricsValid, clientValid, getDraftedDataValid, getFileValid, overAllAuditSummaryValid, overViewCardValid, pendingSummaryTableValid, reTriggerValid, saveDraftValid, saveValid, storeMetricsValid, summarySplitValid, userAuditHistoryValid, userMetricsValid, workSpaceValid, auditImageValid, overviewTableValid } from '../dtos/audit.dtos.js';
|
|
5
|
+
import { auditStoreValid, clientMetricsValid, clientValid, getDraftedDataValid, getFileValid, overAllAuditSummaryValid, overViewCardValid, pendingSummaryTableValid, reTriggerValid, saveDraftValid, saveValid, storeMetricsValid, summarySplitValid, userAuditHistoryValid, userMetricsValid, workSpaceValid, auditImageValid, overviewTableValid, auditViewLogValid } from '../dtos/audit.dtos.js';
|
|
6
6
|
|
|
7
7
|
export const auditRouter = express.Router();
|
|
8
8
|
|
|
@@ -42,5 +42,5 @@ auditRouter.get( '/get-user-audit-count', isAllowedSessionHandler, getUserAuditC
|
|
|
42
42
|
auditRouter.get( '/get-user-audit-count-mtd', isAllowedSessionHandler, getUserAuditCountMTD );
|
|
43
43
|
|
|
44
44
|
// audit log
|
|
45
|
-
auditRouter.get( '/audit-view-logs', isAllowedSessionHandler, auditViewLogs );
|
|
45
|
+
auditRouter.get( '/audit-view-logs', isAllowedSessionHandler, validate( auditViewLogValid ), auditViewLogs );
|
|
46
46
|
export default auditRouter;
|