tango-app-api-client 3.3.1 → 3.3.2-beta.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-client",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2-beta.2",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"mongodb": "^6.3.0",
|
|
26
26
|
"nodemon": "^3.0.3",
|
|
27
27
|
"swagger-ui-express": "^5.0.0",
|
|
28
|
-
"tango-api-schema": "^2.1.
|
|
29
|
-
"tango-app-api-middleware": "^3.1.
|
|
28
|
+
"tango-api-schema": "^2.1.64",
|
|
29
|
+
"tango-app-api-middleware": "^3.1.43-alpha.8",
|
|
30
30
|
"winston": "^3.11.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
32
32
|
},
|
|
@@ -14,6 +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
|
+
import { countDocumentsClusters } from '../service/cluster.service.js';
|
|
18
|
+
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
export async function create( req, res ) {
|
|
@@ -42,7 +44,7 @@ export async function create( req, res ) {
|
|
|
42
44
|
const tangoId = count + 1;
|
|
43
45
|
const generatedName = inputData.clientName.replace( /[^A-Z0-9]+/ig, '' );
|
|
44
46
|
const product = leadRecord?.planDetails?.product.map( ( value ) => ( { productName: value } ) );
|
|
45
|
-
const getPermission = await findOneStandaredRole( { roleName: 'superadmin', userType: 'client' }, { permission: 1 } );
|
|
47
|
+
const getPermission = await findOneStandaredRole( { roleName: 'superadmin', userType: 'client' }, { permission: 1, rolespermission: 1 } );
|
|
46
48
|
const userQuery = {
|
|
47
49
|
email: leadRecord?.corporateEmail,
|
|
48
50
|
};
|
|
@@ -293,6 +295,7 @@ export async function create( req, res ) {
|
|
|
293
295
|
userType: 'client',
|
|
294
296
|
refreshToken: null,
|
|
295
297
|
permission: getPermission?.permission,
|
|
298
|
+
rolespermission: getPermission?.rolespermission,
|
|
296
299
|
clientId: String( tangoId ),
|
|
297
300
|
};
|
|
298
301
|
// await deleteOneAuthentication( { user: user?._id, type: 'retail' } );
|
|
@@ -515,7 +518,44 @@ export async function clientDetails( req, res ) {
|
|
|
515
518
|
}
|
|
516
519
|
export async function detailedAllClientCount( req, res ) {
|
|
517
520
|
try {
|
|
521
|
+
const field = { clientName: 1, clientId: 1 };
|
|
522
|
+
let Assinedclient = [];
|
|
523
|
+
if ( req?.user?.role === 'superadmin' ) {
|
|
524
|
+
Assinedclient = await findClient( {}, field );
|
|
525
|
+
Assinedclient = Assinedclient.map( ( data ) => data.clientId );
|
|
526
|
+
} else {
|
|
527
|
+
const clientQuery = [
|
|
528
|
+
{
|
|
529
|
+
$match: {
|
|
530
|
+
userEmail: req?.user?.email,
|
|
531
|
+
assignedType: { $eq: 'client' },
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
$group: {
|
|
536
|
+
_id: null,
|
|
537
|
+
clientId: { $addToSet: '$assignedValue' },
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
$project: {
|
|
542
|
+
_id: 0,
|
|
543
|
+
clientId: 1,
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
|
|
547
|
+
];
|
|
548
|
+
const clientList = await aggregateUserAssignedStore( clientQuery );
|
|
549
|
+
if ( clientList[0]?.clientId?.length != 0 ) {
|
|
550
|
+
Assinedclient= clientList[0]?.clientId;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
518
553
|
const query = [
|
|
554
|
+
{
|
|
555
|
+
$match: {
|
|
556
|
+
clientId: { $in: Assinedclient },
|
|
557
|
+
},
|
|
558
|
+
},
|
|
519
559
|
{
|
|
520
560
|
$project: {
|
|
521
561
|
activeClient: { $cond: [ { $eq: [ '$status', 'active' ] }, 1, 0 ] },
|
|
@@ -579,11 +619,14 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
579
619
|
},
|
|
580
620
|
];
|
|
581
621
|
const result = await aggregateClient( query );
|
|
582
|
-
const activeStores = await findStore( {
|
|
622
|
+
const activeStores = await findStore( {
|
|
623
|
+
'clientId': { $in: Assinedclient },
|
|
624
|
+
'status': 'active' }, { storeId: 1 } );
|
|
583
625
|
let yettoInstallCount = await aggregateTickets( [
|
|
584
626
|
{
|
|
585
627
|
$match: {
|
|
586
628
|
$and: [
|
|
629
|
+
{ 'basicDetails.clientId': { $in: Assinedclient } },
|
|
587
630
|
{ issueType: 'installation' },
|
|
588
631
|
{ 'status': { $ne: 'closed' } },
|
|
589
632
|
],
|
|
@@ -867,7 +910,7 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
867
910
|
conversionValue: req.body?.conversionValue, infraAlertCondition: req.body?.infraAlertCondition, infraAlertValue: req.body?.infraAlertValue, isFootfallDirectory: req.body?.isFootfallDirectory,
|
|
868
911
|
isNormalized: req.body?.isNormalized, isPasserByData: req.body?.isPasserByData, missedOpportunityCalculation: req.body?.missedOpportunityCalculation, open: req.body?.open,
|
|
869
912
|
isExcludedArea: req.body?.isExcludedArea, isCameraDisabled: req.body?.isCameraDisabled, isbillingDisabled: req.body?.isbillingDisabled, isNewDashboard: req.body?.isNewDashboard,
|
|
870
|
-
isFootfallAuditStores: req.body?.isFootfallAuditStores, isNewTraffic: req.body?.isNewTraffic, isNewZone: req.body?.isNewZone, isNewReports: req.body?.isNewReports, isNOB: req.body?.isNOB, isNewZoneV2: req.body?.isNewZoneV2,
|
|
913
|
+
isFootfallAuditStores: req.body?.isFootfallAuditStores, isNewTraffic: req.body?.isNewTraffic, isNewZone: req.body?.isNewZone, isNewReports: req.body?.isNewReports, isNOB: req.body?.isNOB, isNewZoneV2: req.body?.isNewZoneV2, isTrax: req.body?.isTrax,
|
|
871
914
|
} );
|
|
872
915
|
|
|
873
916
|
let updateKeys = [];
|
|
@@ -1903,6 +1946,7 @@ export async function detailedClientCount( req, res ) {
|
|
|
1903
1946
|
};
|
|
1904
1947
|
result['totalStoreCount'] = await countDocumentsStore( { clientId: inputData.clientId } );
|
|
1905
1948
|
result['totalGroupCount'] = await countDocumentsGroup( { clientId: inputData.clientId, isActive: true } );
|
|
1949
|
+
result['totalclusterCount'] = await countDocumentsClusters( { clientId: inputData.clientId } );
|
|
1906
1950
|
result['totalCameraCount'] = await countDocumentsCamera( { clientId: inputData.clientId } );
|
|
1907
1951
|
result['totalUserCount'] = await countDocumentsUser( { clientId: inputData.clientId, userType: 'client' } );
|
|
1908
1952
|
|
package/src/dtos/client.dtos.js
CHANGED
|
@@ -134,7 +134,7 @@ export function featureConfigurationUpdate( {
|
|
|
134
134
|
conversionValue, infraAlertCondition, infraAlertValue, isFootfallDirectory,
|
|
135
135
|
isNormalized, isPasserByData, missedOpportunityCalculation, open, isExcludedArea,
|
|
136
136
|
isCameraDisabled, isbillingDisabled, isNewDashboard, isFootfallAuditStores, isNewTraffic,
|
|
137
|
-
isNewZone, isNewReports, isNOB, isNewZoneV2,
|
|
137
|
+
isNewZone, isNewReports, isNOB, isNewZoneV2, isTrax,
|
|
138
138
|
} ) {
|
|
139
139
|
return clientModel.updateOne( { clientId: clientId },
|
|
140
140
|
{
|
|
@@ -164,6 +164,7 @@ export function featureConfigurationUpdate( {
|
|
|
164
164
|
'featureConfigs.isNewReports': isNewReports,
|
|
165
165
|
'featureConfigs.isNOB': isNOB,
|
|
166
166
|
'featureConfigs.isNewZoneV2': isNewZoneV2,
|
|
167
|
+
'featureConfigs.isTrax': isTrax,
|
|
167
168
|
},
|
|
168
169
|
} );
|
|
169
170
|
}
|
|
@@ -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
|
+
}
|