tango-app-api-client 3.6.4 → 3.6.5-vms.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,11 +1,11 @@
1
1
  {
2
2
  "name": "tango-app-api-client",
3
- "version": "3.6.4",
3
+ "version": "3.6.5-vms.1",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "start": "nodemon --exec \"eslint --fix . && node index.js\"",
8
+ "start": "nodemon --exec \"eslint --fix . && node app.js\"",
9
9
  "build:patch": "node build.js patch && npm publish",
10
10
  "build:minor": "node build.js minor && npm publish",
11
11
  "build:major": "node build.js major && npm publish"
@@ -30,7 +30,7 @@
30
30
  "npm": "^10.9.1",
31
31
  "sharp": "^0.34.3",
32
32
  "swagger-ui-express": "^5.0.0",
33
- "tango-api-schema": "^2.4.12",
33
+ "tango-api-schema": "^2.4.19",
34
34
  "tango-app-api-middleware": "^3.6.0",
35
35
  "winston": "^3.11.0",
36
36
  "winston-daily-rotate-file": "^5.0.0"
@@ -18,6 +18,7 @@ import { countDocumentsClusters, createclusterModel } from '../service/cluster.s
18
18
  import { countDocumentsTeams } from '../service/teams.service.js';
19
19
  import { createauditConfig, updateauditConfig, aggregateAuditconfig } from '../service/auditConfig.service.js';
20
20
  import { findOnerevopConfig, createrevopConfig, updaterevopConfig } from '../service/revopConfig.service.js';
21
+ import clientModel from 'tango-api-schema/schema/client.model.js';
21
22
 
22
23
  export async function create( req, res ) {
23
24
  try {
@@ -2941,3 +2942,94 @@ export async function getrevopconfig( req, res ) {
2941
2942
  }
2942
2943
 
2943
2944
 
2945
+ export async function updateFDConfig( req, res ) {
2946
+ try {
2947
+ const inputData = req.body;
2948
+ const inputQuery = req.query;
2949
+ const query ={
2950
+ clientId: inputQuery.clientId,
2951
+ };
2952
+ // update the footfall directory configuration data
2953
+ let result = await updateOneClient( query, { footfallDirectoryConfigs: inputData } );
2954
+ if ( result?.acknowledged === true ) {
2955
+ return res.sendSuccess( result );
2956
+ } else {
2957
+ return res.sendError( 'no data', 204 );
2958
+ }
2959
+ } catch ( error ) {
2960
+ const err = error?.message || 'Internal Server Error';
2961
+ logger.error( { error: error, message: req.body, function: 'updateFDConfig' } );
2962
+ return res.sendError( err, 500 );
2963
+ }
2964
+ }
2965
+
2966
+ export async function getFDConfig( req, res ) {
2967
+ try {
2968
+ const inputData = req.query;
2969
+ let result = await findOneClient( { clientId: inputData.clientId }, { footfallDirectoryConfigs: 1 } );
2970
+ if ( result===null ) {
2971
+ return res.sendError( 'no data found', 204 );
2972
+ }
2973
+ return res.sendSuccess( result );
2974
+ } catch ( error ) {
2975
+ const err = error.message || 'Internal Server Error';
2976
+ logger.error( { error: error, message: req.query, function: 'getFDConfig' } );
2977
+ return res.sendError( err, 500 );
2978
+ }
2979
+ }
2980
+
2981
+
2982
+ export async function updateTaggingType( req, res ) {
2983
+ try {
2984
+ const inputData = req.body;
2985
+
2986
+ const inputQuery = req.query; // up
2987
+ const types = inputData?.taggingLimitation?.map( ( x ) => x.type );
2988
+ // Step 1: remove existing items with same "type"
2989
+ await clientModel.updateOne(
2990
+ { clientId: inputQuery.clientId },
2991
+ {
2992
+ $pull: {
2993
+ 'footfallDirectoryConfigs.taggingLimitation': {
2994
+ type: { $in: types },
2995
+ },
2996
+ },
2997
+ },
2998
+ );
2999
+
3000
+ // Remove duplicate entries by type
3001
+ const uniqueData = uniqueByType( inputData.taggingLimitation );
3002
+
3003
+ // Step 2: insert fresh new items
3004
+ let result =await clientModel.updateOne(
3005
+ { clientId: inputQuery.clientId },
3006
+ {
3007
+ $addToSet: {
3008
+ 'footfallDirectoryConfigs.taggingLimitation': {
3009
+ $each: uniqueData,
3010
+ },
3011
+ },
3012
+ },
3013
+ );
3014
+
3015
+ if ( result?.acknowledged === true ) {
3016
+ return res.sendSuccess( result );
3017
+ } else {
3018
+ return res.sendError( 'no data', 204 );
3019
+ }
3020
+ } catch ( error ) {
3021
+ const err = error.message || 'Internal Server Error';
3022
+ logger.error( { error: error, message: req.query, function: 'updateTaggingType' } );
3023
+ return res.sendError( err, 500 );
3024
+ }
3025
+ }
3026
+
3027
+ function uniqueByType( arr ) {
3028
+ const seen = new Set();
3029
+ return arr.filter( ( item ) => {
3030
+ if ( seen.has( item.type ) ) return false;
3031
+ seen.add( item.type );
3032
+ return true;
3033
+ } );
3034
+ }
3035
+
@@ -345,3 +345,62 @@ export const revopconfigValid = {
345
345
  export const revopconfiggetValid = {
346
346
  query: revopconfiggetBody,
347
347
  };
348
+
349
+
350
+ export const updateFDConfigBodySchema = joi.object( {
351
+ accuracyBreach: joi.object( {
352
+ ticketCount: joi.number().optional(),
353
+ days: joi.string().optional(),
354
+ accuracy: joi.string().optional(),
355
+ } ).optional(),
356
+ allowTicketCreation: joi.number().optional(),
357
+ isAutoCloseEnable: joi.boolean().optional(),
358
+ autoCloseAccuracy: joi.string().optional(),
359
+ tangoReview: joi.string().optional(),
360
+ revision: joi.array().items( joi.object( {
361
+ actionType: joi.string().required(),
362
+ isChecked: joi.boolean().required(),
363
+ } ) ).optional(),
364
+ taggingLimitation: joi.array().items( joi.object( {
365
+ type: joi.string().required(),
366
+ value: joi.number().required(),
367
+ unit: joi.string().required(),
368
+ } ) ).optional(),
369
+
370
+ } );
371
+
372
+ export const updateFDConfigQuerySchema = joi.object( {
373
+ clientId: joi.string().required(),
374
+ } );
375
+
376
+ export const getFDConfigSchema = joi.object( {
377
+ clientId: joi.string().required(),
378
+ } );
379
+
380
+ export const updateFDConfigValid = {
381
+ body: updateFDConfigBodySchema,
382
+ query: updateFDConfigQuerySchema,
383
+ };
384
+ export const getFDConfigValid = {
385
+ query: getFDConfigSchema,
386
+ };
387
+
388
+ export const updateTaggingTypeSchema = joi.object( {
389
+ clientId: joi.string().required(),
390
+ taggingLimitation: joi.array().items( joi.object( {
391
+ type: joi.string().required(),
392
+ value: joi.number().required(),
393
+ unit: joi.string().required(),
394
+ } ) ).required(),
395
+
396
+ } );
397
+
398
+ export const updateTaggingTypeQuerySchema = joi.object( {
399
+ clientId: joi.string().required(),
400
+ } );
401
+
402
+
403
+ export const updateTaggingTypeValid = {
404
+ body: updateTaggingTypeSchema,
405
+ query: updateTaggingTypeQuerySchema,
406
+ };
@@ -1,7 +1,7 @@
1
1
 
2
2
  import express from 'express';
3
- import { activityLogValid, auditConfigValid, billingDetailsValid, brandInfoValid, clientCreationValid, clientDetailsValid, documentsValid, domainDetailsValid, featureConfigurationValid, getAssignedClientValid, getAuditConfigValid, postClientCamApprovalValid, signatoryDetailsValid, ticketConfigurationValid, userConfigurationValid } from '../dtos/client.dtos.js';
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';
3
+ import { activityLogValid, auditConfigValid, billingDetailsValid, brandInfoValid, clientCreationValid, clientDetailsValid, documentsValid, domainDetailsValid, featureConfigurationValid, getAssignedClientValid, getAuditConfigValid, getFDConfigValid, postClientCamApprovalValid, signatoryDetailsValid, ticketConfigurationValid, updateFDConfigValid, updateTaggingTypeValid, userConfigurationValid } from '../dtos/client.dtos.js';
4
+ import { auditConfiguration, changeStatus, clientCsmAssignAction, clientDetails, create, csmAssignConfirmation, domainDetailsConfiguration, getActivityLogs, getAuditConfiguration, getClients, getCsmUsers, getFDConfig, getOpsUsers, updateBillingDetails, updateBrandInfo, updateDocuments, updateFDConfig, updateFeatureConfiguration, updateSignatoryDetails, updateTaggingType, updateTicketConfiguration, userConfiguration } from '../controllers/client.controllers.js';
5
5
  import { accessVerification, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
6
6
  import { clientListValid, detailedClientCountValid, createAuditConfigValid, AuditConfiglistValid, revopconfigValid, revopconfiggetValid } from '../dtos/client.dtos.js';
7
7
  import { isclientIdExists, isclientNameExists, roleVerification } from '../validations/client.validations.js';
@@ -112,4 +112,8 @@ clientRouter.post( '/revopconfig', isAllowedSessionHandler,
112
112
  clientRouter.get( '/revopconfig', isAllowedSessionHandler,
113
113
  validate( revopconfiggetValid ), getrevopconfig );
114
114
 
115
+ // footfall directory configurations
116
+ clientRouter.put( '/update-footfall-directory-config', isAllowedSessionHandler, validate( updateFDConfigValid ), updateFDConfig );
117
+ clientRouter.get( '/get-footfall-directory-config', isAllowedSessionHandler, validate( getFDConfigValid ), getFDConfig );
118
+ clientRouter.put( '/update-tagging-type/', isAllowedSessionHandler, validate( updateTaggingTypeValid ), updateTaggingType );
115
119
 
@@ -297,3 +297,7 @@ export async function updateOneClient( query, record ) {
297
297
  );
298
298
  }
299
299
 
300
+ export async function updateOneAddToSetClient( query, record ) {
301
+ return clientModel.updateOne( query, { $addToSet: record } );
302
+ }
303
+