tango-app-api-client 3.3.2 → 3.3.3-beta.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.
|
|
3
|
+
"version": "3.3.3-beta.1",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -19,14 +19,16 @@
|
|
|
19
19
|
"express": "^4.18.2",
|
|
20
20
|
"express-fileupload": "^1.4.3",
|
|
21
21
|
"handlebars": "^4.7.8",
|
|
22
|
+
"i": "^0.3.7",
|
|
22
23
|
"joi": "^17.12.1",
|
|
23
24
|
"joi-to-swagger": "^6.2.0",
|
|
24
25
|
"lodash": "^4.17.21",
|
|
25
26
|
"mongodb": "^6.3.0",
|
|
26
27
|
"nodemon": "^3.0.3",
|
|
28
|
+
"npm": "^10.9.1",
|
|
27
29
|
"swagger-ui-express": "^5.0.0",
|
|
28
|
-
"tango-api-schema": "^2.1.
|
|
29
|
-
"tango-app-api-middleware": "^3.1.
|
|
30
|
+
"tango-api-schema": "^2.1.92",
|
|
31
|
+
"tango-app-api-middleware": "^3.1.43-alpha.10",
|
|
30
32
|
"winston": "^3.11.0",
|
|
31
33
|
"winston-daily-rotate-file": "^5.0.0"
|
|
32
34
|
},
|
|
@@ -14,7 +14,8 @@ import { countDocumentsGroup, createGroupModel, findOneGroup } from '../service/
|
|
|
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
|
+
import { countDocumentsTeams } from '../service/teams.service.js';
|
|
18
19
|
|
|
19
20
|
export async function create( req, res ) {
|
|
20
21
|
try {
|
|
@@ -42,7 +43,7 @@ export async function create( req, res ) {
|
|
|
42
43
|
const tangoId = count + 1;
|
|
43
44
|
const generatedName = inputData.clientName.replace( /[^A-Z0-9]+/ig, '' );
|
|
44
45
|
const product = leadRecord?.planDetails?.product.map( ( value ) => ( { productName: value } ) );
|
|
45
|
-
const getPermission = await findOneStandaredRole( { roleName: 'superadmin', userType: 'client' }, { permission: 1 } );
|
|
46
|
+
const getPermission = await findOneStandaredRole( { roleName: 'superadmin', userType: 'client' }, { permission: 1, rolespermission: 1 } );
|
|
46
47
|
const userQuery = {
|
|
47
48
|
email: leadRecord?.corporateEmail,
|
|
48
49
|
};
|
|
@@ -78,9 +79,26 @@ export async function create( req, res ) {
|
|
|
78
79
|
'auditConfigs.traxQueueName.uniformDetection': `${generatedName}-uniformDetection`,
|
|
79
80
|
'auditConfigs.traxQueueName.mobileDetection': `${generatedName}-mobileDetection`,
|
|
80
81
|
'auditConfigs.traxQueueName.cameraAngleChange': `${generatedName}-cameraAngleChange`,
|
|
82
|
+
};
|
|
81
83
|
|
|
84
|
+
record.featureConfigs = {};
|
|
85
|
+
if ( product && product.length > 0 ) {
|
|
86
|
+
for ( let data of product ) {
|
|
87
|
+
record.featureConfigs.isNewDashboard = true;
|
|
88
|
+
|
|
89
|
+
if ( data.productName === 'tangoTraffic' ) {
|
|
90
|
+
record.featureConfigs.isNewTraffic = true;
|
|
91
|
+
record.featureConfigs.isNewReports = true;
|
|
92
|
+
}
|
|
93
|
+
if ( data.productName === 'tangoZone' ) {
|
|
94
|
+
record.featureConfigs.isNewZone = true;
|
|
95
|
+
}
|
|
96
|
+
if ( data.productName === 'tangoTrax' ) {
|
|
97
|
+
record.featureConfigs. isTrax= true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
82
101
|
|
|
83
|
-
};
|
|
84
102
|
|
|
85
103
|
const insertClient = await insert( record );
|
|
86
104
|
|
|
@@ -88,8 +106,10 @@ export async function create( req, res ) {
|
|
|
88
106
|
|
|
89
107
|
const customer = await createCustomer( { name: user.userName, email: user.email, clientId: insertedClientRecord.clientId } );
|
|
90
108
|
|
|
91
|
-
const virtualAccount = await createVirtualAccount( {
|
|
92
|
-
|
|
109
|
+
const virtualAccount = await createVirtualAccount( {
|
|
110
|
+
receiverTypes: [ 'bank_account' ], description: `Virtual Account for ${insertedClientRecord.clientId}`,
|
|
111
|
+
customerId: customer.id, notes: { createdAt: new Date(), createdBy: req.user?.email },
|
|
112
|
+
} );
|
|
93
113
|
|
|
94
114
|
const paymentAccount = {
|
|
95
115
|
clientId: insertedClientRecord.clientId,
|
|
@@ -111,6 +131,17 @@ export async function create( req, res ) {
|
|
|
111
131
|
|
|
112
132
|
await createPaymentAccount( paymentAccount );
|
|
113
133
|
|
|
134
|
+
const defaultcluster = {
|
|
135
|
+
'clusterName': 'All stores',
|
|
136
|
+
'description': 'Contains all the onboarded stores',
|
|
137
|
+
'stores': [],
|
|
138
|
+
'Teamlead': [],
|
|
139
|
+
'clientId': insertedClientRecord.clientId,
|
|
140
|
+
'isDefaults': true,
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
await createclusterModel( defaultcluster );
|
|
144
|
+
|
|
114
145
|
|
|
115
146
|
const defaultGroup = {
|
|
116
147
|
'groupName': 'All stores',
|
|
@@ -293,6 +324,7 @@ export async function create( req, res ) {
|
|
|
293
324
|
userType: 'client',
|
|
294
325
|
refreshToken: null,
|
|
295
326
|
permission: getPermission?.permission,
|
|
327
|
+
rolespermission: getPermission?.rolespermission,
|
|
296
328
|
clientId: String( tangoId ),
|
|
297
329
|
};
|
|
298
330
|
// await deleteOneAuthentication( { user: user?._id, type: 'retail' } );
|
|
@@ -515,7 +547,44 @@ export async function clientDetails( req, res ) {
|
|
|
515
547
|
}
|
|
516
548
|
export async function detailedAllClientCount( req, res ) {
|
|
517
549
|
try {
|
|
550
|
+
const field = { clientName: 1, clientId: 1 };
|
|
551
|
+
let Assinedclient = [];
|
|
552
|
+
if ( req?.user?.role === 'superadmin' ) {
|
|
553
|
+
Assinedclient = await findClient( {}, field );
|
|
554
|
+
Assinedclient = Assinedclient.map( ( data ) => data.clientId );
|
|
555
|
+
} else {
|
|
556
|
+
const clientQuery = [
|
|
557
|
+
{
|
|
558
|
+
$match: {
|
|
559
|
+
userEmail: req?.user?.email,
|
|
560
|
+
assignedType: { $eq: 'client' },
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
$group: {
|
|
565
|
+
_id: null,
|
|
566
|
+
clientId: { $addToSet: '$assignedValue' },
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
$project: {
|
|
571
|
+
_id: 0,
|
|
572
|
+
clientId: 1,
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
|
|
576
|
+
];
|
|
577
|
+
const clientList = await aggregateUserAssignedStore( clientQuery );
|
|
578
|
+
if ( clientList[0]?.clientId?.length != 0 ) {
|
|
579
|
+
Assinedclient = clientList[0]?.clientId;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
518
582
|
const query = [
|
|
583
|
+
{
|
|
584
|
+
$match: {
|
|
585
|
+
clientId: { $in: Assinedclient },
|
|
586
|
+
},
|
|
587
|
+
},
|
|
519
588
|
{
|
|
520
589
|
$project: {
|
|
521
590
|
activeClient: { $cond: [ { $eq: [ '$status', 'active' ] }, 1, 0 ] },
|
|
@@ -579,11 +648,15 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
579
648
|
},
|
|
580
649
|
];
|
|
581
650
|
const result = await aggregateClient( query );
|
|
582
|
-
const activeStores = await findStore( {
|
|
651
|
+
const activeStores = await findStore( {
|
|
652
|
+
'clientId': { $in: Assinedclient },
|
|
653
|
+
'status': 'active',
|
|
654
|
+
}, { storeId: 1 } );
|
|
583
655
|
let yettoInstallCount = await aggregateTickets( [
|
|
584
656
|
{
|
|
585
657
|
$match: {
|
|
586
658
|
$and: [
|
|
659
|
+
{ 'basicDetails.clientId': { $in: Assinedclient } },
|
|
587
660
|
{ issueType: 'installation' },
|
|
588
661
|
{ 'status': { $ne: 'closed' } },
|
|
589
662
|
],
|
|
@@ -599,7 +672,7 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
599
672
|
if ( result.length == 0 ) {
|
|
600
673
|
return res.sendError( 'No Data Found', 204 );
|
|
601
674
|
}
|
|
602
|
-
result[0].activeStoresCount = activeStores.length-yettoInstallCount.length;
|
|
675
|
+
result[0].activeStoresCount = activeStores.length>0?Math.abs( activeStores.length - yettoInstallCount.length ):0;
|
|
603
676
|
result[0].activeCameraCount = activeCameras;
|
|
604
677
|
return res.sendSuccess( { result: result } );
|
|
605
678
|
} catch ( error ) {
|
|
@@ -861,65 +934,66 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
861
934
|
try {
|
|
862
935
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
863
936
|
const url = JSON.parse( process.env.URL );
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
}
|
|
937
|
+
const inputData = req.body;
|
|
938
|
+
if ( inputData?.bouncedLimitValue ) {
|
|
939
|
+
inputData.missedOpportunityFromValue = inputData?.bouncedLimitValue;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
if ( inputData?.conversionValue ) {
|
|
943
|
+
inputData.missedOpportunityToValue = inputData?.conversionValue;
|
|
944
|
+
}
|
|
945
|
+
const updateAck = await featureConfigurationUpdate( { clientId: req.params?.id }, inputData );
|
|
872
946
|
|
|
873
947
|
let updateKeys = [];
|
|
874
948
|
|
|
875
|
-
if ( Object.keys(
|
|
876
|
-
Object.keys(
|
|
949
|
+
if ( Object.keys( inputData ).length > 0 ) {
|
|
950
|
+
Object.keys( inputData ).forEach( ( element ) => {
|
|
877
951
|
updateKeys.push( camelCaseToWords( element ) );
|
|
878
952
|
} );
|
|
879
953
|
}
|
|
880
954
|
|
|
881
|
-
const user =
|
|
955
|
+
const user = req.user;
|
|
882
956
|
|
|
883
957
|
const { data } = await getApi( `${url.oldapidomain}/oldBrandGet/${req.params?.id}` );
|
|
884
958
|
|
|
885
|
-
if (
|
|
886
|
-
data.brandConfigs.storeOpenTime =
|
|
959
|
+
if ( inputData?.open ) {
|
|
960
|
+
data.brandConfigs.storeOpenTime = inputData?.open;
|
|
887
961
|
}
|
|
888
962
|
|
|
889
|
-
if (
|
|
890
|
-
data.brandConfigs.storeCloseTime =
|
|
963
|
+
if ( inputData?.close ) {
|
|
964
|
+
data.brandConfigs.storeCloseTime = inputData?.open;
|
|
891
965
|
}
|
|
892
966
|
|
|
893
|
-
if (
|
|
894
|
-
data.brandConfigs.missedOpportunityCalculate =
|
|
967
|
+
if ( inputData?.missedOpportunityCalculation ) {
|
|
968
|
+
data.brandConfigs.missedOpportunityCalculate = inputData?.missedOpportunityCalculation;
|
|
895
969
|
}
|
|
896
970
|
|
|
897
|
-
if (
|
|
898
|
-
data.brandConfigs.conversionCalculate =
|
|
971
|
+
if ( inputData?.conversionCalculation ) {
|
|
972
|
+
data.brandConfigs.conversionCalculate = inputData?.conversionCalculation;
|
|
899
973
|
}
|
|
900
974
|
|
|
901
|
-
if (
|
|
902
|
-
data.brandConfigs.billableCalculate =
|
|
975
|
+
if ( inputData?.billableCalculation ) {
|
|
976
|
+
data.brandConfigs.billableCalculate = inputData?.billableCalculation;
|
|
903
977
|
}
|
|
904
978
|
|
|
905
|
-
if (
|
|
906
|
-
data.brandConfigs.bouncedConfigTime = data.brandConfigs.bouncedConfigTime.replace( /^.+(?=\d)/,
|
|
907
|
-
data.brandConfigs.missedOpportunityEndTime = data.brandConfigs.missedOpportunityEndTime.replace( /^.+(?=\d)/,
|
|
979
|
+
if ( inputData?.bouncedLimitCondition ) {
|
|
980
|
+
data.brandConfigs.bouncedConfigTime = data.brandConfigs.bouncedConfigTime.replace( /^.+(?=\d)/, inputData?.bouncedLimitCondition );
|
|
981
|
+
data.brandConfigs.missedOpportunityEndTime = data.brandConfigs.missedOpportunityEndTime.replace( /^.+(?=\d)/, inputData?.bouncedLimitCondition );
|
|
908
982
|
}
|
|
909
983
|
|
|
910
|
-
if (
|
|
911
|
-
data.brandConfigs.bouncedConfigTime = data.brandConfigs.bouncedConfigTime.replace( /\d+/,
|
|
912
|
-
data.brandConfigs.missedOpportunityStartTime = data.brandConfigs.missedOpportunityStartTime.replace( /\d+/,
|
|
984
|
+
if ( inputData?.bouncedLimitValue ) {
|
|
985
|
+
data.brandConfigs.bouncedConfigTime = data.brandConfigs.bouncedConfigTime.replace( /\d+/, inputData?.bouncedLimitValue );
|
|
986
|
+
data.brandConfigs.missedOpportunityStartTime = data.brandConfigs.missedOpportunityStartTime.replace( /\d+/, inputData?.bouncedLimitValue );
|
|
913
987
|
}
|
|
914
988
|
|
|
915
|
-
if (
|
|
916
|
-
data.brandConfigs.conversionConfigTime = data.brandConfigs.conversionConfigTime.replace( /^.+(?=\d)/,
|
|
917
|
-
data.brandConfigs.missedOpportunityStartTime = data.brandConfigs.missedOpportunityStartTime.replace( /^.+(?=\d)/,
|
|
989
|
+
if ( inputData?.conversionCondition ) {
|
|
990
|
+
data.brandConfigs.conversionConfigTime = data.brandConfigs.conversionConfigTime.replace( /^.+(?=\d)/, inputData?.conversionCondition );
|
|
991
|
+
data.brandConfigs.missedOpportunityStartTime = data.brandConfigs.missedOpportunityStartTime.replace( /^.+(?=\d)/, inputData?.conversionCondition );
|
|
918
992
|
}
|
|
919
993
|
|
|
920
|
-
if (
|
|
921
|
-
data.brandConfigs.conversionConfigTime = data.brandConfigs.conversionConfigTime.replace( /\d+/,
|
|
922
|
-
data.brandConfigs.missedOpportunityEndTime = data.brandConfigs.missedOpportunityEndTime.replace( /\d+/,
|
|
994
|
+
if ( inputData?.conversionValue ) {
|
|
995
|
+
data.brandConfigs.conversionConfigTime = data.brandConfigs.conversionConfigTime.replace( /\d+/, inputData?.conversionValue );
|
|
996
|
+
data.brandConfigs.missedOpportunityEndTime = data.brandConfigs.missedOpportunityEndTime.replace( /\d+/, inputData?.conversionValue );
|
|
923
997
|
}
|
|
924
998
|
|
|
925
999
|
await postApi( `${url.oldapidomain}/oldBrandUpdate/${data?._id}`, { brandConfigs: data.brandConfigs } );
|
|
@@ -944,8 +1018,9 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
944
1018
|
res.sendSuccess( { result: 'Updated Successfully' } );
|
|
945
1019
|
}
|
|
946
1020
|
} catch ( error ) {
|
|
947
|
-
|
|
948
|
-
|
|
1021
|
+
const err = error.message || 'Internal Server Error';
|
|
1022
|
+
logger.error( { error: error, message: req.params, function: 'updateFeatureConfiguration' } );
|
|
1023
|
+
return res.sendError( err, 500 );
|
|
949
1024
|
}
|
|
950
1025
|
}
|
|
951
1026
|
|
|
@@ -1112,7 +1187,7 @@ export async function updateDocuments( req, res ) {
|
|
|
1112
1187
|
|
|
1113
1188
|
export async function getAuditConfiguration( req, res ) {
|
|
1114
1189
|
try {
|
|
1115
|
-
const query ={
|
|
1190
|
+
const query = {
|
|
1116
1191
|
clientId: req.params?.id,
|
|
1117
1192
|
};
|
|
1118
1193
|
const fields = {
|
|
@@ -1139,14 +1214,14 @@ export async function auditConfiguration( req, res ) {
|
|
|
1139
1214
|
try {
|
|
1140
1215
|
const inputData = req.body;
|
|
1141
1216
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
1142
|
-
const query ={
|
|
1217
|
+
const query = {
|
|
1143
1218
|
clientId: req.params?.id,
|
|
1144
1219
|
};
|
|
1145
|
-
const fields ={
|
|
1220
|
+
const fields = {
|
|
1146
1221
|
auditConfigs: 1, _id: 0,
|
|
1147
1222
|
};
|
|
1148
1223
|
const previousClient = await findOneClient( query, fields );
|
|
1149
|
-
const record ={
|
|
1224
|
+
const record = {
|
|
1150
1225
|
'auditConfigs.count': inputData.count,
|
|
1151
1226
|
'auditConfigs.audit': inputData.audit,
|
|
1152
1227
|
'auditConfigs.ratio': Number( normalizeNumber( inputData.ratio, 0, 100 ) ),
|
|
@@ -1760,10 +1835,12 @@ export async function clientListV1( req, res ) {
|
|
|
1760
1835
|
clientId: { $toInt: '$clientId' },
|
|
1761
1836
|
onboardedStores: 1,
|
|
1762
1837
|
installedStore: 1,
|
|
1763
|
-
activeStores: {
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1838
|
+
activeStores: {
|
|
1839
|
+
$max: [
|
|
1840
|
+
{ $subtract: [ '$activeStores', '$installedPending' ] },
|
|
1841
|
+
0,
|
|
1842
|
+
],
|
|
1843
|
+
},
|
|
1767
1844
|
InactiveStores: 1,
|
|
1768
1845
|
ProcessingStatus: 1,
|
|
1769
1846
|
clientName: 1,
|
|
@@ -1805,8 +1882,8 @@ export async function clientListV1( req, res ) {
|
|
|
1805
1882
|
return res.sendError( 'No Data Found', 204 );
|
|
1806
1883
|
}
|
|
1807
1884
|
|
|
1808
|
-
if ( inputData.sortColumName&&inputData.sortColumName!=''&& req.body.sortBy&&req.body.sortBy!='' ) {
|
|
1809
|
-
if ( inputData.sortColumName==='clientName' ) {
|
|
1885
|
+
if ( inputData.sortColumName && inputData.sortColumName != '' && req.body.sortBy && req.body.sortBy != '' ) {
|
|
1886
|
+
if ( inputData.sortColumName === 'clientName' ) {
|
|
1810
1887
|
clientQuery.push(
|
|
1811
1888
|
{
|
|
1812
1889
|
$project: {
|
|
@@ -1858,15 +1935,15 @@ export async function clientListV1( req, res ) {
|
|
|
1858
1935
|
exportResult.push( {
|
|
1859
1936
|
'Brand Name': client.clientName,
|
|
1860
1937
|
'Brand ID': client.clientId,
|
|
1861
|
-
'Onboarded Stores': client.onboardedStores||0,
|
|
1938
|
+
'Onboarded Stores': client.onboardedStores || 0,
|
|
1862
1939
|
'Installed Stores': client.installedStore || 0,
|
|
1863
|
-
'Progress Status': client.ProgressBar||0,
|
|
1940
|
+
'Progress Status': client.ProgressBar || 0,
|
|
1864
1941
|
'Active Stores': client.activeStores || 0,
|
|
1865
1942
|
'In-Active Stores': client.InactiveStores || 0,
|
|
1866
1943
|
'Pending Configuration': client.installedPending || 0,
|
|
1867
|
-
'Payment Plan': client.PaymentPlan == 'free'?'Lifetime Free':client.PaymentPlan,
|
|
1944
|
+
'Payment Plan': client.PaymentPlan == 'free' ? 'Lifetime Free' : client.PaymentPlan,
|
|
1868
1945
|
'Subscription Plan': client.subscriptionPlan,
|
|
1869
|
-
'Processing Status': client.ProcessingStatus=='active'?'Activated':client.ProcessingStatus=='deactive'?'Deactivated':client.ProcessingStatus,
|
|
1946
|
+
'Processing Status': client.ProcessingStatus == 'active' ? 'Activated' : client.ProcessingStatus == 'deactive' ? 'Deactivated' : client.ProcessingStatus,
|
|
1870
1947
|
} );
|
|
1871
1948
|
}
|
|
1872
1949
|
await download( exportResult, res );
|
|
@@ -1903,6 +1980,8 @@ export async function detailedClientCount( req, res ) {
|
|
|
1903
1980
|
};
|
|
1904
1981
|
result['totalStoreCount'] = await countDocumentsStore( { clientId: inputData.clientId } );
|
|
1905
1982
|
result['totalGroupCount'] = await countDocumentsGroup( { clientId: inputData.clientId, isActive: true } );
|
|
1983
|
+
result['totalclusterCount'] = await countDocumentsClusters( { clientId: inputData.clientId } );
|
|
1984
|
+
result['totalTeamsCount'] = await countDocumentsTeams( { clientId: inputData.clientId } );
|
|
1906
1985
|
result['totalCameraCount'] = await countDocumentsCamera( { clientId: inputData.clientId } );
|
|
1907
1986
|
result['totalUserCount'] = await countDocumentsUser( { clientId: inputData.clientId, userType: 'client' } );
|
|
1908
1987
|
|
|
@@ -1929,7 +2008,7 @@ export async function detailedClientCount( req, res ) {
|
|
|
1929
2008
|
},
|
|
1930
2009
|
] );
|
|
1931
2010
|
|
|
1932
|
-
if ( findCsm&&findCsm.length>0 ) {
|
|
2011
|
+
if ( findCsm && findCsm.length > 0 ) {
|
|
1933
2012
|
let finduser = await findOneUser( { email: findCsm[0].userEmail }, { userName: 1, email: 1, countryCode: 1, mobileNumber: 1 } );
|
|
1934
2013
|
result['csm'] = finduser;
|
|
1935
2014
|
}
|
package/src/dtos/client.dtos.js
CHANGED
|
@@ -128,43 +128,39 @@ export function ticketConfigurationUpdate( {
|
|
|
128
128
|
} );
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
export function featureConfigurationUpdate( {
|
|
132
|
-
|
|
133
|
-
close, conversionCalculation, conversionCondition,
|
|
134
|
-
conversionValue, infraAlertCondition, infraAlertValue, isFootfallDirectory,
|
|
135
|
-
isNormalized, isPasserByData, missedOpportunityCalculation, open, isExcludedArea,
|
|
136
|
-
isCameraDisabled, isbillingDisabled, isNewDashboard, isFootfallAuditStores, isNewTraffic,
|
|
137
|
-
isNewZone, isNewReports, isNOB, isNewZoneV2, isTrax,
|
|
138
|
-
} ) {
|
|
139
|
-
return clientModel.updateOne( { clientId: clientId },
|
|
131
|
+
export function featureConfigurationUpdate( query, inputData ) {
|
|
132
|
+
return clientModel.updateOne( query,
|
|
140
133
|
{
|
|
141
134
|
$set: {
|
|
142
|
-
'featureConfigs.open': open,
|
|
143
|
-
'featureConfigs.close': close,
|
|
144
|
-
'featureConfigs.infraAlert.condition': infraAlertCondition,
|
|
145
|
-
'featureConfigs.infraAlert.value': infraAlertValue,
|
|
146
|
-
'featureConfigs.bouncedLimit.condition': bouncedLimitCondition,
|
|
147
|
-
'featureConfigs.bouncedLimit.value': bouncedLimitValue,
|
|
148
|
-
'featureConfigs.conversion.condition': conversionCondition,
|
|
149
|
-
'featureConfigs.conversion.value': conversionValue,
|
|
150
|
-
'featureConfigs.
|
|
151
|
-
'featureConfigs.
|
|
152
|
-
'featureConfigs.
|
|
153
|
-
'featureConfigs.
|
|
154
|
-
'featureConfigs.
|
|
155
|
-
'featureConfigs.
|
|
156
|
-
'featureConfigs.
|
|
135
|
+
'featureConfigs.open': inputData?.open,
|
|
136
|
+
'featureConfigs.close': inputData?.close,
|
|
137
|
+
'featureConfigs.infraAlert.condition': inputData?.infraAlertCondition,
|
|
138
|
+
'featureConfigs.infraAlert.value': inputData?.infraAlertValue,
|
|
139
|
+
'featureConfigs.bouncedLimit.condition': inputData?.bouncedLimitCondition,
|
|
140
|
+
'featureConfigs.bouncedLimit.value': inputData?.bouncedLimitValue,
|
|
141
|
+
'featureConfigs.conversion.condition': inputData?.conversionCondition,
|
|
142
|
+
'featureConfigs.conversion.value': inputData?.conversionValue,
|
|
143
|
+
'featureConfigs.missedOpportunityFrom.value': inputData?.missedOpportunityFromValue,
|
|
144
|
+
'featureConfigs.missedOpportunityTo.value': inputData?.missedOpportunityToValue,
|
|
145
|
+
'featureConfigs.billableCalculation': inputData?.billableCalculation,
|
|
146
|
+
'featureConfigs.missedOpportunityCalculation': inputData?.missedOpportunityCalculation,
|
|
147
|
+
'featureConfigs.conversionCalculation': inputData?.conversionCalculation,
|
|
148
|
+
'featureConfigs.isNormalized': inputData?.isNormalized,
|
|
149
|
+
'featureConfigs.isPasserByData': inputData?.isPasserByData,
|
|
150
|
+
'featureConfigs.isFootfallDirectory': inputData?.isFootfallDirectory,
|
|
151
|
+
'featureConfigs.isExcludedArea': inputData?.isExcludedArea,
|
|
157
152
|
'featureConfigs.updateFeatureConfig': false,
|
|
158
|
-
'featureConfigs.isCameraDisabled': isCameraDisabled,
|
|
159
|
-
'featureConfigs.isbillingDisabled': isbillingDisabled,
|
|
160
|
-
'featureConfigs.isNewDashboard': isNewDashboard,
|
|
161
|
-
'featureConfigs.isFootfallAuditStores': isFootfallAuditStores,
|
|
162
|
-
'featureConfigs.isNewTraffic': isNewTraffic,
|
|
163
|
-
'featureConfigs.isNewZone': isNewZone,
|
|
164
|
-
'featureConfigs.isNewReports': isNewReports,
|
|
165
|
-
'featureConfigs.isNOB': isNOB,
|
|
166
|
-
'featureConfigs.isNewZoneV2': isNewZoneV2,
|
|
167
|
-
'featureConfigs.isTrax': isTrax,
|
|
153
|
+
'featureConfigs.isCameraDisabled': inputData?.isCameraDisabled,
|
|
154
|
+
'featureConfigs.isbillingDisabled': inputData?.isbillingDisabled,
|
|
155
|
+
'featureConfigs.isNewDashboard': inputData?.isNewDashboard,
|
|
156
|
+
'featureConfigs.isFootfallAuditStores': inputData?.isFootfallAuditStores,
|
|
157
|
+
'featureConfigs.isNewTraffic': inputData?.isNewTraffic,
|
|
158
|
+
'featureConfigs.isNewZone': inputData?.isNewZone,
|
|
159
|
+
'featureConfigs.isNewReports': inputData?.isNewReports,
|
|
160
|
+
'featureConfigs.isNOB': inputData?.isNOB,
|
|
161
|
+
'featureConfigs.isNewZoneV2': inputData?.isNewZoneV2,
|
|
162
|
+
'featureConfigs.isTrax': inputData?.isTrax,
|
|
163
|
+
'featureConfigs.isControlCenter': inputData?.isControlCenter,
|
|
168
164
|
},
|
|
169
165
|
} );
|
|
170
166
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import clusterModel from 'tango-api-schema/schema/cluster.model.js';
|
|
2
|
+
|
|
3
|
+
export async function updateOneCluster( query, record ) {
|
|
4
|
+
return await clusterModel.updateOne( query, { $set: record } );
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export async function updateCluster( query, record ) {
|
|
8
|
+
return await clusterModel.updateMany( query, record );
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export async function aggregateCluster( query ) {
|
|
12
|
+
return await clusterModel.aggregate( query );
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export async function findOneCluster( query ={}, field={} ) {
|
|
16
|
+
return await clusterModel.findOne( query, field );
|
|
17
|
+
};
|
|
18
|
+
export async function deleteCluster( query ={} ) {
|
|
19
|
+
return await clusterModel.deleteOne( query );
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export async function createclusterModel( data ) {
|
|
23
|
+
return await clusterModel.create( data );
|
|
24
|
+
};
|
|
25
|
+
export function countDocumentsClusters( query ) {
|
|
26
|
+
return clusterModel.countDocuments( query );
|
|
27
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import teamsModel from 'tango-api-schema/schema/teams.model.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export async function createTeamsModel( data ) {
|
|
5
|
+
return await teamsModel.create( data );
|
|
6
|
+
};
|
|
7
|
+
export async function updateOneTeams( query, record ) {
|
|
8
|
+
return await teamsModel.updateOne( query, { $set: record }, { upsert: true } );
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export async function aggregateTeams( query ) {
|
|
12
|
+
return await teamsModel.aggregate( query );
|
|
13
|
+
};
|
|
14
|
+
export async function deleteTeams( query ={} ) {
|
|
15
|
+
return await teamsModel.deleteOne( query );
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export async function findOneTeams( query ={}, field={} ) {
|
|
19
|
+
return await teamsModel.findOne( query, field );
|
|
20
|
+
};
|
|
21
|
+
export async function findteams( query ={}, field={} ) {
|
|
22
|
+
return await teamsModel.find( query, field );
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export async function updateOneTeamModel( query, record ) {
|
|
26
|
+
return await teamsModel.updateOne( query, record );
|
|
27
|
+
}
|
|
28
|
+
export function countDocumentsTeams( query ) {
|
|
29
|
+
return teamsModel.countDocuments( query );
|
|
30
|
+
}
|