tango-app-api-client 3.6.18 → 3.6.20
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,5 +1,5 @@
|
|
|
1
1
|
import { billingDetailsUpdate, brandInfoUpdate, domainDetailsConfigurationUpdate, featureConfigurationUpdate, getClientData, signatoryDetailsUpdate, ticketConfigurationUpdate, documentsUpdate, getUserData, CsmUsersGet, OpsUsersGet, userConfigurationUpdate, findClient, aggregateClient, createAuditQueue, findOne, insert, update, findOneClient, updateOneClient } from '../service/client.service.js';
|
|
2
|
-
import { checkFileExist, signedUrl, chunkArray, download, logger, getOpenSearchData, insertOpenSearchData, sendEmailWithSES,
|
|
2
|
+
import { checkFileExist, signedUrl, chunkArray, download, logger, getOpenSearchData, insertOpenSearchData, sendEmailWithSES, getUuid, fileRestrictedUpload, getXsscheck, customSignedUrl } from 'tango-app-api-middleware';
|
|
3
3
|
import { countDocumentsUser, findOneAndUpdateUser, findOneUser, getUserNameEmailById, updateManyUser } from '../service/user.service.js';
|
|
4
4
|
import { aggregateStore, countDocumentsStore, findOneStore, findStore, updateManyStore } from '../service/store.service.js';
|
|
5
5
|
import { aggregateCamera, countDocumentsCamera } from '../service/camera.service.js';
|
|
@@ -13,7 +13,7 @@ import handlebars from 'handlebars';
|
|
|
13
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
|
-
import { createPaymentAccount } from '../service/paymentAccount.service.js';
|
|
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
19
|
import { createauditConfig, updateauditConfig, aggregateAuditconfig } from '../service/auditConfig.service.js';
|
|
@@ -112,32 +112,32 @@ export async function create( req, res ) {
|
|
|
112
112
|
|
|
113
113
|
const insertedClientRecord = await findOneClient( { clientId: record.clientId }, {} );
|
|
114
114
|
|
|
115
|
-
const customer = await createCustomer( { name: user.userName, email: user.email, clientId: insertedClientRecord.clientId } );
|
|
116
|
-
|
|
117
|
-
const virtualAccount = await createVirtualAccount( {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} );
|
|
115
|
+
// const customer = await createCustomer( { name: user.userName, email: user.email, clientId: insertedClientRecord.clientId } );
|
|
116
|
+
// logger.info( { customer: customer } );
|
|
117
|
+
// const virtualAccount = await createVirtualAccount( {
|
|
118
|
+
// receiverTypes: [ 'bank_account' ], description: `Virtual Account for ${insertedClientRecord.clientId}`,
|
|
119
|
+
// customerId: customer.id, notes: { createdAt: new Date(), createdBy: req.user?.email },
|
|
120
|
+
// } );
|
|
121
121
|
|
|
122
|
-
const paymentAccount = {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
};
|
|
122
|
+
// const paymentAccount = {
|
|
123
|
+
// clientId: insertedClientRecord.clientId,
|
|
124
|
+
// virtualAccId: virtualAccount?.id,
|
|
125
|
+
// bankAccId: virtualAccount?.receivers[0]?.id,
|
|
126
|
+
// accountNumber: virtualAccount?.receivers[0]?.account_number,
|
|
127
|
+
// ifsc: virtualAccount?.receivers[0]?.ifsc,
|
|
128
|
+
// customerId: virtualAccount?.customer_id,
|
|
129
|
+
// status: virtualAccount?.status,
|
|
130
|
+
// paymentType: virtualAccount?.entity,
|
|
131
|
+
// branch: 'RS Puram, Coimbatore',
|
|
132
|
+
// currency: 'dollar',
|
|
133
|
+
// };
|
|
134
134
|
|
|
135
|
-
if ( leadRecord.countryCode === '91' ) {
|
|
136
|
-
|
|
137
|
-
}
|
|
135
|
+
// if ( leadRecord.countryCode === '91' ) {
|
|
136
|
+
// paymentAccount.currency = 'inr';
|
|
137
|
+
// }
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
await createPaymentAccount( paymentAccount );
|
|
140
|
+
// await createPaymentAccount( paymentAccount );
|
|
141
141
|
|
|
142
142
|
const defaultcluster = {
|
|
143
143
|
'clusterName': 'All stores',
|
|
@@ -184,118 +184,6 @@ export async function create( req, res ) {
|
|
|
184
184
|
|
|
185
185
|
await createBilling( primaryBillingGroup );
|
|
186
186
|
|
|
187
|
-
// For old dashboard insert
|
|
188
|
-
// const createdGroup = await findOneGroup( { clientId: insertedClientRecord.clientId, isDefault: true }, {} );
|
|
189
|
-
// let oldGroup = {
|
|
190
|
-
// '_id': createdGroup._id,
|
|
191
|
-
// 'client_id': createdGroup.clientId,
|
|
192
|
-
// 'groupName': createdGroup.groupName,
|
|
193
|
-
// 'description': createdGroup.description,
|
|
194
|
-
// 'storeList': createdGroup.storeList,
|
|
195
|
-
// };
|
|
196
|
-
// await postApi( `${url.oldapidomain}/oldGroupAdd`, [ oldGroup ] );
|
|
197
|
-
|
|
198
|
-
// const oldBrandInsertData = {
|
|
199
|
-
// '_id': insertedClientRecord._id,
|
|
200
|
-
// 'brandName': insertedClientRecord.clientName,
|
|
201
|
-
// 'brandIndex': insertedClientRecord.tangoId,
|
|
202
|
-
// 'client_id': insertedClientRecord.clientId,
|
|
203
|
-
// 'phone': user.mobileNumber,
|
|
204
|
-
// 'email': user.email,
|
|
205
|
-
// 'dialCode': user.countryCode,
|
|
206
|
-
// 'name': user.userName,
|
|
207
|
-
// 'cameraCount': insertedClientRecord.planDetails.totalCamera,
|
|
208
|
-
// 'apiKey': insertedClientRecord.clientApi.apiKey,
|
|
209
|
-
// 'clientStatus': insertedClientRecord.status,
|
|
210
|
-
// 'client_type': insertedClientRecord.planDetails.paymentStatus,
|
|
211
|
-
// 'activeMenu': [
|
|
212
|
-
// 'reports',
|
|
213
|
-
// 'birdsEye',
|
|
214
|
-
// 'tangoZone',
|
|
215
|
-
// 'tangoTraffic',
|
|
216
|
-
// 'support',
|
|
217
|
-
// ],
|
|
218
|
-
// 'planType': insertedClientRecord.planDetails.subscriptionPeriod,
|
|
219
|
-
// 'storeCount': insertedClientRecord.planDetails.totalStores,
|
|
220
|
-
// 'squareFeet': insertedClientRecord.planDetails.storeSize,
|
|
221
|
-
// 'subscription': insertedClientRecord.planDetails.subscriptionType,
|
|
222
|
-
// 'subscription_status': true,
|
|
223
|
-
// 'subscribed_features': {
|
|
224
|
-
// 'tango_traffic': false,
|
|
225
|
-
// 'tango_zone': false,
|
|
226
|
-
// 'tango_revop': false,
|
|
227
|
-
// 'tango_storeops': false,
|
|
228
|
-
// 'controlroom': false,
|
|
229
|
-
// 'live_data': false,
|
|
230
|
-
// 'normalization_features': false,
|
|
231
|
-
// 'actual_features': false,
|
|
232
|
-
// },
|
|
233
|
-
// 'store_added_status': true,
|
|
234
|
-
// 'terms_conditions': true,
|
|
235
|
-
// 'otp_verified': true,
|
|
236
|
-
// 'price': 6510,
|
|
237
|
-
// 'currency_type': 'rupees',
|
|
238
|
-
// 'domains': [],
|
|
239
|
-
// 'store_radius_config': 500,
|
|
240
|
-
// };
|
|
241
|
-
|
|
242
|
-
// insertedClientRecord.planDetails.product.forEach( ( element ) => {
|
|
243
|
-
// if ( element.productName === 'tangoTraffic' ) {
|
|
244
|
-
// oldBrandInsertData.subscribed_features.tango_traffic = true;
|
|
245
|
-
// }
|
|
246
|
-
// if ( element.productName === 'tangoZone' ) {
|
|
247
|
-
// oldBrandInsertData.subscribed_features.tango_zone = true;
|
|
248
|
-
// }
|
|
249
|
-
// if ( element.productName === 'prioritySupport' ) {
|
|
250
|
-
// oldBrandInsertData.subscribed_features.tango_storeops = true;
|
|
251
|
-
// }
|
|
252
|
-
// } );
|
|
253
|
-
|
|
254
|
-
// switch ( insertedClientRecord.status ) {
|
|
255
|
-
// case 'active':
|
|
256
|
-
// oldBrandInsertData.clientStatus = 'live';
|
|
257
|
-
// break;
|
|
258
|
-
// case 'hold':
|
|
259
|
-
// oldBrandInsertData.clientStatus = 'hold';
|
|
260
|
-
// break;
|
|
261
|
-
// case 'suspended':
|
|
262
|
-
// oldBrandInsertData.clientStatus = 'suspended';
|
|
263
|
-
// break;
|
|
264
|
-
// case 'deactive':
|
|
265
|
-
// oldBrandInsertData.clientStatus = 'deactivated';
|
|
266
|
-
// break;
|
|
267
|
-
// default:
|
|
268
|
-
// oldBrandInsertData.clientStatus = 'live';
|
|
269
|
-
// }
|
|
270
|
-
|
|
271
|
-
// switch ( insertedClientRecord.planDetails.paymentStatus ) {
|
|
272
|
-
// case 'free':
|
|
273
|
-
// oldBrandInsertData.client_type = 'free';
|
|
274
|
-
// break;
|
|
275
|
-
// case 'trial':
|
|
276
|
-
// oldBrandInsertData.client_type = 'trial';
|
|
277
|
-
// break;
|
|
278
|
-
// case 'paid':
|
|
279
|
-
// oldBrandInsertData.client_type = 'paid';
|
|
280
|
-
// break;
|
|
281
|
-
// default:
|
|
282
|
-
// oldBrandInsertData.client_type = 'trial';
|
|
283
|
-
// }
|
|
284
|
-
// await postApi( `${url.oldapidomain}/oldBrandAdd`, oldBrandInsertData );
|
|
285
|
-
|
|
286
|
-
// const oldDefaultRolesInsertData = {
|
|
287
|
-
// '_id': user._id,
|
|
288
|
-
// 'client_id': insertedClientRecord.clientId,
|
|
289
|
-
// 'brandId': insertedClientRecord._id,
|
|
290
|
-
// 'name': user.userName,
|
|
291
|
-
// 'email': user.email,
|
|
292
|
-
// 'phone': user.mobileNumber,
|
|
293
|
-
// 'password': user.password,
|
|
294
|
-
// 'role': 'storesuperadmin',
|
|
295
|
-
// };
|
|
296
|
-
// await postApi( `${url.oldapidomain}/oldDefaultRoleInsert`, oldDefaultRolesInsertData );
|
|
297
|
-
|
|
298
|
-
|
|
299
187
|
const logObj = {
|
|
300
188
|
clientId: insertedClientRecord.clientId,
|
|
301
189
|
userName: req.user?.userName,
|
|
@@ -360,8 +248,9 @@ export async function create( req, res ) {
|
|
|
360
248
|
return res.sendSuccess( { result: { clientId: String( tangoId ) } } );
|
|
361
249
|
}
|
|
362
250
|
} catch ( error ) {
|
|
251
|
+
const err = error.message || 'Internal Server Error';
|
|
363
252
|
logger.info( { error: error, message: req.body, function: 'create' } );
|
|
364
|
-
return res.sendError(
|
|
253
|
+
return res.sendError( err, 500 );
|
|
365
254
|
}
|
|
366
255
|
}
|
|
367
256
|
|
|
@@ -138,7 +138,7 @@ export async function getAuditFile( req, res ) {
|
|
|
138
138
|
data.status = 'In-Progress';
|
|
139
139
|
}
|
|
140
140
|
} );
|
|
141
|
-
|
|
141
|
+
ticketSource.status = inputData.tickettype === 'internal' ?'In-Progress': ticketSource.status;
|
|
142
142
|
ticketSource.createdByRole = req?.user?.role || '';
|
|
143
143
|
ticketSource.createdByEmail = req?.user?.email || '';
|
|
144
144
|
ticketSource.createdByUserName = req?.user?.userName || '';
|
|
@@ -235,7 +235,7 @@ export async function getAuditFile( req, res ) {
|
|
|
235
235
|
console.log( '🚀 ~ getAuditFile ~ data.status:', data.status );
|
|
236
236
|
}
|
|
237
237
|
} );
|
|
238
|
-
ticketSource.status = 'In-Progress';
|
|
238
|
+
ticketSource.status = inputData.tickettype === 'internal' ?'In-Progress': ticketSource.status;
|
|
239
239
|
ticketSource.createdByRole = req?.user?.role || '';
|
|
240
240
|
ticketSource.createdByEmail = req?.user?.email || '';
|
|
241
241
|
ticketSource.createdByUserName = req?.user?.userName || '';
|