tango-app-api-trax 3.7.12-qid-4 → 3.7.12-qid-5
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
|
@@ -23,6 +23,7 @@ import { sendPushNotification, sendAiPushNotification } from 'tango-app-api-midd
|
|
|
23
23
|
import * as clusterServices from '../services/cluster.service.js';
|
|
24
24
|
import * as teamsServices from '../services/teams.service.js';
|
|
25
25
|
import * as notificationModel from '../services/notification.service.js';
|
|
26
|
+
import * as runAIRequestServices from '../services/runAIRequest.services.js';
|
|
26
27
|
|
|
27
28
|
const ObjectId = mongoose.Types.ObjectId;
|
|
28
29
|
dayjs.extend( customParseFormat );
|
|
@@ -2581,3 +2582,37 @@ export async function countUpdateRunAI( req, res ) {
|
|
|
2581
2582
|
return res.sendError( e, 500 );
|
|
2582
2583
|
}
|
|
2583
2584
|
}
|
|
2585
|
+
|
|
2586
|
+
export async function getRunAIQuestions( req, res ) {
|
|
2587
|
+
try {
|
|
2588
|
+
let requestData = req.body;
|
|
2589
|
+
|
|
2590
|
+
let getQuery = {};
|
|
2591
|
+
if ( requestData.clientId && requestData.clientId != '' ) {
|
|
2592
|
+
getQuery.clientId = requestData.clientId;
|
|
2593
|
+
}
|
|
2594
|
+
if ( requestData.checkListId && requestData.checkListId != '' ) {
|
|
2595
|
+
getQuery.checkListId = requestData.checkListId;
|
|
2596
|
+
}
|
|
2597
|
+
if ( requestData.checkListName && requestData.checkListName != '' ) {
|
|
2598
|
+
getQuery.checkListName = requestData.checkListName;
|
|
2599
|
+
}
|
|
2600
|
+
let projectData = {};
|
|
2601
|
+
if ( requestData.projectValue && requestData.projectValue != '' ) {
|
|
2602
|
+
let projectArray = requestData.projectValue.split( ',' ).map( ( f ) => f.trim() );
|
|
2603
|
+
if ( projectArray.length ) {
|
|
2604
|
+
projectArray.forEach( ( key ) => {
|
|
2605
|
+
projectData[key] = 1; // <-- use [] to assign dynamic keys
|
|
2606
|
+
} );
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
let getDetails = await runAIRequestServices.find( getQuery, projectData );
|
|
2610
|
+
if ( !getDetails || !getDetails.length ) {
|
|
2611
|
+
return res.sendError( 'No data found', 204 );
|
|
2612
|
+
}
|
|
2613
|
+
return res.sendSuccess( { count: getDetails.length, questions: getDetails } );
|
|
2614
|
+
} catch ( e ) {
|
|
2615
|
+
logger.error( { functionName: 'getRunAIQuestions', error: e } );
|
|
2616
|
+
return res.sendError( e, 500 );
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
@@ -27,6 +27,7 @@ internalTraxRouter
|
|
|
27
27
|
.post( '/notificationCreate', isAllowedInternalAPIHandler, internalController.notificationCreate )
|
|
28
28
|
.post( '/insertAINotification', isAllowedInternalAPIHandler, internalController.insertAINotification )
|
|
29
29
|
.post( '/updateRunAI', isAllowedInternalAPIHandler, internalController.updateRunAI )
|
|
30
|
-
.post( '/countUpdateRunAI', isAllowedInternalAPIHandler, internalController.countUpdateRunAI )
|
|
30
|
+
.post( '/countUpdateRunAI', isAllowedInternalAPIHandler, internalController.countUpdateRunAI )
|
|
31
|
+
.post( '/getRunAIQuestions', isAllowedInternalAPIHandler, internalController.getRunAIQuestions );
|
|
31
32
|
|
|
32
33
|
|