tango-app-api-trax 3.6.2-bulktask-11 → 3.6.2-bulktask-12

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.6.2-bulktask-11",
3
+ "version": "3.6.2-bulktask-12",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -469,13 +469,13 @@ export async function redoChecklist( req, res ) {
469
469
  let response = await processedChecklist.updateOne( { _id: req.body.payload._id }, updateData );
470
470
  // console.log( response );
471
471
  if ( response.modifiedCount || response.matchedCount ) {
472
- let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
473
- let currentDateTime;
474
- if ( storeTimeZone?.storeProfile?.timeZone ) {
475
- currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
476
- } else {
477
- currentDateTime = dayjs();
478
- }
472
+ // let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
473
+ // let currentDateTime;
474
+ // if ( storeTimeZone?.storeProfile?.timeZone ) {
475
+ // currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
476
+ // } else {
477
+ // currentDateTime = dayjs();
478
+ // }
479
479
  data = {
480
480
  checklistId: checklistDetails.sourceCheckList_id,
481
481
  checkListName: checklistDetails.checkListName,
@@ -620,13 +620,13 @@ export async function redomultiChecklist( req, res ) {
620
620
  let response = await processedChecklist.updateOne( { _id: originalData.checklistId }, updateData );
621
621
  // console.log( response );
622
622
  if ( response.modifiedCount || response.matchedCount ) {
623
- let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
624
- let currentDateTime;
625
- if ( storeTimeZone?.storeProfile?.timeZone ) {
626
- currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
627
- } else {
628
- currentDateTime = dayjs();
629
- }
623
+ // let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
624
+ // let currentDateTime;
625
+ // if ( storeTimeZone?.storeProfile?.timeZone ) {
626
+ // currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
627
+ // } else {
628
+ // currentDateTime = dayjs();
629
+ // }
630
630
  data = {
631
631
  checklistId: checklistDetails.sourceCheckList_id,
632
632
  checkListName: checklistDetails.checkListName,
@@ -642,7 +642,7 @@ export async function redomultiChecklist( req, res ) {
642
642
  type: checklistDetails.checkListType,
643
643
  userAnswer: userAnswer,
644
644
  initiatedBy: req.user.userName,
645
- initiatedTime: dayjs.utc( ).format(),
645
+ initiatedTime: dayjs.utc( ).format(),
646
646
  answerType: question[sectionIndex].questions[findQuestion].answerType,
647
647
  submitedBy: checklistDetails.userName,
648
648
  submitTime: dayjs.utc( checklistDetails.submitTime ).format(),
@@ -653,7 +653,9 @@ export async function redomultiChecklist( req, res ) {
653
653
  req.body.payload._id = originalData.checklistId;
654
654
  req.body.payload.section_id = originalData.section_id;
655
655
  req.body.payload.uniqueNo = originalData.uniqueNo;
656
- // console.log( req.body );
656
+ console.log( req.body );
657
+
658
+ // return;
657
659
 
658
660
 
659
661
  const requestOptions = {
@@ -664,6 +666,7 @@ export async function redomultiChecklist( req, res ) {
664
666
  body: JSON.stringify( req.body ),
665
667
  };
666
668
  let url = JSON.parse( process.env.LAMBDAURL );
669
+ console.log( url.redoChecklist );
667
670
  let searchResponse = await fetch( url.redoChecklist, requestOptions );
668
671
  console.log( searchResponse.ok );
669
672
  let logData = {
@@ -758,6 +761,37 @@ export async function approvalstatus( req, res ) {
758
761
  }
759
762
 
760
763
 
764
+ let url = JSON.parse( process.env.LAMBDAURL );
765
+ let resultData = await LamdaServiceCall( url.approvalstatus, req.body );
766
+
767
+ if ( resultData ) {
768
+ if ( resultData.status_code == '200' ) {
769
+ return res.sendSuccess( resultData );
770
+ } else {
771
+ return res.sendError( 'No Content', 204 );
772
+ }
773
+ } else {
774
+ return res.sendError( 'No Content', 204 );
775
+ }
776
+ } catch ( error ) {
777
+ logger.error( error, 'approvalstatus' );
778
+ return res.sendError( error, 500 );
779
+ }
780
+ }
781
+ export async function allapprovalstatus( req, res ) {
782
+ try {
783
+ if ( ( req?.user?.userType == 'client' && req.user.role == 'superadmin' ) ) {
784
+ let url = JSON.parse( process.env.LAMBDAURL );
785
+ let resultData = await LamdaServiceCall( url.approvalstatus, req.body );
786
+ if ( resultData ) {
787
+ if ( resultData.status_code == '200' ) {
788
+ return res.sendSuccess( resultData );
789
+ }
790
+ }
791
+ return res.sendError( 'No Content', 204 );
792
+ }
793
+
794
+
761
795
  let url = JSON.parse( process.env.LAMBDAURL );
762
796
  let resultData = await LamdaServiceCall( url.approvalstatus, req.body );
763
797
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { getchecklist, viewchecklist, getMobileUseagelist, storeOpencloselist, getcustomerunattendedlist,
4
4
  storesList, checklistDropdown, redoChecklist, redomultiChecklist, approveChecklist,
5
- approvalstatus, getLogs, headerStoresV2, teamsList, userList, checkNotificationCount, vehicleCheckInUpdate, taskvalidateUserData, getallchecklist, exportTemplate } from '../controllers/gallery.controller.js';
5
+ approvalstatus, allapprovalstatus, getLogs, headerStoresV2, teamsList, userList, checkNotificationCount, vehicleCheckInUpdate, taskvalidateUserData, getallchecklist, exportTemplate } from '../controllers/gallery.controller.js';
6
6
  import express from 'express';
7
7
  export const galleryRouter = express.Router();
8
8
  import { validate, isAllowedSessionHandler, isAllowedClient, getAssinedStore } from 'tango-app-api-middleware';
@@ -28,6 +28,7 @@ galleryRouter
28
28
  .post( '/redo', isAllowedSessionHandler, redoChecklist )
29
29
  .post( '/multiredo', isAllowedSessionHandler, redomultiChecklist )
30
30
  .post( '/approvalstatus', isAllowedSessionHandler, approvalstatus )
31
+ .post( '/allapprovalstatus', isAllowedSessionHandler, allapprovalstatus )
31
32
  .post( '/getLogs', isAllowedSessionHandler, getLogs )
32
33
  .post( '/headerStores_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParamsv2 ), getAssinedStore, headerStoresV2 )
33
34
  .get( '/teamsList', isAllowedSessionHandler, isAllowedClient, teamsList )