tango-app-api-trax 3.3.1-airtelai-6 → 3.3.1-airtelai-7

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-airtelai-6",
3
+ "version": "3.3.1-airtelai-7",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -304,7 +304,7 @@ async function insertData( requestData ) {
304
304
  },
305
305
  } );
306
306
  let getSections = await CLquestions.aggregate( sectionQuery );
307
- if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall','drinking','bagdetection' ].includes( getCLconfig.checkListType ) ) {
307
+ if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection' ].includes( getCLconfig.checkListType ) ) {
308
308
  if ( getSections.length ) {
309
309
  for ( let element3 of getSections ) {
310
310
  let collectQuestions = {};
@@ -597,7 +597,7 @@ async function insertData( requestData ) {
597
597
  // }
598
598
  }
599
599
  } else {
600
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall','drinking','bagdetection' ].includes( getCLconfig.checkListType ) ) {
600
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection' ].includes( getCLconfig.checkListType ) ) {
601
601
  let storeNameList = allQuestion.map( ( item ) => item.store_id );
602
602
  let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'cleaning', 'scrum' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
603
603
  let storeList = storeDetails.map( ( store ) => store.storeId );
@@ -2021,21 +2021,26 @@ export async function submitTask( req, res ) {
2021
2021
  export async function submiteyeTestTask( req, res ) {
2022
2022
  try {
2023
2023
  const { body: requestData, user } = req;
2024
- const { processedcheckListId, date, submittype, currentTime, questionAnswers,streamId,qrCode } = requestData;
2025
- console.log(requestData)
2026
- if(!streamId){
2027
- return res.sendError("streamId is required",500)
2024
+ const { processedcheckListId, date, submittype, currentTime, questionAnswers, streamId, qrCode } = requestData;
2025
+ console.log( requestData );
2026
+ if ( !streamId ) {
2027
+ return res.sendError( 'streamId is required', 400 );
2028
2028
  }
2029
-
2030
- let findQrExists = await cameraService.findOne({streamName:streamId,qrCode:qrCode})
2031
- console.log(findQrExists)
2032
- if(findQrExists){
2033
- return res.sendError("Qr code already Exists",500)
2029
+ if ( !qrCode||qrCode=='' ) {
2030
+ return res.sendError( 'qrCode is required', 400 );
2031
+ }
2032
+ let findoldQrExists = await cameraService.findOne( { qrCode: qrCode } );
2033
+ if ( findoldQrExists ) {
2034
+ return res.sendError( 'Qr code already Exists', 400 );
2035
+ }
2036
+ let findQrExists = await cameraService.findOne( { streamName: streamId, qrCode: qrCode } );
2037
+ console.log( findQrExists );
2038
+ if ( findQrExists ) {
2039
+ return res.sendError( 'Qr code already Exists', 400 );
2034
2040
  }
2035
2041
 
2036
- await cameraService.updateOne({streamName:streamId},{qrCode:qrCode})
2037
-
2038
-
2042
+ await cameraService.updateOne( { streamName: streamId }, { qrCode: qrCode } );
2043
+ return res.sendSuccess( 'Qr code added successfully' );
2039
2044
 
2040
2045
  const findQuery = [
2041
2046
  {
@@ -3463,7 +3463,7 @@ async function updateOpenSearch( user, data ) {
3463
3463
  export const aiChecklist = async ( req, res ) => {
3464
3464
  try {
3465
3465
  let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
3466
- let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall','drinking','bagdetection' ];
3466
+ let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection' ];
3467
3467
  let checklistDetails = [];
3468
3468
  let publishList = [];
3469
3469
  let unpublishList = [];
@@ -13,7 +13,7 @@ mobileRouter
13
13
  .post( '/submitCheckList', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidator, mobileController.sopMobilechecklistMultiSectionFormatter, mobileController.submitChecklist )
14
14
  .post( '/submitCheckListv5', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidatorv1, mobileController.sopMobilechecklistMultiSectionFormatterv1, mobileController.submitChecklist )
15
15
  .post( '/submitTask', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobileTaskQuestionValidator, mobileController.sopMobileTaskMultiSectionFormatter, mobileController.submitTask )
16
- .post( '/submiteyeTestTask', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobileTaskQuestionValidator, mobileController.sopMobileTaskMultiSectionFormatter, mobileController.submiteyeTestTask )
16
+ .post( '/submiteyeTestTask', isAllowedSessionHandler, mobileController.submiteyeTestTask )
17
17
  .get( '/dashboard', isAllowedSessionHandler, validate( dashboardValidation ), mobileController.dashboard )
18
18
  .get( '/dashboardv1', isAllowedSessionHandler, validate( dashboardValidation ), mobileController.dashboardv1 )
19
19
  .get( '/checklist', isAllowedSessionHandler, validate( mobileChecklistValidation ), mobileController.checklist )