tango-app-api-audit 3.4.18 → 3.4.19
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-audit",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.19",
|
|
4
4
|
"description": "audit & audit metrics apis",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"mongodb": "^6.7.0",
|
|
25
25
|
"nodemon": "^3.1.3",
|
|
26
26
|
"swagger-ui-express": "^5.0.1",
|
|
27
|
-
"tango-api-schema": "^2.1.
|
|
28
|
-
"tango-app-api-middleware": "^3.1.
|
|
27
|
+
"tango-api-schema": "^2.1.58",
|
|
28
|
+
"tango-app-api-middleware": "^3.1.45",
|
|
29
29
|
"winston": "^3.13.0",
|
|
30
30
|
"winston-daily-rotate-file": "^5.0.0"
|
|
31
31
|
},
|
|
@@ -3917,11 +3917,11 @@ export async function getUserCredit( req, res ) {
|
|
|
3917
3917
|
|
|
3918
3918
|
export async function getUserAuditCount( req, res ) {
|
|
3919
3919
|
try {
|
|
3920
|
-
for ( let i =4; i<
|
|
3920
|
+
for ( let i =4; i<35; i++ ) {
|
|
3921
3921
|
const userWallet = JSON.parse( process.env.USER_WALLET );
|
|
3922
3922
|
const previousDate = dayjs( new Date() ).subtract( i, 'days' );
|
|
3923
3923
|
const fileDate = dayjs( previousDate ).format( 'DD-MM-YYYY' );
|
|
3924
|
-
const configTimeSpentSec = userWallet.minTimeSpentSec; //
|
|
3924
|
+
const configTimeSpentSec = userWallet.minTimeSpentSec; // 25200 seconds / 7 hours;
|
|
3925
3925
|
// const beforeCountX = userWallet.beforeCountCreditPerc; // 0.0335;
|
|
3926
3926
|
// const afterCountY = userWallet.afterCountCreditPerc; // 0.0035;
|
|
3927
3927
|
const reduce = userWallet.reductionPerc; // 0.05;
|
|
@@ -4312,7 +4312,7 @@ export async function getUserAuditCount( req, res ) {
|
|
|
4312
4312
|
if ( result.length == 0 ) {
|
|
4313
4313
|
return res.sendError( 'No Record Inserted', 500 );
|
|
4314
4314
|
}
|
|
4315
|
-
if ( i ==
|
|
4315
|
+
if ( i == 34 ) {
|
|
4316
4316
|
return res.sendSuccess( { message: 'Inserted successfully!' } );
|
|
4317
4317
|
}
|
|
4318
4318
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { isAuditDocumentExist, isAuditInputFolderExist, isAuditUser, isExistsQueue, validateUserAudit } from '../validation/audit.validation.js';
|
|
3
|
-
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
3
|
+
import { accessVerification, 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
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
|
|
|
@@ -8,33 +8,35 @@ export const auditRouter = express.Router();
|
|
|
8
8
|
|
|
9
9
|
// Configuration
|
|
10
10
|
|
|
11
|
-
auditRouter.get( '/clients', isAllowedSessionHandler, validate( clientValid ), clients );
|
|
12
|
-
auditRouter.post( '/audit-stores', isAllowedSessionHandler, validate( auditStoreValid ), auditStoreList );
|
|
13
|
-
auditRouter.get( '/tango-users', isAllowedSessionHandler, auditUserList );
|
|
11
|
+
auditRouter.get( '/clients', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( clientValid ), clients );
|
|
12
|
+
auditRouter.post( '/audit-stores', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( auditStoreValid ), auditStoreList );
|
|
13
|
+
auditRouter.get( '/tango-users', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), auditUserList );
|
|
14
14
|
|
|
15
15
|
// Audit Mapping
|
|
16
|
-
auditRouter.get( '/get-file', isAllowedSessionHandler, validate( getFileValid ), isExistsQueue, getAuditFile );
|
|
17
|
-
auditRouter.post( '/save-draft', isAllowedSessionHandler, validate( saveDraftValid ), saveDraft );
|
|
18
|
-
auditRouter.get( '/get-drafted-data', isAllowedSessionHandler, validate( getDraftedDataValid ), getDraftedData );
|
|
19
|
-
auditRouter.post( '/save', isAllowedSessionHandler, validate( saveValid ), validateUserAudit, save );
|
|
20
|
-
auditRouter.post( '/work-space', isAllowedSessionHandler, validate( workSpaceValid ), workSpace );
|
|
16
|
+
auditRouter.get( '/get-file', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( getFileValid ), isExistsQueue, getAuditFile );
|
|
17
|
+
auditRouter.post( '/save-draft', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( saveDraftValid ), saveDraft );
|
|
18
|
+
auditRouter.get( '/get-drafted-data', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( getDraftedDataValid ), getDraftedData );
|
|
19
|
+
auditRouter.post( '/save', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( saveValid ), validateUserAudit, save );
|
|
20
|
+
auditRouter.post( '/work-space', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( workSpaceValid ), workSpace );
|
|
21
21
|
|
|
22
22
|
// Audit Metrics
|
|
23
|
-
auditRouter.post( '/metrics/user-audit-history', isAllowedSessionHandler, validate( userAuditHistoryValid ), userAuditHistory );
|
|
24
|
-
auditRouter.post( '/metrics/client-metrics', isAllowedSessionHandler, validate( clientMetricsValid ), clientMetrics );
|
|
25
|
-
auditRouter.post( '/metrics/store-metrics', isAllowedSessionHandler, validate( storeMetricsValid ), storeMetrics );
|
|
26
|
-
auditRouter.post( '/metrics/user-metrics', isAllowedSessionHandler, validate( userMetricsValid ), userMetrics );
|
|
27
|
-
auditRouter.post( '/metrics/pending-summary-table', isAllowedSessionHandler, validate( pendingSummaryTableValid ), pendingSummaryTable );
|
|
28
|
-
auditRouter.post( '/metrics/overall-audit-summary', isAllowedSessionHandler, validate( overAllAuditSummaryValid ), overAllAuditSummary );
|
|
29
|
-
auditRouter.post( '/metrics/re-trigger', isAllowedSessionHandler,
|
|
30
|
-
|
|
23
|
+
auditRouter.post( '/metrics/user-audit-history', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( userAuditHistoryValid ), userAuditHistory );
|
|
24
|
+
auditRouter.post( '/metrics/client-metrics', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( clientMetricsValid ), clientMetrics );
|
|
25
|
+
auditRouter.post( '/metrics/store-metrics', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( storeMetricsValid ), storeMetrics );
|
|
26
|
+
auditRouter.post( '/metrics/user-metrics', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( userMetricsValid ), userMetrics );
|
|
27
|
+
auditRouter.post( '/metrics/pending-summary-table', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( pendingSummaryTableValid ), pendingSummaryTable );
|
|
28
|
+
auditRouter.post( '/metrics/overall-audit-summary', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( overAllAuditSummaryValid ), overAllAuditSummary );
|
|
29
|
+
auditRouter.post( '/metrics/re-trigger', isAllowedSessionHandler,
|
|
30
|
+
accessVerification( { userType: [ 'tango' ], access: [ { featureName: 'TangoAdmin', name: 'TicketConfiguration', permissions: [ 'isEdit' ] } ] } ),
|
|
31
|
+
validate( reTriggerValid ), isAuditDocumentExist, isAuditInputFolderExist, reTrigger );
|
|
32
|
+
auditRouter.get( '/audit-images', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( auditImageValid ), isAuditInputFolderExist, auditImages );
|
|
31
33
|
// summary
|
|
32
|
-
auditRouter.post( '/metrics/overview-card', isAllowedSessionHandler, validate( overViewCardValid ), overViewCard );
|
|
33
|
-
auditRouter.post( '/metrics/summary-split-up', isAllowedSessionHandler, validate( summarySplitValid ), summarySplit );
|
|
34
|
-
auditRouter.post( '/metrics/overview-table', isAllowedSessionHandler, validate( overviewTableValid ), overviewTable );
|
|
34
|
+
auditRouter.post( '/metrics/overview-card', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( overViewCardValid ), overViewCard );
|
|
35
|
+
auditRouter.post( '/metrics/summary-split-up', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( summarySplitValid ), summarySplit );
|
|
36
|
+
auditRouter.post( '/metrics/overview-table', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( overviewTableValid ), overviewTable );
|
|
35
37
|
|
|
36
38
|
// ticket
|
|
37
|
-
auditRouter.get( '/total-not-assigned-count', isAllowedSessionHandler, totalNotAssignedCount );
|
|
39
|
+
auditRouter.get( '/total-not-assigned-count', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), totalNotAssignedCount );
|
|
38
40
|
|
|
39
41
|
// audit user wallet
|
|
40
42
|
auditRouter.get( '/get-user-credit', isAllowedSessionHandler, isAuditUser, getUserCredit );
|
|
@@ -42,5 +44,5 @@ auditRouter.get( '/get-user-audit-count', isAllowedSessionHandler, getUserAuditC
|
|
|
42
44
|
auditRouter.get( '/get-user-audit-count-mtd', isAllowedSessionHandler, getUserAuditCountMTD );
|
|
43
45
|
|
|
44
46
|
// audit log
|
|
45
|
-
auditRouter.get( '/audit-view-logs', isAllowedSessionHandler, validate( auditViewLogValid ), auditViewLogs );
|
|
47
|
+
auditRouter.get( '/audit-view-logs', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( auditViewLogValid ), auditViewLogs );
|
|
46
48
|
export default auditRouter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
2
|
+
import { accessVerification, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
3
3
|
import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid, summarySplitValid, overviewTableValid, getUpdatedFileValid, saveBinaryValid, getDraftedDataValid, saveDraftValid, reTriggerValidSchema } from '../dtos/traxAudit.dtos.js';
|
|
4
4
|
import { isExistsQueue } from '../validation/audit.validation.js';
|
|
5
5
|
import { clientMetrics, getAuditFile, getDetectionAuditFile, getUpdatedFile, overAllAuditSummary, overviewTable, pendingSummaryTable, saveBinary, storeMetrics, summarySplit, userAuditHistory, userMetrics, workSpace, saveDraft, getDraftedData, save, reTrigger } from '../controllers/traxAudit.controllers.js';
|
|
@@ -9,30 +9,32 @@ export const traxAuditRouter = Router();
|
|
|
9
9
|
|
|
10
10
|
// Audit Mapping
|
|
11
11
|
|
|
12
|
-
traxAuditRouter.get( '/get-file-detection', isAllowedSessionHandler, validate( getDetectionFileValid ), isExistsQueue, getDetectionAuditFile );
|
|
13
|
-
traxAuditRouter.post( '/save', validate( saveValid ), isAllowedSessionHandler, validateUserEmpDetection, save );
|
|
14
|
-
traxAuditRouter.post( '/save-draft', validate( saveDraftValid ), isAllowedSessionHandler, saveDraft );
|
|
15
|
-
traxAuditRouter.get( '/get-drafted-data', validate( getDraftedDataValid ), isAllowedSessionHandler, getDraftedData );
|
|
12
|
+
traxAuditRouter.get( '/get-file-detection', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( getDetectionFileValid ), isExistsQueue, getDetectionAuditFile );
|
|
13
|
+
traxAuditRouter.post( '/save', validate( saveValid ), isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validateUserEmpDetection, save );
|
|
14
|
+
traxAuditRouter.post( '/save-draft', validate( saveDraftValid ), isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), saveDraft );
|
|
15
|
+
traxAuditRouter.get( '/get-drafted-data', validate( getDraftedDataValid ), isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), getDraftedData );
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
// Y/n
|
|
19
|
-
traxAuditRouter.get( '/get-file', isAllowedSessionHandler, validate( getFileValid ), isExistsQueue, getAuditFile );
|
|
20
|
-
traxAuditRouter.post( '/get-updated-file', isAllowedSessionHandler, validate( getUpdatedFileValid ), isTraxAuditDocumentExist, getUpdatedFile );
|
|
19
|
+
traxAuditRouter.get( '/get-file', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( getFileValid ), isExistsQueue, getAuditFile );
|
|
20
|
+
traxAuditRouter.post( '/get-updated-file', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( getUpdatedFileValid ), isTraxAuditDocumentExist, getUpdatedFile );
|
|
21
21
|
traxAuditRouter.post( '/save-binary-audit', isAllowedSessionHandler, validate( saveBinaryValid ), validateBinaryAudit, saveBinary );
|
|
22
22
|
|
|
23
23
|
// metrcis
|
|
24
|
-
traxAuditRouter.post( '/work-space', isAllowedSessionHandler, validate( workSpaceValid ), workSpace );
|
|
25
|
-
traxAuditRouter.post( '/metrics/user-audit-history', isAllowedSessionHandler, validate( userAuditHistoryValid ), userAuditHistory );
|
|
26
|
-
traxAuditRouter.post( '/metrics/client-metrics', isAllowedSessionHandler, validate( clientMetricsValid ), clientMetrics );
|
|
27
|
-
traxAuditRouter.post( '/metrics/store-metrics', isAllowedSessionHandler, validate( storeMetricsValid ), storeMetrics );
|
|
28
|
-
traxAuditRouter.post( '/metrics/user-metrics', isAllowedSessionHandler, validate( userMetricsValid ), userMetrics );
|
|
29
|
-
traxAuditRouter.post( '/metrics/pending-summary-table', isAllowedSessionHandler, validate( pendingSummaryTableValid ), pendingSummaryTable );
|
|
30
|
-
traxAuditRouter.post( '/metrics/overall-audit-summary', isAllowedSessionHandler, validate( overAllAuditSummaryValid ), overAllAuditSummary );
|
|
31
|
-
traxAuditRouter.post( '/metrics/re-trigger', isAllowedSessionHandler,
|
|
24
|
+
traxAuditRouter.post( '/work-space', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( workSpaceValid ), workSpace );
|
|
25
|
+
traxAuditRouter.post( '/metrics/user-audit-history', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( userAuditHistoryValid ), userAuditHistory );
|
|
26
|
+
traxAuditRouter.post( '/metrics/client-metrics', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( clientMetricsValid ), clientMetrics );
|
|
27
|
+
traxAuditRouter.post( '/metrics/store-metrics', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( storeMetricsValid ), storeMetrics );
|
|
28
|
+
traxAuditRouter.post( '/metrics/user-metrics', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( userMetricsValid ), userMetrics );
|
|
29
|
+
traxAuditRouter.post( '/metrics/pending-summary-table', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( pendingSummaryTableValid ), pendingSummaryTable );
|
|
30
|
+
traxAuditRouter.post( '/metrics/overall-audit-summary', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( overAllAuditSummaryValid ), overAllAuditSummary );
|
|
31
|
+
traxAuditRouter.post( '/metrics/re-trigger', isAllowedSessionHandler,
|
|
32
|
+
accessVerification( { userType: [ 'tango' ], access: [ { featureName: 'TangoAdmin', name: 'TicketConfiguration', permissions: [ 'isEdit' ] } ] } ),
|
|
33
|
+
validate( reTriggerValidSchema ), isuserEmpDocumentExist, isMappingAuditInputFolderExist, reTrigger );
|
|
32
34
|
|
|
33
35
|
// summary
|
|
34
36
|
|
|
35
|
-
traxAuditRouter.post( '/metrics/summary-split-up', isAllowedSessionHandler, validate( summarySplitValid ), summarySplit );
|
|
36
|
-
traxAuditRouter.post( '/metrics/overview-table', isAllowedSessionHandler, validate( overviewTableValid ), overviewTable );
|
|
37
|
+
traxAuditRouter.post( '/metrics/summary-split-up', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( summarySplitValid ), summarySplit );
|
|
38
|
+
traxAuditRouter.post( '/metrics/overview-table', isAllowedSessionHandler, accessVerification( { userType: [ 'tango' ] } ), validate( overviewTableValid ), overviewTable );
|
|
37
39
|
|
|
38
40
|
export default traxAuditRouter;
|