tango-app-api-client 3.6.5-vms.20 → 3.6.5-vms.21

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.6.5-vms.20",
3
+ "version": "3.6.5-vms.21",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2946,12 +2946,76 @@ export async function getrevopconfig( req, res ) {
2946
2946
  export async function updateFDConfig( req, res ) {
2947
2947
  try {
2948
2948
  const inputData = req.body;
2949
+ const { taggingLimitation, ...otherData } = inputData;
2949
2950
  const inputQuery = req.query;
2950
2951
  const query ={
2951
2952
  clientId: inputQuery.clientId,
2952
2953
  };
2954
+ if ( taggingLimitation ) {
2955
+ const newValues = taggingLimitation;
2956
+ const today = new Date().toISOString().split( 'T' )[0];
2957
+ const getUpdateData = await clientModel.updateOne(
2958
+ {
2959
+ 'clientId': inputQuery.clientId,
2960
+ 'footfallDirectoryConfigs.taggingLimitation.effectiveFrom': today,
2961
+ },
2962
+ {
2963
+ $set: {
2964
+ 'footfallDirectoryConfigs.taggingLimitation.$.values': newValues,
2965
+ },
2966
+ },
2967
+ );
2968
+
2969
+ if ( getUpdateData?.matchedCount === 0 ) {
2970
+ await clientModel.updateOne(
2971
+ { clientId: inputQuery.clientId },
2972
+ {
2973
+ $push: {
2974
+ 'footfallDirectoryConfigs.taggingLimitation': {
2975
+ effectiveFrom: today,
2976
+ values: newValues,
2977
+ },
2978
+ },
2979
+ },
2980
+ );
2981
+ }
2982
+ }
2983
+
2953
2984
  // update the footfall directory configuration data
2954
- let result = await updateOneClient( query, { footfallDirectoryConfigs: inputData } );
2985
+ let record = {};
2986
+ if ( otherData?.contactEmail ) {
2987
+ record['footfallDirectoryConfigs.contactEmail'] =otherData?.contactEmail;
2988
+ }
2989
+
2990
+ if ( otherData?.revision ) {
2991
+ record['footfallDirectoryConfigs.revision'] =otherData?.revision;
2992
+ }
2993
+
2994
+ if ( otherData?.allowImageView ) {
2995
+ record['footfallDirectoryConfigs.allowImageView'] =otherData?.allowImageView;
2996
+ }
2997
+
2998
+ if ( otherData?.allowTicketCreation ) {
2999
+ record['footfallDirectoryConfigs.allowTicketCreation'] =otherData?.allowTicketCreation;
3000
+ }
3001
+
3002
+ if ( otherData?.isAutoCloseEnable ) {
3003
+ record['footfallDirectoryConfigs.isAutoCloseEnable'] =otherData?.isAutoCloseEnable;
3004
+ }
3005
+
3006
+ if ( otherData?.autoCloseAccuracy ) {
3007
+ record['footfallDirectoryConfigs.autoCloseAccuracy'] =otherData?.autoCloseAccuracy;
3008
+ }
3009
+
3010
+ if ( otherData?.accuracyBreach ) {
3011
+ record['footfallDirectoryConfigs.accuracyBreach'] =otherData?.accuracyBreach;
3012
+ }
3013
+
3014
+ if ( otherData?.tangoReview ) {
3015
+ record['footfallDirectoryConfigs.tangoReview'] =otherData?.tangoReview;
3016
+ }
3017
+
3018
+ let result = await updateOneClient( query, record );
2955
3019
  if ( result?.acknowledged === true ) {
2956
3020
  return res.sendSuccess( result );
2957
3021
  } else {
@@ -370,6 +370,7 @@ export const updateFDConfigBodySchema = joi.object( {
370
370
  unit: joi.string().required(),
371
371
  key: joi.string().required(),
372
372
  } ) ).optional(),
373
+ contactEmail: joi.string().optional().allow( '' ),
373
374
 
374
375
  } );
375
376