tango-app-api-trax 3.7.13-qid-halfshutter-10 → 3.7.13-qid-halfshutter-11
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 +2 -2
- package/src/controllers/internalTrax.controller.js +56 -0
- package/src/controllers/mobileTrax.controller.js +46 -236
- package/src/hbs/login-otp.hbs +943 -943
- package/src/routes/internalTraxApi.router.js +3 -1
- package/src/routes/mobileTrax.routes.js +2 -4
- package/src/validators/mobileChecklistSection.validator.js +0 -43
|
@@ -28,6 +28,8 @@ internalTraxRouter
|
|
|
28
28
|
.post( '/insertAINotification', isAllowedInternalAPIHandler, internalController.insertAINotification )
|
|
29
29
|
.post( '/updateRunAI', isAllowedInternalAPIHandler, internalController.updateRunAI )
|
|
30
30
|
.post( '/countUpdateRunAI', isAllowedInternalAPIHandler, internalController.countUpdateRunAI )
|
|
31
|
-
.post( '/getRunAIQuestions', isAllowedInternalAPIHandler, internalController.getRunAIQuestions )
|
|
31
|
+
.post( '/getRunAIQuestions', isAllowedInternalAPIHandler, internalController.getRunAIQuestions )
|
|
32
|
+
.get( '/getRunAIList', isAllowedInternalAPIHandler, internalController.getRunAIList )
|
|
33
|
+
.post( '/updateChecklistConfig', isAllowedInternalAPIHandler, internalController.updateChecklistConfig );
|
|
32
34
|
|
|
33
35
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import * as mobileController from '../controllers/mobileTrax.controller.js';
|
|
3
3
|
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
4
|
-
import { sopMobilechecklistSectionValidator } from '../validators/mobileChecklistSection.validator.js';
|
|
5
4
|
import { dashboardValidation, mobileChecklistValidation, startValidation } from '../dtos/validation.dtos.js';
|
|
6
5
|
|
|
7
6
|
export const mobileRouter = express.Router();
|
|
@@ -13,8 +12,6 @@ mobileRouter
|
|
|
13
12
|
.post( '/startTask', isAllowedSessionHandler, validate( startValidation ), mobileController.startTask )
|
|
14
13
|
.post( '/submitCheckList', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidator, mobileController.sopMobilechecklistMultiSectionFormatter, mobileController.submitChecklist )
|
|
15
14
|
.post( '/submitCheckListv5', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidatorv1, mobileController.sopMobilechecklistMultiSectionFormatterv1, mobileController.submitChecklist )
|
|
16
|
-
// For v6 we run formatter first to normalize partial section payloads, then a V6 validator that validates merged checklist on final submit
|
|
17
|
-
.post( '/submitCheckListv6', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistMultiSectionFormatterv1, sopMobilechecklistSectionValidator, mobileController.sopMobilechecklistQuestionValidatorV6, mobileController.submitChecklistV6 )
|
|
18
15
|
.post( '/submitTask', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobileTaskQuestionValidator, mobileController.sopMobileTaskMultiSectionFormatter, mobileController.submitTask )
|
|
19
16
|
.post( '/submiteyeTestTask', isAllowedSessionHandler, mobileController.submiteyeTestTask )
|
|
20
17
|
.get( '/dashboard', isAllowedSessionHandler, validate( dashboardValidation ), mobileController.dashboard )
|
|
@@ -32,5 +29,6 @@ mobileRouter
|
|
|
32
29
|
.post( '/checkUpdateVersion', mobileController.checkVersion )
|
|
33
30
|
.post( '/checkUpdateVersionv1', mobileController.checkVersionV1 )
|
|
34
31
|
.post( '/checkClientConfig', isAllowedSessionHandler, mobileController.clientConfig )
|
|
35
|
-
.post( '/updatePlanoStatus', isAllowedSessionHandler, mobileController.updatePlanoStatus )
|
|
32
|
+
.post( '/updatePlanoStatus', isAllowedSessionHandler, mobileController.updatePlanoStatus )
|
|
33
|
+
.post( '/chunkUpload', isAllowedSessionHandler, mobileController.chunkUpload );
|
|
36
34
|
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { logger } from 'tango-app-api-middleware';
|
|
2
|
-
|
|
3
|
-
export async function sopMobilechecklistSectionValidator( req, res, next ) {
|
|
4
|
-
try {
|
|
5
|
-
let requestData = req.body;
|
|
6
|
-
requestData.questionAnswers = typeof requestData.questionAnswers == 'string' ? JSON.parse( requestData.questionAnswers ) : requestData.questionAnswers;
|
|
7
|
-
const reqAnswers = requestData.questionAnswers;
|
|
8
|
-
|
|
9
|
-
if ( !Array.isArray( reqAnswers ) || !reqAnswers.length ) return next();
|
|
10
|
-
|
|
11
|
-
// ensure each section required fields are present.
|
|
12
|
-
for ( const section of reqAnswers ) {
|
|
13
|
-
if ( !section || !Array.isArray( section.questions ) ) continue;
|
|
14
|
-
for ( const question of section.questions ) {
|
|
15
|
-
try {
|
|
16
|
-
// Types that expect array of answers
|
|
17
|
-
if ( [ 'multiplechoicemultiple', 'multipleImage' ].includes( question.answerType ) ) {
|
|
18
|
-
if ( !question.userAnswer || ( Array.isArray( question.userAnswer ) && question.userAnswer.length === 0 ) ) {
|
|
19
|
-
return res.sendError( 'Please Fill All Fields', 400 );
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
// other types: expect at least one userAnswer entry
|
|
23
|
-
if ( !question.userAnswer || !question.userAnswer.length ) {
|
|
24
|
-
// If question has linkType enabled, ensure answer present as well
|
|
25
|
-
if ( question.linkType && question.linkquestionenabled ) {
|
|
26
|
-
return res.sendError( 'Please Fill All Fields', 400 );
|
|
27
|
-
}
|
|
28
|
-
return res.sendError( 'Please Fill All Fields', 400 );
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
} catch ( e ) {
|
|
32
|
-
logger.error( { function: 'sopMobilechecklistSectionValidator', error: e, body: req.body } );
|
|
33
|
-
return res.sendError( e, 500 );
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
console.log( 'sopMobilechecklistSectionValidator passed' );
|
|
38
|
-
return next();
|
|
39
|
-
} catch ( error ) {
|
|
40
|
-
logger.error( { function: 'sopMobilechecklistSectionValidator', error, body: req.body } );
|
|
41
|
-
return res.sendError( error, 500 );
|
|
42
|
-
}
|
|
43
|
-
}
|