tango-app-api-client 3.4.0-beta.1 → 3.4.0-beta.11
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 +3 -3
- package/src/controllers/client.controllers.js +447 -351
- package/src/dtos/client.dtos.js +43 -2
- package/src/hbs/approved-client.hbs +170 -170
- package/src/routes/client.routes.js +16 -2
- package/src/service/auditConfig.service.js +13 -0
- package/src/service/client.service.js +1 -0
- package/src/service/revopConfig.service.js +16 -0
|
@@ -10,16 +10,18 @@ import { aggregateTickets } from '../service/tangoticket.service.js';
|
|
|
10
10
|
import { join } from 'path';
|
|
11
11
|
import { readFileSync } from 'fs';
|
|
12
12
|
import handlebars from 'handlebars';
|
|
13
|
-
import { countDocumentsGroup, createGroupModel
|
|
13
|
+
import { countDocumentsGroup, createGroupModel } from '../service/group.service.js';
|
|
14
14
|
// import { deleteOneAuthentication } from '../service/authentication.service.js';
|
|
15
15
|
import { createBilling } from '../service/billing.service.js';
|
|
16
16
|
import { createPaymentAccount } from '../service/paymentAccount.service.js';
|
|
17
17
|
import { countDocumentsClusters, createclusterModel } from '../service/cluster.service.js';
|
|
18
18
|
import { countDocumentsTeams } from '../service/teams.service.js';
|
|
19
|
+
import { createauditConfig, updateauditConfig, aggregateAuditconfig } from '../service/auditConfig.service.js';
|
|
20
|
+
import { findOnerevopConfig, createrevopConfig, updaterevopConfig } from '../service/revopConfig.service.js';
|
|
19
21
|
|
|
20
22
|
export async function create( req, res ) {
|
|
21
23
|
try {
|
|
22
|
-
const url = JSON.parse( process.env.URL );
|
|
24
|
+
// const url = JSON.parse( process.env.URL );
|
|
23
25
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
24
26
|
const inputData = req.body;
|
|
25
27
|
const countQuery = [
|
|
@@ -96,7 +98,7 @@ export async function create( req, res ) {
|
|
|
96
98
|
record.featureConfigs.isNewZone = true;
|
|
97
99
|
}
|
|
98
100
|
if ( data.productName === 'tangoTrax' ) {
|
|
99
|
-
record.featureConfigs.
|
|
101
|
+
record.featureConfigs.isTrax = true;
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
}
|
|
@@ -178,125 +180,118 @@ export async function create( req, res ) {
|
|
|
178
180
|
|
|
179
181
|
await createBilling( primaryBillingGroup );
|
|
180
182
|
|
|
181
|
-
const createdGroup = await findOneGroup( { clientId: insertedClientRecord.clientId, isDefault: true }, {} );
|
|
182
|
-
|
|
183
|
-
let oldGroup = {
|
|
184
|
-
'_id': createdGroup._id,
|
|
185
|
-
'client_id': createdGroup.clientId,
|
|
186
|
-
'groupName': createdGroup.groupName,
|
|
187
|
-
'description': createdGroup.description,
|
|
188
|
-
'storeList': createdGroup.storeList,
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
await postApi( `${url.oldapidomain}/oldGroupAdd`, [ oldGroup ] );
|
|
193
|
-
|
|
194
183
|
// For old dashboard insert
|
|
184
|
+
// const createdGroup = await findOneGroup( { clientId: insertedClientRecord.clientId, isDefault: true }, {} );
|
|
185
|
+
// let oldGroup = {
|
|
186
|
+
// '_id': createdGroup._id,
|
|
187
|
+
// 'client_id': createdGroup.clientId,
|
|
188
|
+
// 'groupName': createdGroup.groupName,
|
|
189
|
+
// 'description': createdGroup.description,
|
|
190
|
+
// 'storeList': createdGroup.storeList,
|
|
191
|
+
// };
|
|
192
|
+
// await postApi( `${url.oldapidomain}/oldGroupAdd`, [ oldGroup ] );
|
|
193
|
+
|
|
194
|
+
// const oldBrandInsertData = {
|
|
195
|
+
// '_id': insertedClientRecord._id,
|
|
196
|
+
// 'brandName': insertedClientRecord.clientName,
|
|
197
|
+
// 'brandIndex': insertedClientRecord.tangoId,
|
|
198
|
+
// 'client_id': insertedClientRecord.clientId,
|
|
199
|
+
// 'phone': user.mobileNumber,
|
|
200
|
+
// 'email': user.email,
|
|
201
|
+
// 'dialCode': user.countryCode,
|
|
202
|
+
// 'name': user.userName,
|
|
203
|
+
// 'cameraCount': insertedClientRecord.planDetails.totalCamera,
|
|
204
|
+
// 'apiKey': insertedClientRecord.clientApi.apiKey,
|
|
205
|
+
// 'clientStatus': insertedClientRecord.status,
|
|
206
|
+
// 'client_type': insertedClientRecord.planDetails.paymentStatus,
|
|
207
|
+
// 'activeMenu': [
|
|
208
|
+
// 'reports',
|
|
209
|
+
// 'birdsEye',
|
|
210
|
+
// 'tangoZone',
|
|
211
|
+
// 'tangoTraffic',
|
|
212
|
+
// 'support',
|
|
213
|
+
// ],
|
|
214
|
+
// 'planType': insertedClientRecord.planDetails.subscriptionPeriod,
|
|
215
|
+
// 'storeCount': insertedClientRecord.planDetails.totalStores,
|
|
216
|
+
// 'squareFeet': insertedClientRecord.planDetails.storeSize,
|
|
217
|
+
// 'subscription': insertedClientRecord.planDetails.subscriptionType,
|
|
218
|
+
// 'subscription_status': true,
|
|
219
|
+
// 'subscribed_features': {
|
|
220
|
+
// 'tango_traffic': false,
|
|
221
|
+
// 'tango_zone': false,
|
|
222
|
+
// 'tango_revop': false,
|
|
223
|
+
// 'tango_storeops': false,
|
|
224
|
+
// 'controlroom': false,
|
|
225
|
+
// 'live_data': false,
|
|
226
|
+
// 'normalization_features': false,
|
|
227
|
+
// 'actual_features': false,
|
|
228
|
+
// },
|
|
229
|
+
// 'store_added_status': true,
|
|
230
|
+
// 'terms_conditions': true,
|
|
231
|
+
// 'otp_verified': true,
|
|
232
|
+
// 'price': 6510,
|
|
233
|
+
// 'currency_type': 'rupees',
|
|
234
|
+
// 'domains': [],
|
|
235
|
+
// 'store_radius_config': 500,
|
|
236
|
+
// };
|
|
237
|
+
|
|
238
|
+
// insertedClientRecord.planDetails.product.forEach( ( element ) => {
|
|
239
|
+
// if ( element.productName === 'tangoTraffic' ) {
|
|
240
|
+
// oldBrandInsertData.subscribed_features.tango_traffic = true;
|
|
241
|
+
// }
|
|
242
|
+
// if ( element.productName === 'tangoZone' ) {
|
|
243
|
+
// oldBrandInsertData.subscribed_features.tango_zone = true;
|
|
244
|
+
// }
|
|
245
|
+
// if ( element.productName === 'prioritySupport' ) {
|
|
246
|
+
// oldBrandInsertData.subscribed_features.tango_storeops = true;
|
|
247
|
+
// }
|
|
248
|
+
// } );
|
|
249
|
+
|
|
250
|
+
// switch ( insertedClientRecord.status ) {
|
|
251
|
+
// case 'active':
|
|
252
|
+
// oldBrandInsertData.clientStatus = 'live';
|
|
253
|
+
// break;
|
|
254
|
+
// case 'hold':
|
|
255
|
+
// oldBrandInsertData.clientStatus = 'hold';
|
|
256
|
+
// break;
|
|
257
|
+
// case 'suspended':
|
|
258
|
+
// oldBrandInsertData.clientStatus = 'suspended';
|
|
259
|
+
// break;
|
|
260
|
+
// case 'deactive':
|
|
261
|
+
// oldBrandInsertData.clientStatus = 'deactivated';
|
|
262
|
+
// break;
|
|
263
|
+
// default:
|
|
264
|
+
// oldBrandInsertData.clientStatus = 'live';
|
|
265
|
+
// }
|
|
266
|
+
|
|
267
|
+
// switch ( insertedClientRecord.planDetails.paymentStatus ) {
|
|
268
|
+
// case 'free':
|
|
269
|
+
// oldBrandInsertData.client_type = 'free';
|
|
270
|
+
// break;
|
|
271
|
+
// case 'trial':
|
|
272
|
+
// oldBrandInsertData.client_type = 'trial';
|
|
273
|
+
// break;
|
|
274
|
+
// case 'paid':
|
|
275
|
+
// oldBrandInsertData.client_type = 'paid';
|
|
276
|
+
// break;
|
|
277
|
+
// default:
|
|
278
|
+
// oldBrandInsertData.client_type = 'trial';
|
|
279
|
+
// }
|
|
280
|
+
// await postApi( `${url.oldapidomain}/oldBrandAdd`, oldBrandInsertData );
|
|
281
|
+
|
|
282
|
+
// const oldDefaultRolesInsertData = {
|
|
283
|
+
// '_id': user._id,
|
|
284
|
+
// 'client_id': insertedClientRecord.clientId,
|
|
285
|
+
// 'brandId': insertedClientRecord._id,
|
|
286
|
+
// 'name': user.userName,
|
|
287
|
+
// 'email': user.email,
|
|
288
|
+
// 'phone': user.mobileNumber,
|
|
289
|
+
// 'password': user.password,
|
|
290
|
+
// 'role': 'storesuperadmin',
|
|
291
|
+
// };
|
|
292
|
+
// await postApi( `${url.oldapidomain}/oldDefaultRoleInsert`, oldDefaultRolesInsertData );
|
|
195
293
|
|
|
196
294
|
|
|
197
|
-
const oldBrandInsertData = {
|
|
198
|
-
'_id': insertedClientRecord._id,
|
|
199
|
-
'brandName': insertedClientRecord.clientName,
|
|
200
|
-
'brandIndex': insertedClientRecord.tangoId,
|
|
201
|
-
'client_id': insertedClientRecord.clientId,
|
|
202
|
-
'phone': user.mobileNumber,
|
|
203
|
-
'email': user.email,
|
|
204
|
-
'dialCode': user.countryCode,
|
|
205
|
-
'name': user.userName,
|
|
206
|
-
'cameraCount': insertedClientRecord.planDetails.totalCamera,
|
|
207
|
-
'apiKey': insertedClientRecord.clientApi.apiKey,
|
|
208
|
-
'clientStatus': insertedClientRecord.status,
|
|
209
|
-
'client_type': insertedClientRecord.planDetails.paymentStatus,
|
|
210
|
-
'activeMenu': [
|
|
211
|
-
'reports',
|
|
212
|
-
'birdsEye',
|
|
213
|
-
'tangoZone',
|
|
214
|
-
'tangoTraffic',
|
|
215
|
-
'support',
|
|
216
|
-
],
|
|
217
|
-
'planType': insertedClientRecord.planDetails.subscriptionPeriod,
|
|
218
|
-
'storeCount': insertedClientRecord.planDetails.totalStores,
|
|
219
|
-
'squareFeet': insertedClientRecord.planDetails.storeSize,
|
|
220
|
-
'subscription': insertedClientRecord.planDetails.subscriptionType,
|
|
221
|
-
'subscription_status': true,
|
|
222
|
-
'subscribed_features': {
|
|
223
|
-
'tango_traffic': false,
|
|
224
|
-
'tango_zone': false,
|
|
225
|
-
'tango_revop': false,
|
|
226
|
-
'tango_storeops': false,
|
|
227
|
-
'controlroom': false,
|
|
228
|
-
'live_data': false,
|
|
229
|
-
'normalization_features': false,
|
|
230
|
-
'actual_features': false,
|
|
231
|
-
},
|
|
232
|
-
'store_added_status': true,
|
|
233
|
-
'terms_conditions': true,
|
|
234
|
-
'otp_verified': true,
|
|
235
|
-
'price': 6510,
|
|
236
|
-
'currency_type': 'rupees',
|
|
237
|
-
'domains': [],
|
|
238
|
-
'store_radius_config': 500,
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
insertedClientRecord.planDetails.product.forEach( ( element ) => {
|
|
242
|
-
if ( element.productName === 'tangoTraffic' ) {
|
|
243
|
-
oldBrandInsertData.subscribed_features.tango_traffic = true;
|
|
244
|
-
}
|
|
245
|
-
if ( element.productName === 'tangoZone' ) {
|
|
246
|
-
oldBrandInsertData.subscribed_features.tango_zone = true;
|
|
247
|
-
}
|
|
248
|
-
if ( element.productName === 'prioritySupport' ) {
|
|
249
|
-
oldBrandInsertData.subscribed_features.tango_storeops = true;
|
|
250
|
-
}
|
|
251
|
-
} );
|
|
252
|
-
|
|
253
|
-
switch ( insertedClientRecord.status ) {
|
|
254
|
-
case 'active':
|
|
255
|
-
oldBrandInsertData.clientStatus = 'live';
|
|
256
|
-
break;
|
|
257
|
-
case 'hold':
|
|
258
|
-
oldBrandInsertData.clientStatus = 'hold';
|
|
259
|
-
break;
|
|
260
|
-
case 'suspended':
|
|
261
|
-
oldBrandInsertData.clientStatus = 'suspended';
|
|
262
|
-
break;
|
|
263
|
-
case 'deactive':
|
|
264
|
-
oldBrandInsertData.clientStatus = 'deactivated';
|
|
265
|
-
break;
|
|
266
|
-
default:
|
|
267
|
-
oldBrandInsertData.clientStatus = 'live';
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
switch ( insertedClientRecord.planDetails.paymentStatus ) {
|
|
271
|
-
case 'free':
|
|
272
|
-
oldBrandInsertData.client_type = 'free';
|
|
273
|
-
break;
|
|
274
|
-
case 'trial':
|
|
275
|
-
oldBrandInsertData.client_type = 'trial';
|
|
276
|
-
break;
|
|
277
|
-
case 'paid':
|
|
278
|
-
oldBrandInsertData.client_type = 'paid';
|
|
279
|
-
break;
|
|
280
|
-
default:
|
|
281
|
-
oldBrandInsertData.client_type = 'trial';
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const oldDefaultRolesInsertData = {
|
|
286
|
-
'_id': user._id,
|
|
287
|
-
'client_id': insertedClientRecord.clientId,
|
|
288
|
-
'brandId': insertedClientRecord._id,
|
|
289
|
-
'name': user.userName,
|
|
290
|
-
'email': user.email,
|
|
291
|
-
'phone': user.mobileNumber,
|
|
292
|
-
'password': user.password,
|
|
293
|
-
'role': 'storesuperadmin',
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
await postApi( `${url.oldapidomain}/oldBrandAdd`, oldBrandInsertData );
|
|
297
|
-
|
|
298
|
-
await postApi( `${url.oldapidomain}/oldDefaultRoleInsert`, oldDefaultRolesInsertData );
|
|
299
|
-
|
|
300
295
|
const logObj = {
|
|
301
296
|
clientId: insertedClientRecord.clientId,
|
|
302
297
|
userName: req.user?.userName,
|
|
@@ -678,7 +673,7 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
678
673
|
if ( result.length == 0 ) {
|
|
679
674
|
return res.sendError( 'No Data Found', 204 );
|
|
680
675
|
}
|
|
681
|
-
result[0].activeStoresCount = activeStores.length>0?Math.abs( activeStores.length - yettoInstallCount.length ):0;
|
|
676
|
+
result[0].activeStoresCount = activeStores.length > 0 ? Math.abs( activeStores.length - yettoInstallCount.length ) : 0;
|
|
682
677
|
result[0].activeCameraCount = activeCameras;
|
|
683
678
|
return res.sendSuccess( { result: result } );
|
|
684
679
|
} catch ( error ) {
|
|
@@ -697,7 +692,7 @@ export async function updateBrandInfo( req, res ) {
|
|
|
697
692
|
try {
|
|
698
693
|
const bucket = JSON.parse( process.env.BUCKET );
|
|
699
694
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
700
|
-
const url = JSON.parse( process.env.URL );
|
|
695
|
+
// const url = JSON.parse( process.env.URL );
|
|
701
696
|
let updateKeys = [];
|
|
702
697
|
|
|
703
698
|
if ( req.files?.logo ) {
|
|
@@ -769,7 +764,7 @@ export async function updateBrandInfo( req, res ) {
|
|
|
769
764
|
};
|
|
770
765
|
|
|
771
766
|
// Map and rename keys from current client info for UI display and logging
|
|
772
|
-
const newData ={
|
|
767
|
+
const newData = {
|
|
773
768
|
RegisteredCompanyName: getPosCientInfo?.profileDetails?.registeredCompanyName,
|
|
774
769
|
IndustryType: getPosCientInfo?.profileDetails?.industry,
|
|
775
770
|
FirmType: getPosCientInfo?.profileDetails?.clientType,
|
|
@@ -824,26 +819,24 @@ export async function updateBrandInfo( req, res ) {
|
|
|
824
819
|
await updateManyUser( { clientId: req.params?.id }, { isActive: false } );
|
|
825
820
|
}
|
|
826
821
|
|
|
827
|
-
const { data } = await getApi( `${url.oldapidomain}/oldBrandGet/${req.params?.id}` );
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
await postApi( `${url.oldapidomain}/oldBrandUpdate/${data?._id}`, { clientStatus: data.clientStatus } );
|
|
822
|
+
// const { data } = await getApi( `${url.oldapidomain}/oldBrandGet/${req.params?.id}` );
|
|
823
|
+
// switch ( req.body?.status ) {
|
|
824
|
+
// case 'active':
|
|
825
|
+
// data.clientStatus = 'live';
|
|
826
|
+
// break;
|
|
827
|
+
// case 'hold':
|
|
828
|
+
// data.clientStatus = 'hold';
|
|
829
|
+
// break;
|
|
830
|
+
// case 'suspended':
|
|
831
|
+
// data.clientStatus = 'suspended';
|
|
832
|
+
// break;
|
|
833
|
+
// case 'deactive':
|
|
834
|
+
// data.clientStatus = 'deactivated';
|
|
835
|
+
// break;
|
|
836
|
+
// default:
|
|
837
|
+
// data.clientStatus = 'live';
|
|
838
|
+
// }
|
|
839
|
+
// await postApi( `${url.oldapidomain}/oldBrandUpdate/${data?._id}`, { clientStatus: data.clientStatus } );
|
|
847
840
|
|
|
848
841
|
if ( updateAck ) {
|
|
849
842
|
return res.sendSuccess( { result: 'Updated Successfully' } );
|
|
@@ -955,7 +948,7 @@ export async function updateSignatoryDetails( req, res ) {
|
|
|
955
948
|
export async function updateTicketConfiguration( req, res ) {
|
|
956
949
|
try {
|
|
957
950
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
958
|
-
const fields ={
|
|
951
|
+
const fields = {
|
|
959
952
|
'ticketConfigs.downTimeType': 1,
|
|
960
953
|
'ticketConfigs.installationReAssign': 1,
|
|
961
954
|
'ticketConfigs.infraDownTime': 1,
|
|
@@ -996,7 +989,7 @@ export async function updateTicketConfiguration( req, res ) {
|
|
|
996
989
|
|
|
997
990
|
// Map and rename keys from previous client info for UI display and logging
|
|
998
991
|
const oldData = {
|
|
999
|
-
InfraDowntimeType: findClient?.ticketConfigs?.downTimeType,
|
|
992
|
+
InfraDowntimeType: findClient?.ticketConfigs?.downTimeType == 0 ? 'Single Camera' : 'All Cameras',
|
|
1000
993
|
AutoReAssignInstallation: findClient?.ticketConfigs?.installationReAssign,
|
|
1001
994
|
InfraDowntime: findClient?.ticketConfigs?.infraDownTime,
|
|
1002
995
|
InfraFiles: findClient?.ticketConfigs?.MinFilesCount,
|
|
@@ -1008,8 +1001,8 @@ export async function updateTicketConfiguration( req, res ) {
|
|
|
1008
1001
|
};
|
|
1009
1002
|
|
|
1010
1003
|
// Map and rename keys from current client info for UI display and logging
|
|
1011
|
-
const newData ={
|
|
1012
|
-
InfraDowntimeType: updatedClient?.ticketConfigs?.downTimeType,
|
|
1004
|
+
const newData = {
|
|
1005
|
+
InfraDowntimeType: updatedClient?.ticketConfigs?.downTimeType == 0 ? 'Single Camera' : 'All Cameras',
|
|
1013
1006
|
AutoReAssignInstallation: updatedClient?.ticketConfigs?.installationReAssign,
|
|
1014
1007
|
InfraDowntime: updatedClient?.ticketConfigs?.infraDownTime,
|
|
1015
1008
|
InfraFiles: updatedClient?.ticketConfigs?.MinFilesCount,
|
|
@@ -1056,7 +1049,7 @@ export async function updateTicketConfiguration( req, res ) {
|
|
|
1056
1049
|
export async function updateFeatureConfiguration( req, res ) {
|
|
1057
1050
|
try {
|
|
1058
1051
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
1059
|
-
const url = JSON.parse( process.env.URL );
|
|
1052
|
+
// const url = JSON.parse( process.env.URL );
|
|
1060
1053
|
|
|
1061
1054
|
// Get updated client Feature configuration before the update operation (fetch selected fields only)
|
|
1062
1055
|
const previousData = await findOneClient( { clientId: req.params?.id }, { featureConfigs: 1 } );
|
|
@@ -1068,6 +1061,7 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
1068
1061
|
if ( inputData?.conversionValue ) {
|
|
1069
1062
|
inputData.missedOpportunityToValue = inputData?.conversionValue;
|
|
1070
1063
|
}
|
|
1064
|
+
|
|
1071
1065
|
const updateAck = await featureConfigurationUpdate( { clientId: req.params?.id }, inputData );
|
|
1072
1066
|
|
|
1073
1067
|
// Get updated client Feature configuration after the update operation (fetch selected fields only)
|
|
@@ -1077,56 +1071,47 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
1077
1071
|
// Check if request body has any fields to update
|
|
1078
1072
|
if ( Object.keys( inputData ).length > 0 ) {
|
|
1079
1073
|
Object.keys( inputData ).forEach( ( element ) => {
|
|
1080
|
-
element === 'billableCalculation'? 'potentialCalculation': element; // Replace 'billableCalculation' with 'potentialCalculation' if present
|
|
1074
|
+
element === 'billableCalculation' ? 'potentialCalculation' : element; // Replace 'billableCalculation' with 'potentialCalculation' if present
|
|
1081
1075
|
updateKeys.push( camelCaseToWords( element ) ); // Convert camelCase field name to readable format and add to updateKeys
|
|
1082
1076
|
} );
|
|
1083
1077
|
}
|
|
1084
1078
|
|
|
1085
1079
|
const user = req.user;
|
|
1086
1080
|
|
|
1087
|
-
const { data } = await getApi( `${url.oldapidomain}/oldBrandGet/${req.params?.id}` );
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
if ( inputData?.
|
|
1098
|
-
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1081
|
+
// const { data } = await getApi( `${url.oldapidomain}/oldBrandGet/${req.params?.id}` );
|
|
1082
|
+
// if ( inputData?.open ) {
|
|
1083
|
+
// data.brandConfigs.storeOpenTime = inputData?.open;
|
|
1084
|
+
// }
|
|
1085
|
+
// if ( inputData?.close ) {
|
|
1086
|
+
// data.brandConfigs.storeCloseTime = inputData?.open;
|
|
1087
|
+
// }
|
|
1088
|
+
// if ( inputData?.missedOpportunityCalculation ) {
|
|
1089
|
+
// data.brandConfigs.missedOpportunityCalculate = inputData?.missedOpportunityCalculation;
|
|
1090
|
+
// }
|
|
1091
|
+
// if ( inputData?.conversionCalculation ) {
|
|
1092
|
+
// data.brandConfigs.conversionCalculate = inputData?.conversionCalculation;
|
|
1093
|
+
// }
|
|
1094
|
+
// if ( inputData?.billableCalculation ) {
|
|
1095
|
+
// data.brandConfigs.billableCalculate = inputData?.billableCalculation;
|
|
1096
|
+
// }
|
|
1097
|
+
// if ( inputData?.bouncedLimitCondition ) {
|
|
1098
|
+
// data.brandConfigs.bouncedConfigTime = data.brandConfigs.bouncedConfigTime.replace( /^.+(?=\d)/, inputData?.bouncedLimitCondition );
|
|
1099
|
+
// data.brandConfigs.missedOpportunityEndTime = data.brandConfigs.missedOpportunityEndTime.replace( /^.+(?=\d)/, inputData?.bouncedLimitCondition );
|
|
1100
|
+
// }
|
|
1101
|
+
// if ( inputData?.bouncedLimitValue ) {
|
|
1102
|
+
// data.brandConfigs.bouncedConfigTime = data.brandConfigs.bouncedConfigTime.replace( /\d+/, inputData?.bouncedLimitValue );
|
|
1103
|
+
// data.brandConfigs.missedOpportunityStartTime = data.brandConfigs.missedOpportunityStartTime.replace( /\d+/, inputData?.bouncedLimitValue );
|
|
1104
|
+
// }
|
|
1105
|
+
// if ( inputData?.conversionCondition ) {
|
|
1106
|
+
// data.brandConfigs.conversionConfigTime = data.brandConfigs.conversionConfigTime.replace( /^.+(?=\d)/, inputData?.conversionCondition );
|
|
1107
|
+
// data.brandConfigs.missedOpportunityStartTime = data.brandConfigs.missedOpportunityStartTime.replace( /^.+(?=\d)/, inputData?.conversionCondition );
|
|
1108
|
+
// }
|
|
1109
|
+
// if ( inputData?.conversionValue ) {
|
|
1110
|
+
// data.brandConfigs.conversionConfigTime = data.brandConfigs.conversionConfigTime.replace( /\d+/, inputData?.conversionValue );
|
|
1111
|
+
// data.brandConfigs.missedOpportunityEndTime = data.brandConfigs.missedOpportunityEndTime.replace( /\d+/, inputData?.conversionValue );
|
|
1112
|
+
// }
|
|
1113
|
+
// await postApi( `${url.oldapidomain}/oldBrandUpdate/${data?._id}`, { brandConfigs: data.brandConfigs } );
|
|
1113
1114
|
|
|
1114
|
-
if ( inputData?.bouncedLimitValue ) {
|
|
1115
|
-
data.brandConfigs.bouncedConfigTime = data.brandConfigs.bouncedConfigTime.replace( /\d+/, inputData?.bouncedLimitValue );
|
|
1116
|
-
data.brandConfigs.missedOpportunityStartTime = data.brandConfigs.missedOpportunityStartTime.replace( /\d+/, inputData?.bouncedLimitValue );
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
if ( inputData?.conversionCondition ) {
|
|
1120
|
-
data.brandConfigs.conversionConfigTime = data.brandConfigs.conversionConfigTime.replace( /^.+(?=\d)/, inputData?.conversionCondition );
|
|
1121
|
-
data.brandConfigs.missedOpportunityStartTime = data.brandConfigs.missedOpportunityStartTime.replace( /^.+(?=\d)/, inputData?.conversionCondition );
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
if ( inputData?.conversionValue ) {
|
|
1125
|
-
data.brandConfigs.conversionConfigTime = data.brandConfigs.conversionConfigTime.replace( /\d+/, inputData?.conversionValue );
|
|
1126
|
-
data.brandConfigs.missedOpportunityEndTime = data.brandConfigs.missedOpportunityEndTime.replace( /\d+/, inputData?.conversionValue );
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
await postApi( `${url.oldapidomain}/oldBrandUpdate/${data?._id}`, { brandConfigs: data.brandConfigs } );
|
|
1130
1115
|
const keysArray = [
|
|
1131
1116
|
'isExcludedArea', 'isPasserByData', 'isNormalized', 'isbillingDisabled',
|
|
1132
1117
|
'isCameraDisabled', 'isFootfallDirectory', 'isNOB', 'isNewTraffic',
|
|
@@ -1136,9 +1121,9 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
1136
1121
|
const oldData = {
|
|
1137
1122
|
StoreOpenTime: previousData?.featureConfigs?.open,
|
|
1138
1123
|
StoreCloseTime: previousData?.featureConfigs?.close,
|
|
1139
|
-
ConversionCalculations: previousData?.featureConfigs?.conversionCalculation,
|
|
1140
|
-
MissedOpportunityCalculation: previousData?.featureConfigs?.missedOpportunityCalculation,
|
|
1141
|
-
PotentialCalculations: previousData?.featureConfigs?.billableCalculation,
|
|
1124
|
+
ConversionCalculations: previousData?.featureConfigs?.conversionCalculation == 'footfall-count' ? 'Footfall Count' : postData?.featureConfigs?.conversionCalculation == 'engagers-count' ? 'Engagers Count' : 'Potential Entities',
|
|
1125
|
+
MissedOpportunityCalculation: previousData?.featureConfigs?.missedOpportunityCalculation == 'engagers-conversion' ? 'Engagers - Conversion' : 'Potential Entities - Conversion',
|
|
1126
|
+
PotentialCalculations: previousData?.featureConfigs?.billableCalculation == 'footfall-count' ? 'Footfall Count' : 'Engagers Count',
|
|
1142
1127
|
ConversionCondition: previousData?.featureConfigs?.conversion.condition,
|
|
1143
1128
|
ConversionValue: previousData?.featureConfigs?.conversion.value,
|
|
1144
1129
|
MissedOpportunityFromCondition: previousData?.featureConfigs?.missedOpportunityFrom?.condition,
|
|
@@ -1149,33 +1134,33 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
1149
1134
|
BouncedLimitValue: previousData?.featureConfigs?.bouncedLimit?.value,
|
|
1150
1135
|
InfraAlertValue: previousData?.featureConfigs?.infraAlert?.value,
|
|
1151
1136
|
InfraAlertCondition: previousData?.featureConfigs?.infraAlert?.condition,
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
StreamType: previousData?.featureConfigs?.streamBy =='Edge' ? 'Edge App': 'RTSP',
|
|
1167
|
-
FootfallDirectoryOnlyAudit: previousData?.featureConfigs?.isFootfallDirectoryAudit ==true ? '
|
|
1168
|
-
FootfallDirectoryOnlyFew: previousData?.featureConfigs?.isFootfallDirectoryLimit ==true ? '
|
|
1137
|
+
ExcludedArea: previousData?.featureConfigs?.isExcludedArea == true ? 'Enabled' : 'Disabled',
|
|
1138
|
+
PasserBydata: previousData?.featureConfigs?.isPasserByData == true ? 'Enabled' : 'Disabled',
|
|
1139
|
+
NormalizedDataDuringDowntime: previousData?.featureConfigs?.isNormalized == true ? 'Enabled' : 'Disabled',
|
|
1140
|
+
Billing: previousData?.featureConfigs?.isbillingDisabled == true ? 'Enabled' : 'Disabled',
|
|
1141
|
+
CameraBlurring: previousData?.featureConfigs?.isCameraDisabled == true ? 'Enabled' : 'Disabled',
|
|
1142
|
+
FootfallDirectory: previousData?.featureConfigs?.isFootfallDirectory == true ? 'Enabled' : 'Disabled',
|
|
1143
|
+
NOBStatus: previousData?.featureConfigs?.isNOB == true ? 'Enabled' : 'Disabled',
|
|
1144
|
+
EnableAnalyze: previousData?.featureConfigs?.isNewDashboard == true ? 'Enabled' : 'Disabled',
|
|
1145
|
+
Traffic: previousData?.featureConfigs?.isNewTraffic == true ? 'Enabled' : 'Disabled',
|
|
1146
|
+
Zone: previousData?.featureConfigs?.isNewZone == true ? 'Enabled' : 'Disabled',
|
|
1147
|
+
Zonev2: previousData?.featureConfigs?.isNewZoneV2 == true ? 'Enabled' : 'Disabled',
|
|
1148
|
+
Reports: previousData?.featureConfigs?.isNewReports == true ? 'Enabled' : 'Disabled',
|
|
1149
|
+
Trax: previousData?.featureConfigs?.isTrax == true ? 'Enabled' : 'Disabled',
|
|
1150
|
+
Revops: previousData?.featureConfigs?.isRevops == true ? 'Enabled' : 'Disabled',
|
|
1151
|
+
StreamType: previousData?.featureConfigs?.streamBy == 'Edge' ? 'Edge App' : 'RTSP',
|
|
1152
|
+
FootfallDirectoryOnlyAudit: previousData?.featureConfigs?.isFootfallDirectoryAudit == true ? 'Enabled' : 'Disabled',
|
|
1153
|
+
FootfallDirectoryOnlyFew: previousData?.featureConfigs?.isFootfallDirectoryLimit == true ? 'Enabled' : 'Disabled',
|
|
1169
1154
|
|
|
1170
1155
|
};
|
|
1171
1156
|
|
|
1172
1157
|
// Map and rename keys from current client info for UI display and logging
|
|
1173
|
-
const newData ={
|
|
1158
|
+
const newData = {
|
|
1174
1159
|
StoreOpenTime: postData?.featureConfigs?.open,
|
|
1175
1160
|
StoreCloseTime: postData?.featureConfigs?.close,
|
|
1176
|
-
ConversionCalculations: postData?.featureConfigs?.conversionCalculation,
|
|
1177
|
-
MissedOpportunityCalculation: postData?.featureConfigs?.missedOpportunityCalculation,
|
|
1178
|
-
PotentialCalculations: postData?.featureConfigs?.billableCalculation,
|
|
1161
|
+
ConversionCalculations: postData?.featureConfigs?.conversionCalculation == 'footfall-count' ? 'Footfall Count' : postData?.featureConfigs?.conversionCalculation == 'engagers-count' ? 'Engagers Count' : 'Potential Entities',
|
|
1162
|
+
MissedOpportunityCalculation: postData?.featureConfigs?.missedOpportunityCalculation == 'engagers-conversion' ? 'Engagers - Conversion' : 'Potential Entities - Conversion',
|
|
1163
|
+
PotentialCalculations: postData?.featureConfigs?.billableCalculation == 'footfall-count' ? 'Footfall Count' : 'Engagers Count',
|
|
1179
1164
|
ConversionCondition: postData?.featureConfigs?.conversion.condition,
|
|
1180
1165
|
ConversionValue: postData?.featureConfigs?.conversion.value,
|
|
1181
1166
|
MissedOpportunityFromCondition: postData?.featureConfigs?.missedOpportunityFrom?.condition,
|
|
@@ -1186,23 +1171,23 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
1186
1171
|
BouncedLimitValue: postData?.featureConfigs?.bouncedLimit?.value,
|
|
1187
1172
|
InfraAlertValue: postData?.featureConfigs?.infraAlert?.value,
|
|
1188
1173
|
InfraAlertCondition: postData?.featureConfigs?.infraAlert?.condition,
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
StreamType: postData?.featureConfigs?.streamBy =='Edge' ? 'Edge App': 'RTSP',
|
|
1204
|
-
FootfallDirectoryOnlyAudit: postData?.featureConfigs?.isFootfallDirectoryAudit ==true ? '
|
|
1205
|
-
FootfallDirectoryOnlyFew: postData?.featureConfigs?.isFootfallDirectoryLimit ==true ? '
|
|
1174
|
+
ExcludedArea: postData?.featureConfigs?.isExcludedArea == true ? 'Enabled' : 'Disabled',
|
|
1175
|
+
PasserBydata: postData?.featureConfigs?.isPasserByData == true ? 'Enabled' : 'Disabled',
|
|
1176
|
+
NormalizedDataDuringDowntime: postData?.featureConfigs?.isNormalized == true ? 'Enabled' : 'Disabled',
|
|
1177
|
+
Billing: postData?.featureConfigs?.isbillingDisabled == true ? 'Enabled' : 'Disabled',
|
|
1178
|
+
CameraBlurring: postData?.featureConfigs?.isCameraDisabled == true ? 'Enabled' : 'Disabled',
|
|
1179
|
+
FootfallDirectory: postData?.featureConfigs?.isFootfallDirectory == true ? 'Enabled' : 'Disabled',
|
|
1180
|
+
NOBStatus: postData?.featureConfigs?.isNOB == true ? 'Enabled' : 'Disabled',
|
|
1181
|
+
EnableAnalyze: postData?.featureConfigs?.isNewDashboard == true ? 'Enabled' : 'Disabled',
|
|
1182
|
+
Traffic: postData?.featureConfigs?.isNewTraffic == true ? 'Enabled' : 'Disabled',
|
|
1183
|
+
Zone: postData?.featureConfigs?.isNewZone == true ? 'Enabled' : 'Disabled',
|
|
1184
|
+
Zonev2: postData?.featureConfigs?.isNewZoneV2 == true ? 'Enabled' : 'Disabled',
|
|
1185
|
+
Reports: postData?.featureConfigs?.isNewReports == true ? 'Enabled' : 'Disabled',
|
|
1186
|
+
Trax: postData?.featureConfigs?.isTrax == true ? 'Enabled' : 'Disabled',
|
|
1187
|
+
Revops: postData?.featureConfigs?.isRevops == true ? 'Enabled' : 'Disabled',
|
|
1188
|
+
StreamType: postData?.featureConfigs?.streamBy == 'Edge' ? 'Edge App' : 'RTSP',
|
|
1189
|
+
FootfallDirectoryOnlyAudit: postData?.featureConfigs?.isFootfallDirectoryAudit == true ? 'Enabled' : 'Disabled',
|
|
1190
|
+
FootfallDirectoryOnlyFew: postData?.featureConfigs?.isFootfallDirectoryLimit == true ? 'Enabled' : 'Disabled',
|
|
1206
1191
|
|
|
1207
1192
|
};
|
|
1208
1193
|
|
|
@@ -1246,11 +1231,11 @@ export async function domainDetailsConfiguration( req, res ) {
|
|
|
1246
1231
|
const getPreData = await findOneClient(
|
|
1247
1232
|
{ clientId: req.params?.id }, // filter by clientId
|
|
1248
1233
|
{
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1234
|
+
'domainConfig.ssoLogin.domainName': 1,
|
|
1235
|
+
'domainConfig.ssoLogin.isEnable': 1,
|
|
1236
|
+
'domainConfig.ipWhitelisting.enableWhitelisting': 1,
|
|
1237
|
+
'domainConfig.ipWhitelisting.allowedIps': 1,
|
|
1238
|
+
'domainConfig.enableOtp': 1,
|
|
1254
1239
|
},
|
|
1255
1240
|
);
|
|
1256
1241
|
const updateAck = await domainDetailsConfigurationUpdate( {
|
|
@@ -1271,35 +1256,35 @@ export async function domainDetailsConfiguration( req, res ) {
|
|
|
1271
1256
|
const getPostData = await findOneClient(
|
|
1272
1257
|
{ clientId: req.params?.id }, // Filter by clientId
|
|
1273
1258
|
{
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1259
|
+
'domainConfig.ssoLogin.domainName': 1,
|
|
1260
|
+
'domainConfig.ssoLogin.isEnable': 1,
|
|
1261
|
+
'domainConfig.ipWhitelisting.enableWhitelisting': 1,
|
|
1262
|
+
'domainConfig.ipWhitelisting.allowedIps': 1,
|
|
1263
|
+
'domainConfig.enableOtp': 1,
|
|
1279
1264
|
},
|
|
1280
1265
|
);
|
|
1281
1266
|
|
|
1282
1267
|
|
|
1283
1268
|
// Map and rename keys from previous client info for UI display and logging
|
|
1284
1269
|
const oldData = {
|
|
1285
|
-
DomainName: getPreData?.domainConfig?.ssoLogin?.domainName,
|
|
1286
|
-
IsEnable: getPreData?.domainConfig?.ssoLogin?.isEnable ==true ? 'Enable': 'Disable',
|
|
1287
|
-
IPWhitelist: getPreData?.domainConfig?.ipWhitelisting?.enableWhitelisting ==true ? 'Enable': 'Disable',
|
|
1288
|
-
WhitelistedIps:
|
|
1289
|
-
TwoFactorAuthentication: getPreData?.domainConfig?.enableOtp ==true ? 'Enable': 'Disable',
|
|
1270
|
+
DomainName: getPreData?.domainConfig?.ssoLogin?.domainName?.join( ', ' ),
|
|
1271
|
+
IsEnable: getPreData?.domainConfig?.ssoLogin?.isEnable == true ? 'Enable' : 'Disable',
|
|
1272
|
+
IPWhitelist: getPreData?.domainConfig?.ipWhitelisting?.enableWhitelisting == true ? 'Enable' : 'Disable',
|
|
1273
|
+
WhitelistedIps: getPreData?.domainConfig?.ipWhitelisting?.allowedIps?.join( ', ' ),
|
|
1274
|
+
TwoFactorAuthentication: getPreData?.domainConfig?.enableOtp == true ? 'Enable' : 'Disable',
|
|
1290
1275
|
|
|
1291
1276
|
};
|
|
1292
1277
|
|
|
1293
1278
|
// Map and rename keys from current client info for UI display and logging
|
|
1294
|
-
const newData ={
|
|
1295
|
-
DomainName: getPostData?.domainConfig?.ssoLogin?.domainName,
|
|
1296
|
-
IsEnable: getPostData?.domainConfig?.ssoLogin?.isEnable ==true ? 'Enable': 'Disable',
|
|
1297
|
-
IPWhitelist: getPostData?.domainConfig?.ipWhitelisting?.enableWhitelisting ==true ? 'Enable': 'Disable',
|
|
1298
|
-
WhitelistedIps:
|
|
1299
|
-
TwoFactorAuthentication: getPostData?.domainConfig?.enableOtp ==true ? 'Enable': 'Disable',
|
|
1279
|
+
const newData = {
|
|
1280
|
+
DomainName: getPostData?.domainConfig?.ssoLogin?.domainName?.join( ', ' ),
|
|
1281
|
+
IsEnable: getPostData?.domainConfig?.ssoLogin?.isEnable == true ? 'Enable' : 'Disable',
|
|
1282
|
+
IPWhitelist: getPostData?.domainConfig?.ipWhitelisting?.enableWhitelisting == true ? 'Enable' : 'Disable',
|
|
1283
|
+
WhitelistedIps: getPostData?.domainConfig?.ipWhitelisting?.allowedIps?.join( ', ' ),
|
|
1284
|
+
TwoFactorAuthentication: getPostData?.domainConfig?.enableOtp == true ? 'Enable' : 'Disable',
|
|
1300
1285
|
};
|
|
1301
1286
|
|
|
1302
|
-
|
|
1287
|
+
logger.info( { getPreData: getPreData, getPostData: getPostData, newData: newData, oldData: oldData } );
|
|
1303
1288
|
// Prepare activity log object with all relevant details for OpenSearch logging
|
|
1304
1289
|
const logObj = {
|
|
1305
1290
|
clientId: req.params?.id, // ID of the client whose data was updated
|
|
@@ -1482,7 +1467,7 @@ export async function auditConfiguration( req, res ) {
|
|
|
1482
1467
|
auditConfigs: 1, _id: 0,
|
|
1483
1468
|
};
|
|
1484
1469
|
const previousClient = await findOneClient( query, fields );
|
|
1485
|
-
previousClient.auditConfigs.ratio = previousClient?.auditConfigs?.ratio? ( previousClient.auditConfigs.ratio )*100 : null;
|
|
1470
|
+
previousClient.auditConfigs.ratio = previousClient?.auditConfigs?.ratio ? ( previousClient.auditConfigs.ratio ) * 100 : null;
|
|
1486
1471
|
const record = {
|
|
1487
1472
|
'auditConfigs.count': inputData.count,
|
|
1488
1473
|
'auditConfigs.audit': inputData.audit,
|
|
@@ -1490,20 +1475,22 @@ export async function auditConfiguration( req, res ) {
|
|
|
1490
1475
|
};
|
|
1491
1476
|
await updateOneClient( query, record );
|
|
1492
1477
|
|
|
1493
|
-
|
|
1494
1478
|
// Map and rename keys from previous client info for UI display and logging
|
|
1495
1479
|
const oldData = {
|
|
1496
|
-
AuditStatus:
|
|
1497
|
-
MappingPercentage:
|
|
1498
|
-
AuditCount:
|
|
1499
|
-
|
|
1480
|
+
AuditStatus: previousClient?.auditConfigs?.audit == true ? 'Enable' : 'Disable',
|
|
1481
|
+
MappingPercentage: previousClient?.auditConfigs?.ratio,
|
|
1482
|
+
AuditCount: previousClient?.auditConfigs?.count,
|
|
1500
1483
|
};
|
|
1501
1484
|
|
|
1485
|
+
const currentClient = await findOneClient( query, fields );
|
|
1486
|
+
currentClient.auditConfigs.ratio = currentClient?.auditConfigs?.ratio ? ( currentClient.auditConfigs.ratio ) * 100 : null;
|
|
1487
|
+
|
|
1502
1488
|
// Map and rename keys from current client info for UI display and logging
|
|
1503
|
-
const newData ={
|
|
1504
|
-
AuditStatus:
|
|
1505
|
-
MappingPercentage:
|
|
1506
|
-
AuditCount:
|
|
1489
|
+
const newData = {
|
|
1490
|
+
AuditStatus: currentClient?.auditConfigs?.audit == true ? 'Enable' : 'Disable',
|
|
1491
|
+
MappingPercentage: currentClient?.auditConfigs?.ratio,
|
|
1492
|
+
AuditCount: currentClient?.auditConfigs?.count,
|
|
1493
|
+
|
|
1507
1494
|
};
|
|
1508
1495
|
const logObj = {
|
|
1509
1496
|
clientId: req.params?.id,
|
|
@@ -1516,12 +1503,7 @@ export async function auditConfiguration( req, res ) {
|
|
|
1516
1503
|
showTo: [ 'tango' ],
|
|
1517
1504
|
changes: [ `Audit config for client id ${req.params?.id}` ],
|
|
1518
1505
|
previous: previousClient.auditConfigs,
|
|
1519
|
-
current:
|
|
1520
|
-
clientId: req.params?.id,
|
|
1521
|
-
count: inputData.count,
|
|
1522
|
-
audit: inputData.audit,
|
|
1523
|
-
ratio: inputData.ratio,
|
|
1524
|
-
},
|
|
1506
|
+
current: currentClient.auditConfigs,
|
|
1525
1507
|
oldData: oldData,
|
|
1526
1508
|
newData: newData,
|
|
1527
1509
|
};
|
|
@@ -2280,12 +2262,12 @@ export async function getActivityLogs1( req, res ) {
|
|
|
2280
2262
|
try {
|
|
2281
2263
|
const inputData = req.body;
|
|
2282
2264
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
2283
|
-
const clientQuery =[
|
|
2265
|
+
const clientQuery = [
|
|
2284
2266
|
{
|
|
2285
2267
|
$match: {
|
|
2286
2268
|
$and: [
|
|
2287
2269
|
{
|
|
2288
|
-
clientId: { $in: inputData },
|
|
2270
|
+
clientId: { $in: [ inputData?.clientId ] },
|
|
2289
2271
|
},
|
|
2290
2272
|
],
|
|
2291
2273
|
},
|
|
@@ -2304,37 +2286,23 @@ export async function getActivityLogs1( req, res ) {
|
|
|
2304
2286
|
},
|
|
2305
2287
|
];
|
|
2306
2288
|
const getClientName = await aggregateClient( clientQuery );
|
|
2307
|
-
if ( getClientName?.length == 0 || getClientName[0]?.clientName?.length ===0 ) {
|
|
2289
|
+
if ( getClientName?.length == 0 || getClientName[0]?.clientName?.length === 0 ) {
|
|
2308
2290
|
return res.sendError( 'No Data Found', 204 );
|
|
2309
2291
|
}
|
|
2310
2292
|
const query = {
|
|
2311
2293
|
'_source': [
|
|
2312
2294
|
'userId', 'userName', 'email', 'date', 'logType', 'logSubType',
|
|
2313
|
-
'changes', 'eventType', 'previous', 'current',
|
|
2295
|
+
'changes', 'eventType', 'previous', 'current', 'oldData', 'newData',
|
|
2314
2296
|
],
|
|
2315
2297
|
'query': {
|
|
2316
2298
|
'bool': {
|
|
2317
|
-
|
|
2318
|
-
// {
|
|
2319
|
-
// 'terms': {
|
|
2320
|
-
// 'clientId.keyword': [ req.body.clientId ],
|
|
2321
|
-
// },
|
|
2322
|
-
// },
|
|
2323
|
-
// ],
|
|
2324
|
-
|
|
2325
|
-
'should': [
|
|
2326
|
-
{
|
|
2327
|
-
'terms': {
|
|
2328
|
-
'clientId.keyword': [ inputData.clientId ],
|
|
2329
|
-
},
|
|
2330
|
-
},
|
|
2299
|
+
'must': [
|
|
2331
2300
|
{
|
|
2332
2301
|
'terms': {
|
|
2333
|
-
'
|
|
2302
|
+
'clientId.keyword': [ req.body.clientId ],
|
|
2334
2303
|
},
|
|
2335
2304
|
},
|
|
2336
2305
|
],
|
|
2337
|
-
'minimum_should_match': 1, // Ensures at least one condition must match
|
|
2338
2306
|
},
|
|
2339
2307
|
},
|
|
2340
2308
|
'from': ( req.body.offset - 1 ) * req.body.limit,
|
|
@@ -2385,18 +2353,22 @@ export async function getActivityLogs1( req, res ) {
|
|
|
2385
2353
|
let temp = [];
|
|
2386
2354
|
if ( totalDocuments ) {
|
|
2387
2355
|
hits.map( ( hit, i ) => {
|
|
2388
|
-
let respo ={};
|
|
2389
|
-
hit._source.logSubType = hit._source.logSubType === 'documentUpload'? 'documentsUpload': hit._source.logSubType === 'domainDetails'? 'securityFeatures': hit?._source?.logSubType;
|
|
2390
|
-
if ( ( ( hit?._source?.eventType ).match( /update/ ) || ( hit?._source?.eventType ).match( /edit/ ) )&& hit?._source?.previous ) {
|
|
2391
|
-
const previous = hit?._source?.previous;
|
|
2392
|
-
const current=hit?._source?.current;
|
|
2393
|
-
const logType =hit?._source?.logType;
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2356
|
+
let respo = {};
|
|
2357
|
+
hit._source.logSubType = hit._source.logSubType === 'documentUpload' ? 'documentsUpload' : hit._source.logSubType === 'domainDetails' ? 'securityFeatures' : hit?._source?.logSubType;
|
|
2358
|
+
if ( ( ( hit?._source?.eventType ).match( /update/ ) || ( hit?._source?.eventType ).match( /edit/ ) ) && hit?._source?.previous ) {
|
|
2359
|
+
const previous = hit?._source?.logType == 'cameras' ? hit?._source?.oldData : hit?._source?.previous;
|
|
2360
|
+
const current = hit?._source?.logType == 'cameras' ? hit?._source?.newData : hit?._source?.current;
|
|
2361
|
+
const logType = hit?._source?.logType;
|
|
2362
|
+
const logSubType = hit?._source?.logSubType;
|
|
2363
|
+
if ( previous && current && hit?._source?.logType == 'cameras' ) {
|
|
2364
|
+
respo = findDifferences( previous, current );
|
|
2365
|
+
} else {
|
|
2366
|
+
respo = findDifferences1( previous, current, logType, logSubType );
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2397
2369
|
hit._source.updatedValue = respo;
|
|
2398
2370
|
temp.push( hit?._source );
|
|
2399
|
-
hit._source.changes =logSubType === 'ticketConfig'? Object.keys( respo ).map( ( item ) => item ) : hit._source.changes;
|
|
2371
|
+
hit._source.changes = logSubType === 'ticketConfig' ? Object.keys( respo ).map( ( item ) => item ) : hit._source.changes;
|
|
2400
2372
|
} else {
|
|
2401
2373
|
temp.push( hit?._source );
|
|
2402
2374
|
}
|
|
@@ -2421,7 +2393,7 @@ function findDifferences1( previous, current, logType, logSubType, path = '' ) {
|
|
|
2421
2393
|
] );
|
|
2422
2394
|
const documents = dbKeys.DOCUMENTS;
|
|
2423
2395
|
// Get correct key mapping based on logType
|
|
2424
|
-
const keyMapping = logType == 'stores' ?documents.stores: logType == 'users' ?documents.users :logSubType=='reportConfig'?documents.reports: logType=='brandInfo'?documents.client:documents.client;
|
|
2396
|
+
const keyMapping = logType == 'stores' ? documents.stores : logType == 'users' ? documents.users : logSubType == 'reportConfig' ? documents.reports : logType == 'brandInfo' ? documents.client : documents.client;
|
|
2425
2397
|
|
|
2426
2398
|
|
|
2427
2399
|
let differences = {};
|
|
@@ -2433,7 +2405,7 @@ function findDifferences1( previous, current, logType, logSubType, path = '' ) {
|
|
|
2433
2405
|
const currValue = current[key];
|
|
2434
2406
|
|
|
2435
2407
|
if ( typeof prevValue === 'object' && typeof currValue === 'object' && prevValue !== null && currValue !== null ) {
|
|
2436
|
-
if ( logSubType!== 'userUpdated' ) {
|
|
2408
|
+
if ( logSubType !== 'userUpdated' ) {
|
|
2437
2409
|
if ( key == 'spocDetails' ) {
|
|
2438
2410
|
if ( _.isEqual( prevValue, currValue ) ) {
|
|
2439
2411
|
continue;
|
|
@@ -2441,9 +2413,9 @@ function findDifferences1( previous, current, logType, logSubType, path = '' ) {
|
|
|
2441
2413
|
let result = compareArrayObjects( prevValue, currValue );
|
|
2442
2414
|
differences = { ...differences, ...result };
|
|
2443
2415
|
}
|
|
2444
|
-
} else if ( Array.isArray( prevValue ) && prevValue.every( ( item ) => typeof item === 'string' ) ||Array.isArray( currValue ) && currValue.every( ( item ) => typeof item === 'string' ) ) {
|
|
2445
|
-
|
|
2446
|
-
|
|
2416
|
+
} else if ( Array.isArray( prevValue ) && prevValue.every( ( item ) => typeof item === 'string' ) || Array.isArray( currValue ) && currValue.every( ( item ) => typeof item === 'string' ) ) {
|
|
2417
|
+
JSON.stringify( prevValue ) !== JSON.stringify( currValue ) ?
|
|
2418
|
+
differences[`${path}${key}`] = { previous: prevValue.length > 0 ? prevValue.join( ',' ) : null, current: currValue.length > 0 ? currValue.join( ',' ) : null } : null;
|
|
2447
2419
|
|
|
2448
2420
|
// differences[`${path}${key}`] = { previous: removed.length> 0 ? prevValue.join( ',' ): prevValue.join( ', ' ) :, current: added.length > 0? addedUsers.join( ', ' ) : currValue.join( ',' ) } : null;
|
|
2449
2421
|
} else {
|
|
@@ -2514,13 +2486,13 @@ function findDifferences1( previous, current, logType, logSubType, path = '' ) {
|
|
|
2514
2486
|
|
|
2515
2487
|
if (
|
|
2516
2488
|
( diff.previous === '' || diff.previous === null || ( Array.isArray( diff.previous ) && diff.previous.length === 0 ) ) &&
|
|
2517
|
-
|
|
2489
|
+
diff.current === undefined
|
|
2518
2490
|
) {
|
|
2519
2491
|
return;
|
|
2520
2492
|
}
|
|
2521
2493
|
if (
|
|
2522
2494
|
( diff.current === '' || diff.current === null || ( Array.isArray( diff.current ) && diff.current.length === 0 ) ) &&
|
|
2523
|
-
|
|
2495
|
+
diff.previous === undefined
|
|
2524
2496
|
) {
|
|
2525
2497
|
return;
|
|
2526
2498
|
}
|
|
@@ -2551,7 +2523,7 @@ export async function getActivityLogs( req, res ) {
|
|
|
2551
2523
|
try {
|
|
2552
2524
|
const inputData = req.body;
|
|
2553
2525
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
2554
|
-
const clientQuery =[
|
|
2526
|
+
const clientQuery = [
|
|
2555
2527
|
{
|
|
2556
2528
|
$match: {
|
|
2557
2529
|
$and: [
|
|
@@ -2575,7 +2547,7 @@ export async function getActivityLogs( req, res ) {
|
|
|
2575
2547
|
},
|
|
2576
2548
|
];
|
|
2577
2549
|
const getClientName = await aggregateClient( clientQuery );
|
|
2578
|
-
if ( getClientName?.length == 0 || getClientName[0]?.clientName?.length ===0 ) {
|
|
2550
|
+
if ( getClientName?.length == 0 || getClientName[0]?.clientName?.length === 0 ) {
|
|
2579
2551
|
return res.sendError( 'No Data Found', 204 );
|
|
2580
2552
|
}
|
|
2581
2553
|
const query = {
|
|
@@ -2650,12 +2622,14 @@ export async function getActivityLogs( req, res ) {
|
|
|
2650
2622
|
let temp = [];
|
|
2651
2623
|
if ( totalDocuments ) {
|
|
2652
2624
|
hits.map( ( hit, i ) => {
|
|
2653
|
-
let respo ={};
|
|
2654
|
-
hit._source.logSubType = hit._source.logSubType === 'documentUpload'? 'documentsUpload': hit._source.logSubType === 'domainDetails'? 'securityFeatures': hit?._source?.logSubType;
|
|
2655
|
-
if ( ( ( hit?._source?.eventType ).match( /update/ ) || ( hit?._source?.eventType ).match( /edit/ ) )&& hit?._source?.previous ) {
|
|
2625
|
+
let respo = {};
|
|
2626
|
+
hit._source.logSubType = hit._source.logSubType === 'documentUpload' ? 'documentsUpload' : hit._source.logSubType === 'domainDetails' ? 'securityFeatures' : hit?._source?.logSubType;
|
|
2627
|
+
if ( ( ( hit?._source?.eventType ).match( /update/ ) || ( hit?._source?.eventType ).match( /edit/ ) ) && hit?._source?.previous ) {
|
|
2656
2628
|
const previous = hit?._source?.oldData;
|
|
2657
|
-
const current=hit?._source?.newData;
|
|
2658
|
-
|
|
2629
|
+
const current = hit?._source?.newData;
|
|
2630
|
+
if ( previous && current ) {
|
|
2631
|
+
respo = findDifferences( previous, current );
|
|
2632
|
+
}
|
|
2659
2633
|
hit._source.updatedValue = respo;
|
|
2660
2634
|
temp.push( hit?._source );
|
|
2661
2635
|
// hit._source.changes =logSubType === 'ticketConfig'? Object.keys( respo ).map( ( item ) => item ) : hit._source.changes;
|
|
@@ -2675,6 +2649,7 @@ export async function getActivityLogs( req, res ) {
|
|
|
2675
2649
|
}
|
|
2676
2650
|
|
|
2677
2651
|
function findDifferences( oldData, newData ) {
|
|
2652
|
+
logger.info( { oldData: oldData, newData: newData } );
|
|
2678
2653
|
const allKeys = new Set( [ ...Object.keys( oldData ), ...Object.keys( newData ) ] );
|
|
2679
2654
|
const diff = {};
|
|
2680
2655
|
|
|
@@ -2695,44 +2670,48 @@ function findDifferences( oldData, newData ) {
|
|
|
2695
2670
|
}
|
|
2696
2671
|
|
|
2697
2672
|
function splitCamelCase( text ) {
|
|
2698
|
-
return text.replace( /([a-z])([A-Z])/g, '$1 $2' )
|
|
2673
|
+
return text.replace( /([a-z])([A-Z])/g, '$1 $2' ) // Add space between camelCase words
|
|
2674
|
+
.replace( /([a-zA-Z])(\d+)/g, '$1 $2' ) // Add space between letters and numbers
|
|
2675
|
+
.replace( /(\d+)([a-zA-Z])/g, '$1 $2' )
|
|
2676
|
+
.trim()
|
|
2677
|
+
.replace( /^./, ( match ) => match.toUpperCase() ); // Capitalize the first letter
|
|
2699
2678
|
}
|
|
2700
2679
|
|
|
2701
|
-
async function postApi( url, data ) {
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
}
|
|
2718
|
-
|
|
2719
|
-
async function getApi( url ) {
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
}
|
|
2680
|
+
// async function postApi( url, data ) {
|
|
2681
|
+
// const requestOptions = {
|
|
2682
|
+
// method: 'POST',
|
|
2683
|
+
// headers: {
|
|
2684
|
+
// 'Content-Type': 'application/json',
|
|
2685
|
+
// 'Authorization': 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66',
|
|
2686
|
+
// },
|
|
2687
|
+
// body: JSON.stringify( data ),
|
|
2688
|
+
// };
|
|
2689
|
+
|
|
2690
|
+
// try {
|
|
2691
|
+
// const response = await fetch( url, requestOptions );
|
|
2692
|
+
// await response.json();
|
|
2693
|
+
// } catch ( error ) {
|
|
2694
|
+
// logger.error( { error: error, message: data, function: 'postApi' } );
|
|
2695
|
+
// }
|
|
2696
|
+
// }
|
|
2697
|
+
|
|
2698
|
+
// async function getApi( url ) {
|
|
2699
|
+
// const requestOptions = {
|
|
2700
|
+
// method: 'GET',
|
|
2701
|
+
// headers: {
|
|
2702
|
+
// 'Content-Type': 'application/json',
|
|
2703
|
+
// 'Authorization': 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f66',
|
|
2704
|
+
// },
|
|
2705
|
+
// };
|
|
2706
|
+
|
|
2707
|
+
// try {
|
|
2708
|
+
// const response = await fetch( url, requestOptions );
|
|
2709
|
+
// const responseData = await response.json();
|
|
2710
|
+
// return responseData;
|
|
2711
|
+
// } catch ( error ) {
|
|
2712
|
+
// logger.error( { error: error, message: 'Error in GET request', function: 'getApi' } );
|
|
2713
|
+
// }
|
|
2714
|
+
// }
|
|
2736
2715
|
|
|
2737
2716
|
|
|
2738
2717
|
export async function csmAssignConfirmation( req, res ) {
|
|
@@ -2779,8 +2758,8 @@ function compareArrayObjects( prevArray, currArray ) {
|
|
|
2779
2758
|
|
|
2780
2759
|
Object.keys( { ...prevObj, ...currObj } ).forEach( ( key ) => {
|
|
2781
2760
|
if ( prevObj[key] !== currObj[key] && key !== '_id' ) {
|
|
2782
|
-
const key1 = key == 'contact'? 'Contact Number': key == 'email'? 'Email ID':key == 'name'?'Name': key == 'designation'?'Designation':key;
|
|
2783
|
-
const name = i ==0? 'Primary Spoc': `Alternate Spoc ${i+1}`;
|
|
2761
|
+
const key1 = key == 'contact' ? 'Contact Number' : key == 'email' ? 'Email ID' : key == 'name' ? 'Name' : key == 'designation' ? 'Designation' : key;
|
|
2762
|
+
const name = i == 0 ? 'Primary Spoc' : `Alternate Spoc ${i + 1}`;
|
|
2784
2763
|
diff[`${name} ${key1}`] = {
|
|
2785
2764
|
previous: prevObj[key] || 'null',
|
|
2786
2765
|
current: currObj[key] || 'null',
|
|
@@ -2796,3 +2775,120 @@ function compareArrayObjects( prevArray, currArray ) {
|
|
|
2796
2775
|
|
|
2797
2776
|
return changes;
|
|
2798
2777
|
}
|
|
2778
|
+
|
|
2779
|
+
|
|
2780
|
+
export async function createAuditConfig( req, res ) {
|
|
2781
|
+
try {
|
|
2782
|
+
await createauditConfig( req.body );
|
|
2783
|
+
return res.sendSuccess( 'created Sucessfully' );
|
|
2784
|
+
} catch ( error ) {
|
|
2785
|
+
logger.error( { error: error, message: req.body, function: 'createAuditConfig' } );
|
|
2786
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
export async function updateAuditConfig( req, res ) {
|
|
2790
|
+
try {
|
|
2791
|
+
await updateauditConfig( { _id: req.params.id }, req.body );
|
|
2792
|
+
return res.sendSuccess( 'updated Sucessfully' );
|
|
2793
|
+
} catch ( error ) {
|
|
2794
|
+
logger.error( { error: error, message: req.body, function: 'createAuditConfig' } );
|
|
2795
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
export async function AuditConfiglist( req, res ) {
|
|
2799
|
+
try {
|
|
2800
|
+
let Query = [ {
|
|
2801
|
+
$match: {
|
|
2802
|
+
'$and': [
|
|
2803
|
+
{ 'clientId': { $in: req.body.clientId } },
|
|
2804
|
+
],
|
|
2805
|
+
},
|
|
2806
|
+
} ];
|
|
2807
|
+
if ( req.body.searchValue && req.body.searchValue !== '' ) {
|
|
2808
|
+
const searchCondition = {
|
|
2809
|
+
$match: {
|
|
2810
|
+
$or: [
|
|
2811
|
+
{ AuditName: { $regex: req.body.searchValue, $options: 'i' } },
|
|
2812
|
+
{ keyWord: { $regex: req.body.searchValue, $options: 'i' } },
|
|
2813
|
+
],
|
|
2814
|
+
},
|
|
2815
|
+
};
|
|
2816
|
+
|
|
2817
|
+
Query.push( searchCondition );
|
|
2818
|
+
}
|
|
2819
|
+
if ( req.body.sortColumName && req.body.sortColumName !== '' && req.body.sortBy ) {
|
|
2820
|
+
const sortOption = { $sort: { [req.body.sortColumName]: req.body.sortBy } };
|
|
2821
|
+
Query.push( sortOption );
|
|
2822
|
+
} else {
|
|
2823
|
+
const sortOption = { $sort: { 'AuditName': -1 } };
|
|
2824
|
+
Query.push( sortOption );
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
let count = await aggregateAuditconfig( Query );
|
|
2828
|
+
|
|
2829
|
+
if ( req.body.limit && req.body.offset && !req.body.export ) {
|
|
2830
|
+
const skipValue = ( req.body.offset - 1 ) * req.body.limit;
|
|
2831
|
+
const limitValue = Number( req.body.limit );
|
|
2832
|
+
|
|
2833
|
+
const pagination = [
|
|
2834
|
+
{ $skip: skipValue },
|
|
2835
|
+
{ $limit: limitValue },
|
|
2836
|
+
];
|
|
2837
|
+
|
|
2838
|
+
Query.push( ...pagination );
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
let result = await aggregateAuditconfig( Query );
|
|
2842
|
+
|
|
2843
|
+
if ( req.body.export && result.length > 0 ) {
|
|
2844
|
+
const exportdata = result.map( ( element ) => {
|
|
2845
|
+
return {
|
|
2846
|
+
'Audit Name': element.AuditName,
|
|
2847
|
+
'Keyword': element.keyWord,
|
|
2848
|
+
'File Type': element.fileType,
|
|
2849
|
+
'Response Type': element.responseType,
|
|
2850
|
+
'Status': element.status,
|
|
2851
|
+
};
|
|
2852
|
+
} );
|
|
2853
|
+
await download( exportdata, res );
|
|
2854
|
+
return;
|
|
2855
|
+
}
|
|
2856
|
+
return res.sendSuccess( { result: result, totalCount: count.length } );
|
|
2857
|
+
} catch ( error ) {
|
|
2858
|
+
logger.error( { error: error, message: req.body, function: 'createAuditConfig' } );
|
|
2859
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
|
|
2864
|
+
export async function revopconfig( req, res ) {
|
|
2865
|
+
try {
|
|
2866
|
+
let result = await findOnerevopConfig( { clientId: req.body.clientId } );
|
|
2867
|
+
|
|
2868
|
+
if ( result===null ) {
|
|
2869
|
+
await createrevopConfig( req.body );
|
|
2870
|
+
return res.sendSuccess( 'revopconfig created Sucessfully' );
|
|
2871
|
+
} else {
|
|
2872
|
+
await updaterevopConfig( { clientId: req.body.clientId }, req.body );
|
|
2873
|
+
return res.sendSuccess( 'revopconfig updated Sucessfully' );
|
|
2874
|
+
}
|
|
2875
|
+
} catch ( error ) {
|
|
2876
|
+
logger.error( { error: error, message: req.body, function: 'revopconfig' } );
|
|
2877
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
export async function getrevopconfig( req, res ) {
|
|
2882
|
+
try {
|
|
2883
|
+
let result = await findOnerevopConfig( { clientId: req.query.clientId } );
|
|
2884
|
+
if ( result===null ) {
|
|
2885
|
+
return res.sendError( 'no data found', 204 );
|
|
2886
|
+
}
|
|
2887
|
+
return res.sendSuccess( result );
|
|
2888
|
+
} catch ( error ) {
|
|
2889
|
+
logger.error( { error: error, message: req.query, function: 'revopconfig' } );
|
|
2890
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
|