tango-app-api-client 3.0.13-dev → 3.0.15-dev

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.0.13-dev",
3
+ "version": "3.0.15-dev",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -23,8 +23,8 @@
23
23
  "lodash": "^4.17.21",
24
24
  "mongodb": "^6.3.0",
25
25
  "nodemon": "^3.0.3",
26
- "tango-api-schema": "^2.0.56",
27
- "tango-app-api-middleware": "^1.0.43-dev",
26
+ "tango-api-schema": "^2.0.62",
27
+ "tango-app-api-middleware": "^1.0.49-dev",
28
28
  "winston": "^3.11.0",
29
29
  "winston-daily-rotate-file": "^5.0.0"
30
30
  },
@@ -2,7 +2,7 @@
2
2
  import express from 'express';
3
3
  import { activityLogValid, auditConfigValid, billingDetailsValid, brandInfoValid, clientCreationValid, clientDetailsValid, documentsValid, domainDetailsValid, featureConfigurationValid, getAuditConfigValid, signatoryDetailsValid, ticketConfigurationValid, userConfigurationValid } from '../dtos/client.dtos.js';
4
4
  import { auditConfiguration, changeStatus, clientDetails, create, domainDetailsConfiguration, getActivityLogs, getAuditConfiguration, getClients, getCsmUsers, getOpsUsers, updateBillingDetails, updateBrandInfo, updateDocuments, updateFeatureConfiguration, updateSignatoryDetails, updateTicketConfiguration, userConfiguration } from '../controllers/client.controllers.js';
5
- import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
5
+ import { authorize, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
6
6
  import { clientListValid, detailedClientCountValid } from '../dtos/client.dtos.js';
7
7
  import { isclientIdExists, isclientNameExists } from '../validations/client.validations.js';
8
8
  import { detailedAllClientCount, detailedClientCount, clientList } from '../controllers/client.controllers.js';
@@ -12,21 +12,47 @@ export const clientRouter = express.Router();
12
12
  clientRouter.post( '/create', isAllowedSessionHandler, validate( clientCreationValid ), isclientNameExists, changeStatus, create );
13
13
  clientRouter.get( '/get-clients', isAllowedSessionHandler, getClients );
14
14
  clientRouter.get( '/client-details/:id', isAllowedSessionHandler, validate( clientDetailsValid ), clientDetails );
15
- clientRouter.put( '/brand-info/:id', isAllowedSessionHandler, validate( brandInfoValid ), updateBrandInfo );
16
- clientRouter.put( '/billing-details/:id', isAllowedSessionHandler, validate( billingDetailsValid ), updateBillingDetails );
17
- clientRouter.put( '/signatory-details/:id', isAllowedSessionHandler, validate( signatoryDetailsValid ), updateSignatoryDetails );
18
- clientRouter.put( '/ticket-configuration/:id', isAllowedSessionHandler, validate( ticketConfigurationValid ), updateTicketConfiguration );
19
- clientRouter.put( '/feature-configuration/:id', isAllowedSessionHandler, validate( featureConfigurationValid ), updateFeatureConfiguration );
20
- clientRouter.put( '/domain-details/:id', isAllowedSessionHandler, validate( domainDetailsValid ), domainDetailsConfiguration );
21
- clientRouter.put( '/user-configuration/:id', isAllowedSessionHandler, validate( userConfigurationValid ), userConfiguration );
22
- clientRouter.put( '/documents/:id', isAllowedSessionHandler, validate( documentsValid ), updateDocuments );
23
- clientRouter.get( '/audit-configuration/:id', isAllowedSessionHandler, validate( getAuditConfigValid ), getAuditConfiguration );
24
- clientRouter.post( '/audit-configuration/:id', isAllowedSessionHandler, validate( auditConfigValid ), auditConfiguration );
25
- clientRouter.get( '/get-csm-users', isAllowedSessionHandler, getCsmUsers );
26
- clientRouter.get( '/get-ops-users', isAllowedSessionHandler, getOpsUsers );
15
+ clientRouter.put( '/brand-info/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango', 'client' ], access: [
16
+ { featureName: 'settings', name: 'brandDetails', permissions: [ 'isEdit' ] },
17
+ ] } ), validate( brandInfoValid ), updateBrandInfo );
18
+ clientRouter.put( '/billing-details/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango', 'client' ], access: [
19
+ { featureName: 'settings', name: 'brandDetails', permissions: [ 'isEdit' ] },
20
+ ] } ), validate( billingDetailsValid ), updateBillingDetails );
21
+ clientRouter.put( '/signatory-details/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango', 'client' ], access: [
22
+ { featureName: 'settings', name: 'brandDetails', permissions: [ 'isEdit' ] },
23
+ ] } ), validate( signatoryDetailsValid ), updateSignatoryDetails );
24
+ clientRouter.put( '/ticket-configuration/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango' ], access: [
25
+ { featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] },
26
+ ] } ), validate( ticketConfigurationValid ), updateTicketConfiguration );
27
+ clientRouter.put( '/feature-configuration/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango' ], access: [
28
+ { featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] },
29
+ ] } ), validate( featureConfigurationValid ), updateFeatureConfiguration );
30
+ clientRouter.put( '/domain-details/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango', 'client' ], access: [
31
+ { featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] },
32
+ ] } ), validate( domainDetailsValid ), domainDetailsConfiguration );
33
+ clientRouter.put( '/user-configuration/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango' ], access: [
34
+ { featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] },
35
+ ] } ), validate( userConfigurationValid ), userConfiguration );
36
+ clientRouter.put( '/documents/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango', 'client' ], access: [
37
+ { featureName: 'settings', name: 'documents', permissions: [ 'isEdit' ] },
38
+ ] } ), validate( documentsValid ), updateDocuments );
39
+ clientRouter.get( '/audit-configuration/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango' ], access: [
40
+ { featureName: 'settings', name: 'configuration', permissions: [ 'isView' ] },
41
+ ] } ), validate( getAuditConfigValid ), getAuditConfiguration );
42
+ clientRouter.post( '/audit-configuration/:id', isAllowedSessionHandler, authorize( { userType: [ 'tango' ], access: [
43
+ { featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] },
44
+ ] } ), validate( auditConfigValid ), auditConfiguration );
45
+ clientRouter.get( '/get-csm-users', isAllowedSessionHandler, authorize( { userType: [ 'tango' ], access: [
46
+ { featureName: 'settings', name: 'configuration', permissions: [ 'isView' ] },
47
+ ] } ), getCsmUsers );
48
+ clientRouter.get( '/get-ops-users', isAllowedSessionHandler, authorize( { userType: [ 'tango' ], access: [
49
+ { featureName: 'settings', name: 'configuration', permissions: [ 'isView' ] },
50
+ ] } ), getOpsUsers );
27
51
  clientRouter.get( '/detailed-all-client-count', isAllowedSessionHandler, detailedAllClientCount );
28
52
  clientRouter.post( '/client-list', isAllowedSessionHandler, validate( clientListValid ), clientList );
29
53
  clientRouter.get( '/detailed-client-count', isAllowedSessionHandler, validate( detailedClientCountValid ), isclientIdExists, detailedClientCount );
30
- clientRouter.post( '/activity-log', isAllowedSessionHandler, validate( activityLogValid ), getActivityLogs );
54
+ clientRouter.post( '/activity-log', isAllowedSessionHandler, authorize( { userType: [ 'tango', 'client' ], access: [
55
+ { featureName: 'settings', name: 'activityLog', permissions: [ 'isView' ] },
56
+ ] } ), validate( activityLogValid ), getActivityLogs );
31
57
 
32
58
 
@@ -50,7 +50,7 @@ export async function createAuditQueue( queueName ) {
50
50
 
51
51
 
52
52
  export function getClientData( { id } ) {
53
- return clientModel.findOne( { clientId: id } );
53
+ return clientModel.findOne( { clientId: id }, { auditConfigs: 0, paymentInvoice: 0, price: 0, priceType: 0, reportConfigs: 0, tangoId: 0, virtualAccount: 0, _id: 0 } );
54
54
  }
55
55
 
56
56
  export function getUserData( { id } ) {
@@ -218,7 +218,14 @@ export function CsmUsersGet( ) {
218
218
  $match: {
219
219
  $and: [
220
220
  {
221
- role: 'admin',
221
+ $or: [
222
+ {
223
+ role: 'superadmin',
224
+ },
225
+ {
226
+ role: 'admin',
227
+ },
228
+ ],
222
229
  },
223
230
  {
224
231
  userType: 'tango',
@@ -245,6 +252,9 @@ export function OpsUsersGet( ) {
245
252
  $and: [
246
253
  {
247
254
  $or: [
255
+ {
256
+ role: 'superadmin',
257
+ },
248
258
  {
249
259
  role: 'user',
250
260
  },