tango-app-api-task 3.6.2-bulktask-7 → 3.6.2-bulktask-9

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-task",
3
- "version": "3.6.2-bulktask-7",
3
+ "version": "3.6.2-bulktask-9",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1632,7 +1632,7 @@ export async function uploadImage( req, res ) {
1632
1632
  return res.sendError( { message: 'Something went wrong' }, 500 );
1633
1633
  }
1634
1634
 
1635
- return res.sendSuccess( { message: 'Uploaded Successfully', imgUrl: imgUrl, path: imgUrl.Key } );
1635
+ return res.sendSuccess( { message: 'Uploaded Successfully', imgUrl: imgUrl, path: inputData.file_path } );
1636
1636
  } catch ( e ) {
1637
1637
  logger.error( 'uploadImage =>', e );
1638
1638
  return res.sendError( e, 500 );
@@ -2508,13 +2508,13 @@ export async function redoTask( req, res ) {
2508
2508
  let response = await taskProcessedService.updateOne( { _id: req.body.payload._id }, updateData );
2509
2509
  // console.log( response );
2510
2510
  if ( response.modifiedCount || response.matchedCount ) {
2511
- let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
2512
- let currentDateTime;
2513
- if ( storeTimeZone?.storeProfile?.timeZone ) {
2514
- currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
2515
- } else {
2516
- currentDateTime = dayjs();
2517
- }
2511
+ // let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
2512
+ // let currentDateTime;
2513
+ // if ( storeTimeZone?.storeProfile?.timeZone ) {
2514
+ // currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
2515
+ // } else {
2516
+ // currentDateTime = dayjs();
2517
+ // }
2518
2518
  data = {
2519
2519
  checklistId: taskDetails.sourceCheckList_id,
2520
2520
  checkListName: taskDetails.checkListName,
@@ -2530,7 +2530,7 @@ export async function redoTask( req, res ) {
2530
2530
  type: taskDetails.checkListType,
2531
2531
  userAnswer: userAnswer,
2532
2532
  initiatedBy: req.user.userName,
2533
- initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
2533
+ initiatedTime: dayjs.utc( ).format(),
2534
2534
  answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
2535
2535
  submitedBy: taskDetails.userName,
2536
2536
  submitTime: dayjs.utc( taskDetails.submitTime ).format(),
@@ -2623,13 +2623,13 @@ export async function redomultiTask( req, res ) {
2623
2623
  let response = await taskProcessedService.updateOne( { _id: originalData.checklistId }, updateData );
2624
2624
  // console.log( response );
2625
2625
  if ( response.modifiedCount || response.matchedCount ) {
2626
- let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
2627
- let currentDateTime;
2628
- if ( storeTimeZone?.storeProfile?.timeZone ) {
2629
- currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
2630
- } else {
2631
- currentDateTime = dayjs();
2632
- }
2626
+ // let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
2627
+ // let currentDateTime;
2628
+ // if ( storeTimeZone?.storeProfile?.timeZone ) {
2629
+ // currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
2630
+ // } else {
2631
+ // currentDateTime = dayjs();
2632
+ // }
2633
2633
  data = {
2634
2634
  checklistId: taskDetails.sourceCheckList_id,
2635
2635
  checkListName: taskDetails.checkListName,
@@ -2645,7 +2645,7 @@ export async function redomultiTask( req, res ) {
2645
2645
  type: taskDetails.checkListType,
2646
2646
  userAnswer: userAnswer,
2647
2647
  initiatedBy: req.user.userName,
2648
- initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
2648
+ initiatedTime: dayjs.utc().format(),
2649
2649
  answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
2650
2650
  submitedBy: taskDetails.userName,
2651
2651
  submitTime: dayjs.utc( taskDetails.submitTime ).format(),
@@ -2654,6 +2654,7 @@ export async function redomultiTask( req, res ) {
2654
2654
  req.body.payload.section_id = originalData.section_id;
2655
2655
  req.body.payload.uniqueNo = originalData.uniqueNo;
2656
2656
  await checklistLogs.create( data );
2657
+
2657
2658
  const requestOptions = {
2658
2659
  method: 'POST',
2659
2660
  headers: {
@@ -2873,6 +2874,7 @@ export async function approvalstatus( req, res ) {
2873
2874
  if ( ( req?.user?.userType == 'client' && req.user.role == 'superadmin' ) ) {
2874
2875
  let url = JSON.parse( process.env.LAMBDAURL );
2875
2876
  let resultData = await LamdaServiceCall( url.approvalstatustask, req.body );
2877
+ console.log( resultData );
2876
2878
  if ( resultData ) {
2877
2879
  if ( resultData.status_code == '200' ) {
2878
2880
  return res.sendSuccess( resultData );
@@ -2886,6 +2888,7 @@ export async function approvalstatus( req, res ) {
2886
2888
 
2887
2889
  let url = JSON.parse( process.env.LAMBDAURL );
2888
2890
  let resultData = await LamdaServiceCall( url.approvalstatustask, req.body );
2891
+ console.log( resultData );
2889
2892
 
2890
2893
  if ( resultData ) {
2891
2894
  if ( resultData.status_code == '200' ) {
@@ -2901,6 +2904,39 @@ export async function approvalstatus( req, res ) {
2901
2904
  return res.sendError( error, 500 );
2902
2905
  }
2903
2906
  }
2907
+ export async function allapprovalstatus( req, res ) {
2908
+ try {
2909
+ if ( ( req?.user?.userType == 'client' && req.user.role == 'superadmin' ) ) {
2910
+ let url = JSON.parse( process.env.LAMBDAURL );
2911
+ let resultData = await LamdaServiceCall( url.approvalstatustask, req.body );
2912
+ console.log( resultData );
2913
+ if ( resultData ) {
2914
+ if ( resultData.status_code == '200' ) {
2915
+ return res.sendSuccess( resultData );
2916
+ }
2917
+ }
2918
+ return res.sendError( 'No Content', 204 );
2919
+ }
2920
+
2921
+
2922
+ let url = JSON.parse( process.env.LAMBDAURL );
2923
+ let resultData = await LamdaServiceCall( url.approvalstatustask, req.body );
2924
+ console.log( resultData );
2925
+
2926
+ if ( resultData ) {
2927
+ if ( resultData.status_code == '200' ) {
2928
+ return res.sendSuccess( resultData );
2929
+ } else {
2930
+ return res.sendError( 'No Content', 204 );
2931
+ }
2932
+ } else {
2933
+ return res.sendError( 'No Content', 204 );
2934
+ }
2935
+ } catch ( error ) {
2936
+ logger.error( error, 'allapprovalstatus' );
2937
+ return res.sendError( error, 500 );
2938
+ }
2939
+ }
2904
2940
 
2905
2941
  export const taskList = async ( req, res ) => {
2906
2942
  try {
@@ -24,6 +24,7 @@ taskRouter
24
24
  .post( '/getAnswers', isAllowedSessionHandler, taskController.getAnswers )
25
25
  .post( '/getAnswerCount', isAllowedSessionHandler, taskController.getAnswerCount )
26
26
  .post( '/approvalstatus', isAllowedSessionHandler, taskController.approvalstatus )
27
+ .post( '/allapprovalstatus', isAllowedSessionHandler, taskController.allapprovalstatus )
27
28
  .get( '/task-list', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ ] } ] } ), taskController.taskList )
28
29
  .put( '/publish', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.updatePublish )
29
30
  .get( '/duplicateTask/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.duplicateChecklist )