tango-app-api-client 3.0.0 → 3.0.2
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 +7 -3
- package/src/controllers/client.controllers.js +577 -3
- package/src/dtos/client.dtos.js +231 -0
- package/src/routes/client.routes.js +24 -6
- package/src/service/camera.service.js +9 -0
- package/src/service/client.service.js +239 -8
- package/src/service/store.service.js +9 -0
- package/src/service/user.service.js +9 -0
- package/src/services/client.services.js +263 -0
- package/src/validations/client.validations.js +22 -2
package/src/dtos/client.dtos.js
CHANGED
|
@@ -1,10 +1,241 @@
|
|
|
1
1
|
import joi from 'joi';
|
|
2
2
|
|
|
3
|
+
export const clientDetailsSchema = joi.object( {
|
|
4
|
+
id: joi.string().required(),
|
|
5
|
+
} );
|
|
6
|
+
|
|
7
|
+
export const clientDetailsValid = {
|
|
8
|
+
params: clientDetailsSchema,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const brandInfoSchemaBody = joi.object( {
|
|
12
|
+
registeredCompanyName: joi.string().optional(),
|
|
13
|
+
industry: joi.string().optional(),
|
|
14
|
+
clientType: joi.string().optional(),
|
|
15
|
+
registeredAddress: joi.string().optional(),
|
|
16
|
+
headQuarters: joi.string().optional(),
|
|
17
|
+
website: joi.string().optional(),
|
|
18
|
+
status: joi.string().optional(),
|
|
19
|
+
logo: joi.string().optional().allow( '' ),
|
|
20
|
+
clientId: joi.string().optional(),
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
export const brandInfoSchemaParam = joi.object( {
|
|
24
|
+
id: joi.string().required(),
|
|
25
|
+
} );
|
|
26
|
+
|
|
27
|
+
export const brandInfoValid = {
|
|
28
|
+
params: brandInfoSchemaParam,
|
|
29
|
+
body: brandInfoSchemaBody,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const billingDetailsSchemaBody = joi.object( {
|
|
33
|
+
tradeName: joi.string().optional(),
|
|
34
|
+
gstNumber: joi.string().optional(),
|
|
35
|
+
authorityName: joi.string().optional(),
|
|
36
|
+
authorityEmail: joi.string().optional(),
|
|
37
|
+
billingAddress: joi.string().optional(),
|
|
38
|
+
gstCertificate: joi.string().optional().allow( '' ),
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
export const billingDetailsSchemaParam = joi.object( {
|
|
42
|
+
id: joi.string().required(),
|
|
43
|
+
} );
|
|
44
|
+
|
|
45
|
+
export const billingDetailsValid = {
|
|
46
|
+
params: billingDetailsSchemaParam,
|
|
47
|
+
body: billingDetailsSchemaBody,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const signatoryDetailsSchemaBody = joi.object( {
|
|
51
|
+
name: joi.string().optional(),
|
|
52
|
+
email: joi.string().email().optional(),
|
|
53
|
+
number: joi.string().optional(),
|
|
54
|
+
designation: joi.string().optional(),
|
|
55
|
+
} );
|
|
56
|
+
|
|
57
|
+
export const signatoryDetailsSchemaParam = joi.object( {
|
|
58
|
+
id: joi.string().required(),
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
export const signatoryDetailsValid = {
|
|
62
|
+
params: signatoryDetailsSchemaParam,
|
|
63
|
+
body: signatoryDetailsSchemaBody,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const ticketConfigurationSchemaBody = joi.object( {
|
|
67
|
+
installationReAssign: joi.number().optional(),
|
|
68
|
+
sendToAdmin: joi.boolean().optional(),
|
|
69
|
+
sendToUser: joi.boolean().optional(),
|
|
70
|
+
downTimeType: joi.number().optional(),
|
|
71
|
+
infraDownTime: joi.number().optional(),
|
|
72
|
+
MinFilesCount: joi.number().optional(),
|
|
73
|
+
isRcaTicketAssign: joi.boolean().optional(),
|
|
74
|
+
rcaTicketAssign: joi.number().optional(),
|
|
75
|
+
isRefreshAlert: joi.boolean().optional(),
|
|
76
|
+
refreshAlert: joi.number().optional(),
|
|
77
|
+
isStatusCheckAlert: joi.boolean().optional(),
|
|
78
|
+
statusCheckAlert: joi.number().optional(),
|
|
79
|
+
accuracyPercentage: joi.number().optional(),
|
|
80
|
+
reTrain: joi.number().optional(),
|
|
81
|
+
} );
|
|
82
|
+
|
|
83
|
+
export const ticketConfigurationSchemaParam = joi.object( {
|
|
84
|
+
id: joi.string().required(),
|
|
85
|
+
} );
|
|
86
|
+
|
|
87
|
+
export const ticketConfigurationValid = {
|
|
88
|
+
params: ticketConfigurationSchemaParam,
|
|
89
|
+
body: ticketConfigurationSchemaBody,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const featureConfigurationSchemaBody = joi.object(
|
|
93
|
+
{
|
|
94
|
+
open: joi.string().optional(),
|
|
95
|
+
close: joi.string().optional(),
|
|
96
|
+
infraAlertCondition: joi.string().optional(),
|
|
97
|
+
infraAlertValue: joi.number().optional(),
|
|
98
|
+
bouncedLimitCondition: joi.string().optional(),
|
|
99
|
+
bouncedLimitValue: joi.number().optional(),
|
|
100
|
+
conversionCondition: joi.string().optional(),
|
|
101
|
+
conversionValue: joi.number().optional(),
|
|
102
|
+
billableCalculation: joi.string().optional(),
|
|
103
|
+
missedOpportunityCalculation: joi.string().optional(),
|
|
104
|
+
conversionCalculation: joi.string().optional(),
|
|
105
|
+
isNormalized: joi.boolean().optional(),
|
|
106
|
+
isPasserByData: joi.boolean().optional(),
|
|
107
|
+
isFootfallDirectory: joi.boolean().optional(),
|
|
108
|
+
},
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
export const featureConfigurationSchemaParam = joi.object( {
|
|
112
|
+
id: joi.string().required(),
|
|
113
|
+
} );
|
|
114
|
+
|
|
115
|
+
export const featureConfigurationValid = {
|
|
116
|
+
params: featureConfigurationSchemaParam,
|
|
117
|
+
body: featureConfigurationSchemaBody,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const domainDetailsSchemaBody = joi.object(
|
|
121
|
+
{
|
|
122
|
+
domainName: joi.array().items( joi.string() ).required(),
|
|
123
|
+
isEnable: joi.boolean().required(),
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
export const domainDetailsSchemaParam = joi.object( {
|
|
128
|
+
id: joi.string().required(),
|
|
129
|
+
} );
|
|
130
|
+
|
|
131
|
+
export const domainDetailsValid = {
|
|
132
|
+
params: domainDetailsSchemaParam,
|
|
133
|
+
body: domainDetailsSchemaBody,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const userConfigurationSchemaBody = joi.object(
|
|
137
|
+
{
|
|
138
|
+
csm: joi.object( { userName: joi.string().required(), _id: joi.string().required() } ).required(),
|
|
139
|
+
ops: joi.array().items( joi.object( { userName: joi.string().required(), _id: joi.string().required() } ).required() ).required(),
|
|
140
|
+
},
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
export const userConfigurationSchemaParam = joi.object( {
|
|
144
|
+
id: joi.string().required(),
|
|
145
|
+
} );
|
|
146
|
+
|
|
147
|
+
export const userConfigurationValid = {
|
|
148
|
+
params: userConfigurationSchemaParam,
|
|
149
|
+
body: userConfigurationSchemaBody,
|
|
150
|
+
};
|
|
151
|
+
|
|
3
152
|
export const clientCreationSchema = joi.object( {
|
|
4
153
|
status: joi.string().required(),
|
|
5
154
|
clientName: joi.string().required(),
|
|
155
|
+
csm: joi.string().optional(),
|
|
6
156
|
} );
|
|
7
157
|
|
|
8
158
|
export const clientCreationValid = {
|
|
9
159
|
body: clientCreationSchema,
|
|
10
160
|
};
|
|
161
|
+
|
|
162
|
+
export const documentsSchemaBody = joi.object(
|
|
163
|
+
{
|
|
164
|
+
gstNumber: joi.string().optional(),
|
|
165
|
+
panNumber: joi.string().optional(),
|
|
166
|
+
cinNumber: joi.string().optional(),
|
|
167
|
+
addressDoc: joi.string().optional().allow( '' ),
|
|
168
|
+
gstDoc: joi.string().optional().allow( '' ),
|
|
169
|
+
panDoc: joi.string().optional().allow( '' ),
|
|
170
|
+
cinDoc: joi.string().optional().allow( '' ),
|
|
171
|
+
},
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
export const documentsSchemaParam = joi.object( {
|
|
175
|
+
id: joi.string().required(),
|
|
176
|
+
} );
|
|
177
|
+
|
|
178
|
+
export const documentsSchemaFiles = joi.object(
|
|
179
|
+
{
|
|
180
|
+
addressDoc: joi.object().optional(),
|
|
181
|
+
gstDoc: joi.object().optional(),
|
|
182
|
+
panDoc: joi.object().optional(),
|
|
183
|
+
cinDoc: joi.object().optional(),
|
|
184
|
+
},
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
export const documentsValid = {
|
|
188
|
+
params: documentsSchemaParam,
|
|
189
|
+
body: documentsSchemaBody,
|
|
190
|
+
files: documentsSchemaFiles,
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export const getAuditConfigSchemaParam = joi.object( {
|
|
194
|
+
id: joi.string().required(),
|
|
195
|
+
} );
|
|
196
|
+
|
|
197
|
+
export const getAuditConfigValid = {
|
|
198
|
+
params: getAuditConfigSchemaParam,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
export const auditConfigSchemaBody = joi.array().items(
|
|
203
|
+
joi.object(
|
|
204
|
+
{
|
|
205
|
+
ratio: joi.number().required(),
|
|
206
|
+
count: joi.number().required(),
|
|
207
|
+
iteration: joi.number().required(),
|
|
208
|
+
storeId: joi.string().required(),
|
|
209
|
+
},
|
|
210
|
+
).required(),
|
|
211
|
+
).required();
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
export const auditConfigValid = {
|
|
215
|
+
body: auditConfigSchemaBody,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
export const detailedClientCountSchema = joi.object( {
|
|
220
|
+
clientId: joi.string().required(),
|
|
221
|
+
} );
|
|
222
|
+
|
|
223
|
+
export const detailedClientCountValid = {
|
|
224
|
+
query: detailedClientCountSchema,
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const clientListSchema = joi.object( {
|
|
228
|
+
isExport: joi.boolean().optional(),
|
|
229
|
+
searchValue: joi.string().optional(),
|
|
230
|
+
sortColumName: joi.string().optional(),
|
|
231
|
+
sortBy: joi.number().optional(),
|
|
232
|
+
filterByPaymentStatus: joi.array().optional(),
|
|
233
|
+
filterBySubscription: joi.array().optional(),
|
|
234
|
+
filterByStatus: joi.array().optional(),
|
|
235
|
+
limit: joi.number().optional(),
|
|
236
|
+
offset: joi.number().optional(),
|
|
237
|
+
} );
|
|
238
|
+
|
|
239
|
+
export const clientListValid = {
|
|
240
|
+
body: clientListSchema,
|
|
241
|
+
};
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
|
|
2
2
|
import express from 'express';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { auditConfigValid, billingDetailsValid, brandInfoValid, clientCreationValid, clientDetailsValid, documentsValid, domainDetailsValid, featureConfigurationValid, getAuditConfigValid, signatoryDetailsValid, ticketConfigurationValid, userConfigurationValid } from '../dtos/client.dtos.js';
|
|
4
|
+
import { auditConfiguration, changeStatus, clientDetails, create, domainDetailsConfiguration, getAuditConfiguration, getClients, getCsmUsers, getOpsUsers, updateBillingDetails, updateBrandInfo, updateDocuments, updateFeatureConfiguration, updateSignatoryDetails, updateTicketConfiguration, userConfiguration } from '../controllers/client.controllers.js';
|
|
5
|
+
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
6
|
+
import { clientListValid, detailedClientCountValid } from '../dtos/client.dtos.js';
|
|
7
|
+
import { isclientIdExists, isclientNameExists } from '../validations/client.validations.js';
|
|
8
|
+
import { detailedAllClientCount, detailedClientCount, clientList } from '../controllers/client.controllers.js';
|
|
7
9
|
|
|
8
10
|
export const clientRouter = express.Router();
|
|
9
11
|
|
|
10
|
-
clientRouter.post( '/create', validate( clientCreationValid ), isclientNameExists, changeStatus, create );
|
|
11
|
-
clientRouter.get( '/get-clients', getClients );
|
|
12
|
+
clientRouter.post( '/create', isAllowedSessionHandler, validate( clientCreationValid ), isclientNameExists, changeStatus, create );
|
|
13
|
+
clientRouter.get( '/get-clients', isAllowedSessionHandler, getClients );
|
|
14
|
+
clientRouter.get( '/client-details/:id', isAllowedSessionHandler, validate( clientDetailsValid ), clientDetails );
|
|
15
|
+
clientRouter.put( '/brand-info/:id', isAllowedSessionHandler, validate( brandInfoValid ), updateBrandInfo );
|
|
16
|
+
clientRouter.put( '/billing-details/:id', isAllowedSessionHandler, validate( billingDetailsValid ), updateBillingDetails );
|
|
17
|
+
clientRouter.put( '/signatory-details/:id', isAllowedSessionHandler, validate( signatoryDetailsValid ), updateSignatoryDetails );
|
|
18
|
+
clientRouter.put( '/ticket-configuration/:id', isAllowedSessionHandler, validate( ticketConfigurationValid ), updateTicketConfiguration );
|
|
19
|
+
clientRouter.put( '/feature-configuration/:id', isAllowedSessionHandler, validate( featureConfigurationValid ), updateFeatureConfiguration );
|
|
20
|
+
clientRouter.put( '/domain-details/:id', isAllowedSessionHandler, validate( domainDetailsValid ), domainDetailsConfiguration );
|
|
21
|
+
clientRouter.put( '/user-configuration/:id', isAllowedSessionHandler, validate( userConfigurationValid ), userConfiguration );
|
|
22
|
+
clientRouter.put( '/documents/:id', isAllowedSessionHandler, validate( documentsValid ), updateDocuments );
|
|
23
|
+
clientRouter.get( '/audit-configuration/:id', isAllowedSessionHandler, validate( getAuditConfigValid ), getAuditConfiguration );
|
|
24
|
+
clientRouter.post( '/audit-configuration', isAllowedSessionHandler, validate( auditConfigValid ), auditConfiguration );
|
|
25
|
+
clientRouter.get( '/get-csm-users', isAllowedSessionHandler, getCsmUsers );
|
|
26
|
+
clientRouter.get( '/get-ops-users', isAllowedSessionHandler, getOpsUsers );
|
|
27
|
+
clientRouter.get( '/detailed-all-client-count', isAllowedSessionHandler, detailedAllClientCount );
|
|
28
|
+
clientRouter.post( '/client-list', isAllowedSessionHandler, validate( clientListValid ), clientList );
|
|
29
|
+
clientRouter.get( '/detailed-client-count', isAllowedSessionHandler, validate( detailedClientCountValid ), isclientIdExists, detailedClientCount );
|
|
12
30
|
|
|
13
31
|
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import clientModel from 'tango-api-schema/schema/client.model.js';
|
|
2
|
+
import leadModel from 'tango-api-schema/schema/lead.model.js';
|
|
3
|
+
import storeModel from 'tango-api-schema/schema/store.model.js';
|
|
4
|
+
import userModel from 'tango-api-schema/schema/user.model.js';
|
|
2
5
|
// import { createQueue, getQueueUrl } from 'tango-app-api-middleware';
|
|
3
6
|
|
|
7
|
+
|
|
4
8
|
export function update( query, record ) {
|
|
5
|
-
return
|
|
9
|
+
return leadModel.updateMany( query, { $set: record } );
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
export function findOne( query, field ) {
|
|
9
|
-
return
|
|
13
|
+
return leadModel.findOne( query, field );
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
export function getClientCount( query ) {
|
|
13
|
-
return
|
|
17
|
+
return clientModel.countDocuments( query );
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
export function insert( record ) {
|
|
17
|
-
return
|
|
21
|
+
return clientModel.insertMany( record );
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
export function
|
|
21
|
-
return
|
|
24
|
+
export function findClient( query, field ) {
|
|
25
|
+
return clientModel.find( query, field );
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
export async function createAuditQueue( queueName ) {
|
|
@@ -39,8 +43,235 @@ export async function createAuditQueue( queueName ) {
|
|
|
39
43
|
// }
|
|
40
44
|
return true;
|
|
41
45
|
} catch ( error ) {
|
|
42
|
-
return false;
|
|
43
46
|
logger.error( { error: error, message: queueName, function: 'createAuditQueue' } );
|
|
47
|
+
return false;
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
|
|
51
|
+
|
|
52
|
+
export function getClientData( { id } ) {
|
|
53
|
+
return clientModel.findOne( { clientId: id } );
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getUserData( { id } ) {
|
|
57
|
+
return userModel.findOne( { _id: id }, { email: 1, countryCode: 1, mobileNumber: 1 } );
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function brandInfoUpdate( { clientId, registeredCompanyName, industry, clientType, registeredAddress, headQuarters, website, status, logo } ) {
|
|
61
|
+
return clientModel.updateOne( { clientId: clientId },
|
|
62
|
+
{
|
|
63
|
+
$set: {
|
|
64
|
+
'profileDetails.registeredCompanyName': registeredCompanyName,
|
|
65
|
+
'profileDetails.industry': industry,
|
|
66
|
+
'profileDetails.clientType': clientType,
|
|
67
|
+
'profileDetails.registeredAddress': registeredAddress,
|
|
68
|
+
'profileDetails.headQuarters': headQuarters,
|
|
69
|
+
'profileDetails.website': website,
|
|
70
|
+
'profileDetails.logo': logo,
|
|
71
|
+
'status': status,
|
|
72
|
+
},
|
|
73
|
+
} );
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function billingDetailsUpdate( { clientId, tradeName, gstNumber, authorityName, authorityEmail, billingAddress, gstCertificate } ) {
|
|
77
|
+
return clientModel.updateOne( { clientId: clientId },
|
|
78
|
+
{
|
|
79
|
+
$set: {
|
|
80
|
+
'billingDetails.tradeName': tradeName,
|
|
81
|
+
'billingDetails.gstNumber': gstNumber,
|
|
82
|
+
'billingDetails.authorityName': authorityName,
|
|
83
|
+
'billingDetails.authorityEmail': authorityEmail,
|
|
84
|
+
'billingDetails.billingAddress': billingAddress,
|
|
85
|
+
'document.gst.number': gstNumber,
|
|
86
|
+
'document.gst.path': gstCertificate,
|
|
87
|
+
},
|
|
88
|
+
} );
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function signatoryDetailsUpdate( { clientId, name, email, number, designation } ) {
|
|
92
|
+
return clientModel.updateOne( { clientId: clientId },
|
|
93
|
+
{
|
|
94
|
+
$set: {
|
|
95
|
+
'signatoryDetail.name': name,
|
|
96
|
+
'signatoryDetail.email': email,
|
|
97
|
+
'signatoryDetail.number': number,
|
|
98
|
+
'signatoryDetail.designation': designation,
|
|
99
|
+
},
|
|
100
|
+
} );
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function ticketConfigurationUpdate( {
|
|
104
|
+
clientId, MinFilesCount, accuracyPercentage, downTimeType, infraDownTime, installationReAssign, isRcaTicketAssign,
|
|
105
|
+
isRefreshAlert, isStatusCheckAlert, rcaTicketAssign, reTrain, refreshAlert, sendToAdmin, sendToUser, statusCheckAlert,
|
|
106
|
+
} ) {
|
|
107
|
+
return clientModel.updateOne( { clientId: clientId },
|
|
108
|
+
{
|
|
109
|
+
$set: {
|
|
110
|
+
'ticketConfigs.installationReAssign': installationReAssign,
|
|
111
|
+
'ticketConfigs.alertSentTo.admin': sendToAdmin,
|
|
112
|
+
'ticketConfigs.alertSentTo.user': sendToUser,
|
|
113
|
+
'ticketConfigs.downTimeType': downTimeType,
|
|
114
|
+
'ticketConfigs.infraDownTime': infraDownTime,
|
|
115
|
+
'ticketConfigs.MinFilesCount': MinFilesCount,
|
|
116
|
+
'ticketConfigs.isRcaTicketAssign': isRcaTicketAssign,
|
|
117
|
+
'ticketConfigs.rcaTicketAssign': rcaTicketAssign,
|
|
118
|
+
'ticketConfigs.isRefreshAlert': isRefreshAlert,
|
|
119
|
+
'ticketConfigs.refreshAlert': refreshAlert,
|
|
120
|
+
'ticketConfigs.isStatusCheckAlert': isStatusCheckAlert,
|
|
121
|
+
'ticketConfigs.statusCheckAlert': statusCheckAlert,
|
|
122
|
+
'ticketConfigs.reTrain': reTrain,
|
|
123
|
+
'ticketConfigs.accuracyPercentage': accuracyPercentage,
|
|
124
|
+
},
|
|
125
|
+
} );
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function featureConfigurationUpdate( {
|
|
129
|
+
clientId, billableCalculation, bouncedLimitCondition, bouncedLimitValue,
|
|
130
|
+
close, conversionCalculation, conversionCondition,
|
|
131
|
+
conversionValue, infraAlertCondition, infraAlertValue, isFootfallDirectory,
|
|
132
|
+
isNormalized, isPasserByData, missedOpportunityCalculation, open,
|
|
133
|
+
} ) {
|
|
134
|
+
return clientModel.updateOne( { clientId: clientId },
|
|
135
|
+
{
|
|
136
|
+
$set: {
|
|
137
|
+
'featureConfigs.open': open,
|
|
138
|
+
'featureConfigs.close': close,
|
|
139
|
+
'featureConfigs.infraAlert.condition': infraAlertCondition,
|
|
140
|
+
'featureConfigs.infraAlert.value': infraAlertValue,
|
|
141
|
+
'featureConfigs.bouncedLimit.condition': bouncedLimitCondition,
|
|
142
|
+
'featureConfigs.bouncedLimit.value': bouncedLimitValue,
|
|
143
|
+
'featureConfigs.conversion.condition': conversionCondition,
|
|
144
|
+
'featureConfigs.conversion.value': conversionValue,
|
|
145
|
+
'featureConfigs.billableCalculation': billableCalculation,
|
|
146
|
+
'featureConfigs.missedOpportunityCalculation': missedOpportunityCalculation,
|
|
147
|
+
'featureConfigs.conversionCalculation': conversionCalculation,
|
|
148
|
+
'featureConfigs.isNormalized': isNormalized,
|
|
149
|
+
'featureConfigs.isPasserByData': isPasserByData,
|
|
150
|
+
'featureConfigs.isFootfallDirectory': isFootfallDirectory,
|
|
151
|
+
},
|
|
152
|
+
} );
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function domainDetailsConfigurationUpdate( { clientId, domainName, isEnable } ) {
|
|
156
|
+
return clientModel.updateOne( { clientId: clientId },
|
|
157
|
+
{
|
|
158
|
+
$set: {
|
|
159
|
+
'ssoLogin.domainName': domainName,
|
|
160
|
+
'ssoLogin.isEnable': isEnable,
|
|
161
|
+
},
|
|
162
|
+
} );
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function userConfigurationUpdate( { clientId, csm, ops } ) {
|
|
166
|
+
return clientModel.updateOne( { clientId: clientId },
|
|
167
|
+
{
|
|
168
|
+
$set: {
|
|
169
|
+
'assignedUsers.csm': csm,
|
|
170
|
+
'assignedUsers.ops': ops,
|
|
171
|
+
},
|
|
172
|
+
} );
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function documentsUpdate( { clientId, gstNumber, panNumber, cinNumber, addressDoc, gstDoc, panDoc, cinDoc } ) {
|
|
176
|
+
return clientModel.updateOne( { clientId: clientId },
|
|
177
|
+
{
|
|
178
|
+
$set: {
|
|
179
|
+
'document.addressProof.path': addressDoc,
|
|
180
|
+
'document.gst.number': gstNumber,
|
|
181
|
+
'document.gst.path': gstDoc,
|
|
182
|
+
'document.pan.number': panNumber,
|
|
183
|
+
'document.pan.path': panDoc,
|
|
184
|
+
'document.pan.number': panNumber,
|
|
185
|
+
'document.pan.path': panDoc,
|
|
186
|
+
'document.cin.number': cinNumber,
|
|
187
|
+
'document.cin.path': cinDoc,
|
|
188
|
+
},
|
|
189
|
+
} );
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function auditConfigurationGet( { storeId } ) {
|
|
193
|
+
return storeModel.findOne( { storeId: storeId },
|
|
194
|
+
{
|
|
195
|
+
'auditConfigs.count': 1,
|
|
196
|
+
'auditConfigs.iteration': 1,
|
|
197
|
+
'auditConfigs.ratio': 1,
|
|
198
|
+
'storeId': 1,
|
|
199
|
+
'_id': 0,
|
|
200
|
+
} );
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function auditConfigurationUpdate( { storeId, count, iteration, ratio } ) {
|
|
204
|
+
return storeModel.updateOne( { storeId: storeId },
|
|
205
|
+
{
|
|
206
|
+
$set: {
|
|
207
|
+
'auditConfigs.count': count,
|
|
208
|
+
'auditConfigs.iteration': iteration,
|
|
209
|
+
'auditConfigs.ratio': ratio,
|
|
210
|
+
},
|
|
211
|
+
} );
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function CsmUsersGet( ) {
|
|
215
|
+
return userModel.aggregate(
|
|
216
|
+
[
|
|
217
|
+
{
|
|
218
|
+
$match: {
|
|
219
|
+
$and: [
|
|
220
|
+
{
|
|
221
|
+
role: 'admin',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
userType: 'tango',
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
$project: {
|
|
231
|
+
userName: 1,
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function OpsUsersGet( ) {
|
|
239
|
+
return userModel.aggregate(
|
|
240
|
+
[
|
|
241
|
+
{
|
|
242
|
+
$match: {
|
|
243
|
+
$and: [
|
|
244
|
+
{
|
|
245
|
+
$or: [
|
|
246
|
+
{
|
|
247
|
+
role: 'user',
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
role: 'admin',
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
userType: 'tango',
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
$project: {
|
|
262
|
+
userName: 1,
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
export function aggregateClient( query ) {
|
|
271
|
+
return clientModel.aggregate( query );
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function findOneClient( query, field ) {
|
|
275
|
+
return clientModel.findOne( query, field );
|
|
276
|
+
}
|
|
277
|
+
|