tango-app-api-audit 3.5.30 → 3.5.32
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
|
@@ -1231,6 +1231,29 @@ export async function summaryList( req, res ) {
|
|
|
1231
1231
|
store: 1,
|
|
1232
1232
|
} },
|
|
1233
1233
|
];
|
|
1234
|
+
const getcount = await aggregateClusters( inputData.keyType === 'rm'?RMQuery: clusterQuery );
|
|
1235
|
+
const count = getcount?.length || 0;
|
|
1236
|
+
if ( count == 0 ) {
|
|
1237
|
+
return res.sendError( 'No data', 204 );
|
|
1238
|
+
}
|
|
1239
|
+
if ( inputData.isExport === false || !inputData.isExport ) {
|
|
1240
|
+
RMQuery.push(
|
|
1241
|
+
{
|
|
1242
|
+
$skip: offset,
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
$limit: limit,
|
|
1246
|
+
},
|
|
1247
|
+
);
|
|
1248
|
+
clusterQuery.push(
|
|
1249
|
+
{
|
|
1250
|
+
$skip: offset,
|
|
1251
|
+
},
|
|
1252
|
+
{
|
|
1253
|
+
$limit: limit,
|
|
1254
|
+
},
|
|
1255
|
+
);
|
|
1256
|
+
}
|
|
1234
1257
|
const getCluster = await aggregateClusters( inputData.keyType === 'rm'?RMQuery: clusterQuery );
|
|
1235
1258
|
logger.info( { getCluster: getCluster } );
|
|
1236
1259
|
if ( !getCluster || getCluster?.length == 0 ) {
|
|
@@ -1326,7 +1349,7 @@ export async function summaryList( req, res ) {
|
|
|
1326
1349
|
await download( result, res );
|
|
1327
1350
|
return;
|
|
1328
1351
|
} else {
|
|
1329
|
-
return res.sendSuccess( { result: temp, count:
|
|
1352
|
+
return res.sendSuccess( { result: temp, count: count || 0 } );
|
|
1330
1353
|
}
|
|
1331
1354
|
} else {
|
|
1332
1355
|
let search ={
|
|
@@ -1625,7 +1648,7 @@ export async function summaryCard( req, res ) {
|
|
|
1625
1648
|
filter.push(
|
|
1626
1649
|
{
|
|
1627
1650
|
range: {
|
|
1628
|
-
|
|
1651
|
+
ComplianceScore: {
|
|
1629
1652
|
lt: inputData?.complianceScore, // 🔹 adjust threshold here (e.g. gte: 50 for >= 50%)
|
|
1630
1653
|
},
|
|
1631
1654
|
},
|
|
@@ -2078,7 +2101,17 @@ export async function rmList( req, res ) {
|
|
|
2078
2101
|
configureType: 'user',
|
|
2079
2102
|
};
|
|
2080
2103
|
const getRMList = await findOneEyeTestConfig( query, { userList: 1 } );
|
|
2081
|
-
|
|
2104
|
+
let temp = [];
|
|
2105
|
+
|
|
2106
|
+
if ( getRMList && getRMList?.userList ) {
|
|
2107
|
+
const emailList = getRMList.userList.map( ( item ) => item.email )||
|
|
2108
|
+
[];
|
|
2109
|
+
logger.info( { emailList: emailList } );
|
|
2110
|
+
temp = await findOneUser( { email: { $in: emailList }, role: 'admin', isActive: true }, { userName: 1, email: 1, _id: 1, role: 1 } );
|
|
2111
|
+
return res.sendSuccess( { result: temp } );
|
|
2112
|
+
} else {
|
|
2113
|
+
return res.sendSuccess( { result: temp } );
|
|
2114
|
+
}
|
|
2082
2115
|
} catch ( error ) {
|
|
2083
2116
|
const err = error.message || 'Internal Server Error';
|
|
2084
2117
|
logger.error( { message: error, data: req.body, function: 'eyetestAudit-controller-rmList' } );
|
|
@@ -7,3 +7,7 @@ export function updateOneEyeTestConfig( query, record, upsert ) {
|
|
|
7
7
|
export function findOneEyeTestConfig( query, field ) {
|
|
8
8
|
return eyeTestConfigurationModel.findOne( query, field );
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
export function findEyeTestConfig( query, field ) {
|
|
12
|
+
return eyeTestConfigurationModel.find( query, field );
|
|
13
|
+
}
|
|
@@ -5,6 +5,10 @@ export function findOneUser( query, fields ) {
|
|
|
5
5
|
return userModel.findOne( query, fields );
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export function findUser( query, fields ) {
|
|
9
|
+
return userModel.find( query, fields );
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
export function aggregateUser( query ) {
|
|
9
13
|
return userModel.aggregate( query );
|
|
10
14
|
}
|