tango-app-api-client 3.0.48-dev → 3.0.49-dev
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.0.
|
|
3
|
+
"version": "3.0.49-dev",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
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.0.
|
|
28
|
+
"tango-api-schema": "^2.0.110",
|
|
29
29
|
"tango-app-api-middleware": "^3.1.12",
|
|
30
30
|
"winston": "^3.11.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { billingDetailsUpdate, brandInfoUpdate, domainDetailsConfigurationUpdate, featureConfigurationUpdate, getClientData, signatoryDetailsUpdate, ticketConfigurationUpdate, documentsUpdate, getUserData, auditConfigurationUpdate, auditConfigurationGet, CsmUsersGet, OpsUsersGet, userConfigurationUpdate, findClient, aggregateClient, createAuditQueue, findOne, insert, update, findOneClient, updateOneClient } from '../service/client.service.js';
|
|
2
2
|
import { checkFileExist, fileUpload, signedUrl, chunkArray, download, logger, getOpenSearchData, insertOpenSearchData, appConfig, sendEmailWithSES } from 'tango-app-api-middleware';
|
|
3
3
|
import { countDocumentsUser, findOneAndUpdateUser, findOneUser, getUserNameEmailById, updateManyUser } from '../service/user.service.js';
|
|
4
|
-
import { aggregateStore, countDocumentsStore, findOneStore, updateManyStore } from '../service/store.service.js';
|
|
5
|
-
import { aggregateCamera, countDocumentsCamera
|
|
4
|
+
import { aggregateStore, countDocumentsStore, findStore, findOneStore, updateManyStore } from '../service/store.service.js';
|
|
5
|
+
import { aggregateCamera, countDocumentsCamera } from '../service/camera.service.js';
|
|
6
6
|
import _ from 'lodash';
|
|
7
7
|
import { findOneStandaredRole } from '../service/standaredRole.service.js';
|
|
8
8
|
import { aggregateUserAssignedStore, deleteOneAssignedStore, updateOneUserAssignedStore } from '../service/userAssignedStore.service.js';
|
|
@@ -521,12 +521,16 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
521
521
|
},
|
|
522
522
|
];
|
|
523
523
|
const result = await aggregateClient( query );
|
|
524
|
-
const activeStores = await
|
|
525
|
-
|
|
524
|
+
const activeStores = await findStore( { 'status': 'active', 'edge.firstFile': true }, { storeId: 1 } );
|
|
525
|
+
let storesList = [];
|
|
526
|
+
for ( let store of activeStores ) {
|
|
527
|
+
storesList.push( store.storeId );
|
|
528
|
+
}
|
|
529
|
+
const activeCameras = await countDocumentsCamera( { storeId: { $in: storesList }, isUp: true, isActivated: true } );
|
|
526
530
|
if ( result.length == 0 ) {
|
|
527
531
|
return res.sendError( 'No Data Found', 204 );
|
|
528
532
|
}
|
|
529
|
-
result[0].activeStoresCount = activeStores;
|
|
533
|
+
result[0].activeStoresCount = activeStores.length;
|
|
530
534
|
result[0].activeCameraCount = activeCameras;
|
|
531
535
|
return res.sendSuccess( { result: result } );
|
|
532
536
|
} catch ( error ) {
|
|
@@ -605,7 +609,7 @@ export async function updateBrandInfo( req, res ) {
|
|
|
605
609
|
|
|
606
610
|
if ( req.body?.status === 'deactive' ) {
|
|
607
611
|
await updateManyStore( { clientId: req.params?.id }, { status: 'deactive' } );
|
|
608
|
-
await updateManyCamera( { clientId: req.params?.id }, { isUp: false, isActivated: false } );
|
|
612
|
+
// await updateManyCamera( { clientId: req.params?.id }, { isUp: false, isActivated: false } );
|
|
609
613
|
await updateManyUser( { clientId: req.params?.id }, { isActive: false } );
|
|
610
614
|
}
|
|
611
615
|
|
|
@@ -1707,6 +1711,19 @@ export async function detailedClientCount( req, res ) {
|
|
|
1707
1711
|
result['userName'] = user?.userName;
|
|
1708
1712
|
result['email'] = user?.email;
|
|
1709
1713
|
result['profileCompletion'] = 70;
|
|
1714
|
+
let findCsm = await aggregateUserAssignedStore( [
|
|
1715
|
+
{
|
|
1716
|
+
$match: {
|
|
1717
|
+
clientId: inputData.clientId,
|
|
1718
|
+
tangoUserType: 'csm',
|
|
1719
|
+
},
|
|
1720
|
+
},
|
|
1721
|
+
] );
|
|
1722
|
+
|
|
1723
|
+
if ( findCsm&&findCsm.length>0 ) {
|
|
1724
|
+
let finduser = await findOneUser( { email: findCsm[0].userEmail }, { userName: 1, email: 1, countryCode: 1, mobileNumber: 1 } );
|
|
1725
|
+
result['csm'] = finduser;
|
|
1726
|
+
}
|
|
1710
1727
|
|
|
1711
1728
|
return res.sendSuccess( { result: result } );
|
|
1712
1729
|
} catch ( error ) {
|
|
@@ -3,6 +3,9 @@ import storeModel from 'tango-api-schema/schema/store.model.js';
|
|
|
3
3
|
export function countDocumentsStore( query ) {
|
|
4
4
|
return storeModel.countDocuments( query );
|
|
5
5
|
}
|
|
6
|
+
export function findStore( query ) {
|
|
7
|
+
return storeModel.find( query );
|
|
8
|
+
}
|
|
6
9
|
|
|
7
10
|
export function aggregateStore( query ) {
|
|
8
11
|
return storeModel.aggregate( query );
|