tango-app-api-client 3.3.1-beta.2 → 3.3.1
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-client",
|
|
3
|
-
"version": "3.3.1
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"mongodb": "^6.3.0",
|
|
26
26
|
"nodemon": "^3.0.3",
|
|
27
27
|
"swagger-ui-express": "^5.0.0",
|
|
28
|
-
"tango-api-schema": "^2.1.
|
|
29
|
-
"tango-app-api-middleware": "^3.1.
|
|
28
|
+
"tango-api-schema": "^2.1.58",
|
|
29
|
+
"tango-app-api-middleware": "^3.1.45",
|
|
30
30
|
"winston": "^3.11.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
32
32
|
},
|
|
@@ -2,97 +2,94 @@
|
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import { activityLogValid, auditConfigValid, billingDetailsValid, brandInfoValid, clientCreationValid, clientDetailsValid, documentsValid, domainDetailsValid, featureConfigurationValid, getAssignedClientValid, getAuditConfigValid, postClientCamApprovalValid, signatoryDetailsValid, ticketConfigurationValid, userConfigurationValid } from '../dtos/client.dtos.js';
|
|
4
4
|
import { auditConfiguration, changeStatus, clientCsmAssignAction, clientDetails, create, csmAssignConfirmation, domainDetailsConfiguration, getActivityLogs, getAuditConfiguration, getClients, getCsmUsers, getOpsUsers, updateBillingDetails, updateBrandInfo, updateDocuments, updateFeatureConfiguration, updateSignatoryDetails, updateTicketConfiguration, userConfiguration } from '../controllers/client.controllers.js';
|
|
5
|
-
import {
|
|
5
|
+
import { accessVerification, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
6
6
|
import { clientListValid, detailedClientCountValid } from '../dtos/client.dtos.js';
|
|
7
|
-
import { isclientIdExists, isclientNameExists } from '../validations/client.validations.js';
|
|
7
|
+
import { isclientIdExists, isclientNameExists, roleVerification } from '../validations/client.validations.js';
|
|
8
8
|
import { detailedAllClientCount, detailedClientCount, clientList, clientListV1 } from '../controllers/client.controllers.js';
|
|
9
9
|
|
|
10
10
|
export const clientRouter = express.Router();
|
|
11
11
|
|
|
12
12
|
clientRouter.post( '/create', isAllowedSessionHandler,
|
|
13
|
-
|
|
13
|
+
accessVerification( { userType: [ 'tango' ] } ), roleVerification,
|
|
14
14
|
validate( clientCreationValid ), isclientNameExists, changeStatus, create );
|
|
15
15
|
clientRouter.get( '/get-clients', isAllowedSessionHandler,
|
|
16
|
-
|
|
16
|
+
accessVerification( { userType: [ 'tango' ] } ), getClients );
|
|
17
17
|
clientRouter.get( '/client-details/:id', isAllowedSessionHandler, validate( clientDetailsValid ), clientDetails );
|
|
18
18
|
|
|
19
|
-
clientRouter.put( '/brand-info/:id', isAllowedSessionHandler,
|
|
19
|
+
clientRouter.put( '/brand-info/:id', isAllowedSessionHandler, accessVerification(
|
|
20
20
|
{ userType: [ 'tango', 'client' ], access: [
|
|
21
|
-
{ featureName: '
|
|
21
|
+
{ featureName: 'Global', name: 'Configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
22
22
|
validate( brandInfoValid ), updateBrandInfo );
|
|
23
23
|
|
|
24
|
-
clientRouter.put( '/billing-details/:id', isAllowedSessionHandler,
|
|
24
|
+
clientRouter.put( '/billing-details/:id', isAllowedSessionHandler, accessVerification(
|
|
25
25
|
{ userType: [ 'tango', 'client' ], access: [
|
|
26
|
-
{ featureName: '
|
|
26
|
+
{ featureName: 'Global', name: 'Billing', permissions: [ 'isEdit' ] } ] } ),
|
|
27
27
|
validate( billingDetailsValid ), updateBillingDetails );
|
|
28
28
|
|
|
29
|
-
clientRouter.put( '/signatory-details/:id', isAllowedSessionHandler,
|
|
29
|
+
clientRouter.put( '/signatory-details/:id', isAllowedSessionHandler, accessVerification(
|
|
30
30
|
{ userType: [ 'tango', 'client' ], access: [
|
|
31
|
-
{ featureName: '
|
|
31
|
+
{ featureName: 'Global', name: 'Configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
32
32
|
validate( signatoryDetailsValid ), updateSignatoryDetails );
|
|
33
33
|
|
|
34
|
-
clientRouter.put( '/ticket-configuration/:id', isAllowedSessionHandler,
|
|
34
|
+
clientRouter.put( '/ticket-configuration/:id', isAllowedSessionHandler, accessVerification(
|
|
35
35
|
{ userType: [ 'tango' ], access: [
|
|
36
|
-
{ featureName: '
|
|
36
|
+
{ featureName: 'TangoAdmin', name: 'TicketConfiguration', permissions: [ 'isEdit' ] } ] } ),
|
|
37
37
|
validate( ticketConfigurationValid ), updateTicketConfiguration );
|
|
38
38
|
|
|
39
|
-
clientRouter.put( '/feature-configuration/:id', isAllowedSessionHandler,
|
|
39
|
+
clientRouter.put( '/feature-configuration/:id', isAllowedSessionHandler, accessVerification(
|
|
40
40
|
{ userType: [ 'tango', 'client' ], access: [
|
|
41
|
-
{ featureName: '
|
|
41
|
+
{ featureName: 'Global', name: 'Configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
42
42
|
validate( featureConfigurationValid ), updateFeatureConfiguration );
|
|
43
43
|
|
|
44
|
-
clientRouter.put( '/domain-details/:id', isAllowedSessionHandler,
|
|
44
|
+
clientRouter.put( '/domain-details/:id', isAllowedSessionHandler, accessVerification(
|
|
45
45
|
{ userType: [ 'tango', 'client' ], access: [
|
|
46
|
-
{ featureName: '
|
|
46
|
+
{ featureName: 'Global', name: 'Configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
47
47
|
validate( domainDetailsValid ), domainDetailsConfiguration );
|
|
48
48
|
|
|
49
|
-
clientRouter.put( '/user-configuration/:id', isAllowedSessionHandler,
|
|
49
|
+
clientRouter.put( '/user-configuration/:id', isAllowedSessionHandler, accessVerification(
|
|
50
50
|
{ userType: [ 'tango' ], access: [
|
|
51
|
-
{ featureName: '
|
|
51
|
+
{ featureName: 'TangoAdmin', name: 'TicketConfiguration', permissions: [ 'isEdit' ] } ] } ),
|
|
52
52
|
validate( userConfigurationValid ), userConfiguration );
|
|
53
53
|
|
|
54
|
-
clientRouter.put( '/documents/:id', isAllowedSessionHandler,
|
|
54
|
+
clientRouter.put( '/documents/:id', isAllowedSessionHandler, accessVerification(
|
|
55
55
|
{ userType: [ 'tango', 'client' ], access: [
|
|
56
|
-
{ featureName: '
|
|
56
|
+
{ featureName: 'Global', name: 'Configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
57
57
|
validate( documentsValid ), updateDocuments );
|
|
58
58
|
|
|
59
|
-
clientRouter.get( '/audit-configuration/:id', isAllowedSessionHandler,
|
|
59
|
+
clientRouter.get( '/audit-configuration/:id', isAllowedSessionHandler, accessVerification(
|
|
60
60
|
{ userType: [ 'tango' ], access: [
|
|
61
|
-
{ featureName: '
|
|
61
|
+
{ featureName: 'TangoAdmin', name: 'TicketConfiguration', permissions: [] } ] } ),
|
|
62
62
|
validate( getAuditConfigValid ), getAuditConfiguration );
|
|
63
63
|
|
|
64
|
-
clientRouter.post( '/audit-configuration/:id', isAllowedSessionHandler,
|
|
64
|
+
clientRouter.post( '/audit-configuration/:id', isAllowedSessionHandler, accessVerification(
|
|
65
65
|
{ userType: [ 'tango' ], access: [
|
|
66
|
-
{ featureName: '
|
|
66
|
+
{ featureName: 'TangoAdmin', name: 'TicketConfiguration', permissions: [ 'isEdit' ] } ] } ),
|
|
67
67
|
validate( auditConfigValid ), auditConfiguration );
|
|
68
68
|
|
|
69
|
-
clientRouter.get( '/get-csm-users', isAllowedSessionHandler,
|
|
70
|
-
{ userType: [ 'tango' ]
|
|
71
|
-
{ featureName: 'settings', name: 'configuration', permissions: [ 'isView' ] } ] } ),
|
|
69
|
+
clientRouter.get( '/get-csm-users', isAllowedSessionHandler, accessVerification(
|
|
70
|
+
{ userType: [ 'tango' ] } ),
|
|
72
71
|
getCsmUsers );
|
|
73
72
|
|
|
74
|
-
clientRouter.get( '/get-ops-users', isAllowedSessionHandler,
|
|
75
|
-
{ userType: [ 'tango' ]
|
|
76
|
-
{ featureName: 'settings', name: 'configuration', permissions: [ 'isView' ] } ] } ),
|
|
73
|
+
clientRouter.get( '/get-ops-users', isAllowedSessionHandler, accessVerification(
|
|
74
|
+
{ userType: [ 'tango' ] } ),
|
|
77
75
|
getOpsUsers );
|
|
78
76
|
|
|
79
77
|
clientRouter.get( '/detailed-all-client-count', isAllowedSessionHandler,
|
|
80
|
-
|
|
78
|
+
accessVerification( { userType: [ 'tango' ] } ),
|
|
81
79
|
detailedAllClientCount );
|
|
82
80
|
|
|
83
81
|
clientRouter.post( '/client-list', isAllowedSessionHandler,
|
|
84
|
-
|
|
82
|
+
accessVerification( { userType: [ 'tango' ] } ),
|
|
85
83
|
validate( clientListValid ), clientList );
|
|
86
84
|
clientRouter.post( '/client-list_v1', isAllowedSessionHandler,
|
|
87
|
-
|
|
85
|
+
accessVerification( { userType: [ 'tango' ] } ),
|
|
88
86
|
validate( clientListValid ), clientListV1 );
|
|
89
87
|
clientRouter.get( '/detailed-client-count', isAllowedSessionHandler,
|
|
90
|
-
|
|
88
|
+
accessVerification( { userType: [ 'tango', 'client' ] } ),
|
|
91
89
|
validate( detailedClientCountValid ), isclientIdExists, detailedClientCount );
|
|
92
90
|
|
|
93
|
-
clientRouter.post( '/activity-log', isAllowedSessionHandler,
|
|
94
|
-
{ userType: [ 'tango', 'client' ]
|
|
95
|
-
{ featureName: 'settings', name: 'activityLog', permissions: [ 'isView' ] } ] } ),
|
|
91
|
+
clientRouter.post( '/activity-log', isAllowedSessionHandler, accessVerification(
|
|
92
|
+
{ userType: [ 'tango', 'client' ] } ),
|
|
96
93
|
validate( activityLogValid ), getActivityLogs );
|
|
97
94
|
|
|
98
95
|
clientRouter.get( '/show-csm-assign-confirmation', isAllowedSessionHandler,
|
|
@@ -33,3 +33,17 @@ export async function isclientIdExists( req, res, next ) {
|
|
|
33
33
|
return res.sendError( 'Internal Server Error', 500 );
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
export async function roleVerification( req, res, next ) {
|
|
38
|
+
try {
|
|
39
|
+
if ( [ 'admin', 'superadmin' ].includes( req?.user?.role ) ) {
|
|
40
|
+
return next();
|
|
41
|
+
} else {
|
|
42
|
+
return res.sendError( 'access forbidden', 403 );
|
|
43
|
+
}
|
|
44
|
+
} catch ( error ) {
|
|
45
|
+
logger.error( { error: error, message: req.body, function: 'roleVerification' } );
|
|
46
|
+
return res.sendError( error, 500 );
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|