tango-app-api-trax 3.3.1-beta-40 → 3.3.1-beta-42
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-trax",
|
|
3
|
-
"version": "3.3.1-beta-
|
|
3
|
+
"version": "3.3.1-beta-42",
|
|
4
4
|
"description": "Trax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"mongodb": "^6.8.0",
|
|
27
27
|
"nodemon": "^3.1.4",
|
|
28
28
|
"path": "^0.12.7",
|
|
29
|
-
"tango-api-schema": "^2.2.
|
|
29
|
+
"tango-api-schema": "^2.2.58",
|
|
30
30
|
"tango-app-api-middleware": "^3.1.55",
|
|
31
31
|
"url": "^0.11.4",
|
|
32
32
|
"winston": "^3.13.1",
|
|
@@ -2480,8 +2480,8 @@ export async function checklistv1( req, res ) {
|
|
|
2480
2480
|
};
|
|
2481
2481
|
|
|
2482
2482
|
const [ checklistResult, taskResult ] = await Promise.allSettled( [
|
|
2483
|
-
processedchecklist.aggregate( buildPipeline( [ { checkListType: 'custom' } ], { isPlano: 1, planoId: 1 } ) ),
|
|
2484
|
-
processedTask.aggregate( buildPipeline( [], { isPlano: 1, planoId: 1 } ) ),
|
|
2483
|
+
processedchecklist.aggregate( buildPipeline( [ { checkListType: 'custom' } ], { isPlano: 1, planoId: 1, planoType: 1 } ) ),
|
|
2484
|
+
processedTask.aggregate( buildPipeline( [], { isPlano: 1, planoId: 1, planoType: 1 } ) ),
|
|
2485
2485
|
] );
|
|
2486
2486
|
|
|
2487
2487
|
const checklistData = checklistResult.status === 'fulfilled' ? checklistResult.value : [];
|
|
@@ -1961,38 +1961,15 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
1961
1961
|
|
|
1962
1962
|
let assignDetails = req.body.assignedUsers;
|
|
1963
1963
|
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
acc[obj.storeName.toLowerCase()] = {
|
|
1967
|
-
email: [ obj.userEmail.toLowerCase() ],
|
|
1968
|
-
count: 1,
|
|
1969
|
-
};
|
|
1970
|
-
} else {
|
|
1971
|
-
if ( acc[obj.storeName.toLowerCase()] ) {
|
|
1972
|
-
if ( acc[obj.storeName.toLowerCase()].email.includes( obj.userEmail.toLowerCase() ) ) {
|
|
1973
|
-
acc[obj.storeName.toLowerCase()].count++;
|
|
1974
|
-
} else {
|
|
1975
|
-
acc[obj.storeName.toLowerCase()].email.push( obj.userEmail.toLowerCase() );
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
return acc;
|
|
1980
|
-
}, {} );
|
|
1981
|
-
|
|
1982
|
-
const duplicateStores = Object.keys( duplicateStore ).filter( ( storeName ) => duplicateStore[storeName].count > 1 );
|
|
1983
|
-
if ( duplicateStores.length ) {
|
|
1984
|
-
return res.sendSuccess( { validate: false, ExistsEmail: duplicateStores, message: 'store and email is Duplicated' } );
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
if ( req.body.hasOwnProperty( 'delete' ) ) {
|
|
1988
|
-
let checkExists = await assignedService.findOne( { userEmail: assignDetails[0].userEmail, storeName: assignDetails[0].storeName, checkListId: req.body.id } );
|
|
1964
|
+
if ( req.body.hasOwnProperty( 'addSingle' ) ) {
|
|
1965
|
+
let checkExists = await assignedService.findOne( { userEmail: assignDetails[0]?.userEmail, storeName: assignDetails[0]?.storeName, checkListId: req.body.id } );
|
|
1989
1966
|
if ( checkExists ) {
|
|
1990
1967
|
return res.sendError( 'User already Exists', 400 );
|
|
1991
1968
|
}
|
|
1992
1969
|
}
|
|
1993
1970
|
|
|
1994
1971
|
let userEmailList = assignDetails.map( ( item ) => item.userEmail.toLowerCase() );
|
|
1995
|
-
let storeList = assignDetails.map( ( item ) => item
|
|
1972
|
+
let storeList = assignDetails.map( ( item ) => item?.storeName?.toLowerCase() );
|
|
1996
1973
|
|
|
1997
1974
|
let userQuery = [
|
|
1998
1975
|
{
|
|
@@ -2045,18 +2022,20 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
2045
2022
|
},
|
|
2046
2023
|
];
|
|
2047
2024
|
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2025
|
+
console.log( storeQuery );
|
|
2026
|
+
|
|
2027
|
+
let [ userDetails, storeDetails, existEmail ] = await Promise.all( [
|
|
2028
|
+
await userService.aggregate( userQuery ),
|
|
2029
|
+
await storeService.aggregate( storeQuery ),
|
|
2030
|
+
await userService.aggregate( emailCheckQuery ),
|
|
2031
|
+
] );
|
|
2053
2032
|
|
|
2054
2033
|
let existUSerEmail = userDetails.map( ( ele ) => ele.email );
|
|
2055
2034
|
|
|
2056
2035
|
userDetails = userEmailList.filter( ( ele ) => !existUSerEmail.includes( ele ) );
|
|
2057
2036
|
|
|
2058
|
-
let existsStore = storeDetails.map( ( ele ) => ele.storeName );
|
|
2059
|
-
storeDetails = storeList.filter( ( ele ) => !existsStore.includes( ele ) );
|
|
2037
|
+
let existsStore = storeDetails.map( ( ele ) => ele.storeName && ele.storeName != null );
|
|
2038
|
+
storeDetails = storeList.filter( ( ele ) => ele != null && !existsStore.includes( ele ) );
|
|
2060
2039
|
|
|
2061
2040
|
if ( userDetails.length || storeDetails.length || existEmail.length ) {
|
|
2062
2041
|
return res.sendError( { validate: false, user: userDetails, store: storeDetails, existEmail }, 400 );
|
|
@@ -3487,7 +3466,7 @@ export const selectAssign = async ( req, res ) => {
|
|
|
3487
3466
|
if ( requestData.coverage == 'store' ) {
|
|
3488
3467
|
// //Select Store and cluster
|
|
3489
3468
|
let storeQuery = [
|
|
3490
|
-
{ $match: { clientId: requestData.clientId } },
|
|
3469
|
+
{ $match: { clientId: requestData.clientId, status: 'active' } },
|
|
3491
3470
|
{ $project: { 'storeName': 1, 'storeId': 1, 'type': 'store' } },
|
|
3492
3471
|
];
|
|
3493
3472
|
let clusterQuery = [
|