tango-app-api-audit 3.4.1 → 3.4.3-alpha.0
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 +2 -3
- package/src/controllers/audit.controllers.js +716 -130
- package/src/controllers/traxAudit.controllers.js +1275 -701
- package/src/docs/audit.docs.js +29 -1
- package/src/docs/traxAudit.docs.js +41 -13
- package/src/routes/audit.routes.js +5 -1
- package/src/routes/traxAudit.routes.js +8 -2
- package/src/service/auditStoreData.service.js +8 -0
- package/src/service/auditUserWallet.service.js +10 -0
- package/src/service/empDetectionOutput.service.js +5 -0
- package/src/service/storeEmpDetection.service.js +7 -0
- package/src/service/userAudit.service.js +4 -0
- package/src/service/userEmpDetection.service.js +4 -0
package/src/docs/audit.docs.js
CHANGED
|
@@ -528,7 +528,35 @@ export const auditDocs = {
|
|
|
528
528
|
get: {
|
|
529
529
|
tags: [ 'Audit Mapping' ],
|
|
530
530
|
description: 'Get total Not Assigned Count',
|
|
531
|
-
operationId: '
|
|
531
|
+
operationId: 'total-not-assigned-count',
|
|
532
|
+
responses: {
|
|
533
|
+
200: { description: 'Successful' },
|
|
534
|
+
401: { description: 'Unauthorized User' },
|
|
535
|
+
422: { description: 'Field Error' },
|
|
536
|
+
500: { description: 'Server Error' },
|
|
537
|
+
204: { description: 'Not Found' },
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
'/v3/audit/get-user-audit-count': {
|
|
542
|
+
get: {
|
|
543
|
+
tags: [ 'Audit User Wallet' ],
|
|
544
|
+
description: 'Get total Not Assigned Count',
|
|
545
|
+
operationId: 'get-user-audit-count',
|
|
546
|
+
responses: {
|
|
547
|
+
200: { description: 'Successful' },
|
|
548
|
+
401: { description: 'Unauthorized User' },
|
|
549
|
+
422: { description: 'Field Error' },
|
|
550
|
+
500: { description: 'Server Error' },
|
|
551
|
+
204: { description: 'Not Found' },
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
'/v3/audit/get-user-audit-count-mtd': {
|
|
556
|
+
get: {
|
|
557
|
+
tags: [ 'Audit User Wallet' ],
|
|
558
|
+
description: 'Get total Not Assigned Count',
|
|
559
|
+
operationId: 'get-user-audit-count-mtd',
|
|
532
560
|
responses: {
|
|
533
561
|
200: { description: 'Successful' },
|
|
534
562
|
401: { description: 'Unauthorized User' },
|
|
@@ -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, getUpdatedFileSchema } from '../dtos/traxAudit.dtos.js';
|
|
2
|
+
import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema, pendingSummaryTableSchema, overAllAuditSummarySchema, overviewTableSchema, summarySplitSchema, getUpdatedFileSchema, getDetectionFileValid } from '../dtos/traxAudit.dtos.js';
|
|
3
3
|
|
|
4
4
|
export const traxAuditDocs = {
|
|
5
5
|
|
|
@@ -15,18 +15,6 @@ export const traxAuditDocs = {
|
|
|
15
15
|
scema: j2s( getFileSchema ).swagger,
|
|
16
16
|
require: true,
|
|
17
17
|
},
|
|
18
|
-
// {
|
|
19
|
-
// in: 'query',
|
|
20
|
-
// name: 'nextId',
|
|
21
|
-
// scema: j2s( getFileSchema ).swagger,
|
|
22
|
-
// require: false,
|
|
23
|
-
// },
|
|
24
|
-
// {
|
|
25
|
-
// in: 'query',
|
|
26
|
-
// name: 'limit',
|
|
27
|
-
// scema: j2s( getFileSchema ).swagger,
|
|
28
|
-
// require: false,
|
|
29
|
-
// },
|
|
30
18
|
{
|
|
31
19
|
in: 'query',
|
|
32
20
|
name: 'moduleType',
|
|
@@ -43,6 +31,46 @@ export const traxAuditDocs = {
|
|
|
43
31
|
},
|
|
44
32
|
},
|
|
45
33
|
},
|
|
34
|
+
'/v3/trax-audit/get-file-detection': {
|
|
35
|
+
get: {
|
|
36
|
+
tags: [ 'Trax Audit' ],
|
|
37
|
+
description: 'Get a file via queue message',
|
|
38
|
+
operationId: 'get-file-detection',
|
|
39
|
+
parameters: [
|
|
40
|
+
{
|
|
41
|
+
in: 'query',
|
|
42
|
+
name: 'queueName',
|
|
43
|
+
scema: j2s( getDetectionFileValid ).swagger,
|
|
44
|
+
require: true,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
in: 'query',
|
|
48
|
+
name: 'nextId',
|
|
49
|
+
scema: j2s( getDetectionFileValid ).swagger,
|
|
50
|
+
require: false,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
in: 'query',
|
|
54
|
+
name: 'limit',
|
|
55
|
+
scema: j2s( getDetectionFileValid ).swagger,
|
|
56
|
+
require: false,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
in: 'query',
|
|
60
|
+
name: 'moduleType',
|
|
61
|
+
scema: j2s( getDetectionFileValid ).swagger,
|
|
62
|
+
require: true,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
responses: {
|
|
66
|
+
200: { description: 'Successful' },
|
|
67
|
+
401: { description: 'Unauthorized User' },
|
|
68
|
+
422: { description: 'Field Error' },
|
|
69
|
+
500: { description: 'Server Error' },
|
|
70
|
+
204: { description: 'Not Found' },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
46
74
|
'/v3/trax-audit/get-updated-file': {
|
|
47
75
|
post: {
|
|
48
76
|
tags: [ 'Trax Audit' ],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { isAuditDocumentExist, isAuditInputFolderExist, isExistsQueue, validateUserAudit } from '../validation/audit.validation.js';
|
|
3
3
|
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
4
|
-
import { auditImages, auditStoreList, auditUserList, clientMetrics, clients, getAuditFile, getDraftedData, overAllAuditSummary, overViewCard, overviewTable, pendingSummaryTable, reTrigger, save, saveDraft, storeMetrics, summarySplit, totalNotAssignedCount, userAuditHistory, userMetrics, workSpace } from '../controllers/audit.controllers.js';
|
|
4
|
+
import { auditImages, auditStoreList, auditUserList, clientMetrics, clients, getAuditFile, getDraftedData, overAllAuditSummary, overViewCard, overviewTable, pendingSummaryTable, reTrigger, save, saveDraft, storeMetrics, summarySplit, totalNotAssignedCount, userAuditHistory, userMetrics, workSpace, getUserAuditCount, getUserAuditCountMTD } from '../controllers/audit.controllers.js';
|
|
5
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';
|
|
6
6
|
|
|
7
7
|
export const auditRouter = express.Router();
|
|
@@ -35,4 +35,8 @@ auditRouter.post( '/metrics/overview-table', isAllowedSessionHandler, validate(
|
|
|
35
35
|
|
|
36
36
|
// ticket
|
|
37
37
|
auditRouter.get( '/total-not-assigned-count', isAllowedSessionHandler, totalNotAssignedCount );
|
|
38
|
+
|
|
39
|
+
// audit user wallet
|
|
40
|
+
auditRouter.get( '/get-user-audit-count', isAllowedSessionHandler, getUserAuditCount );
|
|
41
|
+
auditRouter.get( '/get-user-audit-count-mtd', isAllowedSessionHandler, getUserAuditCountMTD );
|
|
38
42
|
export default auditRouter;
|
|
@@ -2,14 +2,14 @@ import { Router } from 'express';
|
|
|
2
2
|
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
3
3
|
import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid, summarySplitValid, overviewTableValid, getUpdatedFileValid } from '../dtos/traxAudit.dtos.js';
|
|
4
4
|
import { isExistsQueue } from '../validation/audit.validation.js';
|
|
5
|
-
import { clientMetrics, getAuditFile, getDetectionAuditFile, getUpdatedFile, overAllAuditSummary, overviewTable, pendingSummaryTable, saveBinary, storeMetrics, summarySplit, userAuditHistory, userMetrics, workSpace } from '../controllers/traxAudit.controllers.js';
|
|
5
|
+
import { clientMetrics, getAuditFile, getDetectionAuditFile, getUpdatedFile, overAllAuditSummary, overviewTable, pendingSummaryTable, saveBinary, storeMetrics, summarySplit, userAuditHistory, userMetrics, workSpace, saveDraft, getDraftedData, save } from '../controllers/traxAudit.controllers.js';
|
|
6
6
|
import { isTraxAuditDocumentExist, validateBinaryAudit } from '../validation/traxAuditValidation.js';
|
|
7
7
|
|
|
8
8
|
export const traxAuditRouter = Router();
|
|
9
9
|
|
|
10
10
|
// Audit Mapping
|
|
11
11
|
|
|
12
|
-
traxAuditRouter.get( '/get-file-detection', isAllowedSessionHandler, validate( getDetectionFileValid ), isExistsQueue, getDetectionAuditFile );
|
|
12
|
+
// traxAuditRouter.get( '/get-file-detection', isAllowedSessionHandler, validate( getDetectionFileValid ), isExistsQueue, getDetectionAuditFile );
|
|
13
13
|
// traxAuditRouter.post( '/save-draft', isAllowedSessionHandler, validate( saveDraftValid ), saveDraft );
|
|
14
14
|
// traxAuditRouter.get( '/get-drafted-data', isAllowedSessionHandler, validate( getDraftedDataValid ), getDraftedData );
|
|
15
15
|
// traxAuditRouter.post( '/save', isAllowedSessionHandler, validate( saveValid ), validateUserEmpDetection, save ); use this validateuserEMpDetection
|
|
@@ -34,4 +34,10 @@ traxAuditRouter.post( '/metrics/overall-audit-summary', isAllowedSessionHandler,
|
|
|
34
34
|
traxAuditRouter.post( '/metrics/summary-split-up', isAllowedSessionHandler, validate( summarySplitValid ), summarySplit );
|
|
35
35
|
traxAuditRouter.post( '/metrics/overview-table', isAllowedSessionHandler, validate( overviewTableValid ), overviewTable );
|
|
36
36
|
|
|
37
|
+
|
|
38
|
+
traxAuditRouter.get( '/get-file-detection', isAllowedSessionHandler, validate( getDetectionFileValid ), isExistsQueue, getDetectionAuditFile );
|
|
39
|
+
traxAuditRouter.post( '/save', isAllowedSessionHandler, save );
|
|
40
|
+
traxAuditRouter.post( '/save-draft', isAllowedSessionHandler, saveDraft );
|
|
41
|
+
traxAuditRouter.get( '/get-drafted-data', isAllowedSessionHandler, getDraftedData );
|
|
42
|
+
|
|
37
43
|
export default traxAuditRouter;
|
|
@@ -8,3 +8,11 @@ export function aggregateAuditStoreData( query ) {
|
|
|
8
8
|
export function findOneStoreData( query, fields, sort ) {
|
|
9
9
|
return auditStoreDataModel.findOne( query, fields ).sort( sort );
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
export function findAuditStoreData( query ) {
|
|
13
|
+
return auditStoreDataModel.find( query );
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function countDocumentsAuditStoreDate( query ) {
|
|
17
|
+
return auditStoreDataModel.countDocuments( query );
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import auditUserWalletModel from 'tango-api-schema/schema/auditUserWallet.model.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export function createAuditUserWallet( record ) {
|
|
5
|
+
return auditUserWalletModel.create( record );
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function updateManyAuditUserWallet( query, record ) {
|
|
9
|
+
return auditUserWalletModel.updateMany( query, record, { upsert: true } );
|
|
10
|
+
};
|
|
@@ -4,3 +4,10 @@ import storeEmpDetectionModel from 'tango-api-schema/schema/storeEmpDetection.mo
|
|
|
4
4
|
export function aggregateStoreEmpDetection( query ) {
|
|
5
5
|
return storeEmpDetectionModel.aggregate( query, { collation: { locale: 'en', strength: 2 } } );
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
export function updateOneStoreEmpDetection( query, record ) {
|
|
9
|
+
return storeEmpDetectionModel.updateOne( query, { $set: record } );
|
|
10
|
+
}
|
|
11
|
+
export function updateManyStoreEmpDetection( query, record ) {
|
|
12
|
+
return storeEmpDetectionModel.updateMany( query, { $set: record }, { upsert: true } );
|
|
13
|
+
}
|
|
@@ -12,3 +12,7 @@ export function createUserEmpDetection( record ) {
|
|
|
12
12
|
export function findOneUserEmpDetection( query, fields ) {
|
|
13
13
|
return userEmpDetectionModel.findOne( query, fields );
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
export function updateOneUserEmpDetection( query, record ) {
|
|
17
|
+
return userEmpDetectionModel.updateOne( query, { $set: record } );
|
|
18
|
+
}
|