tango-app-api-trax 3.7.32 → 3.7.34

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.7.32",
3
+ "version": "3.7.34",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -343,7 +343,29 @@ export async function PCLconfigCreation( req, res ) {
343
343
  checkListId: element2,
344
344
  isdeleted: false,
345
345
  },
346
- } );
346
+ }, {
347
+ $lookup: {
348
+ from: 'stores',
349
+ let: { store: '$store_id' },
350
+ pipeline: [
351
+ {
352
+ $match: {
353
+ $expr: {
354
+ $eq: [ '$storeId', '$$store' ],
355
+ },
356
+ },
357
+ },
358
+ {
359
+ $project: {
360
+ country: '$storeProfile.country',
361
+ state: '$storeProfile.state',
362
+ },
363
+ },
364
+ ],
365
+ as: 'store',
366
+ },
367
+ },
368
+ );
347
369
  let allQuestion = await CLassign.aggregate( getquestionQuery );
348
370
  if ( allQuestion.length && getCLconfig.checkListType == 'custom' ) {
349
371
  let assignList = [];
@@ -569,6 +591,8 @@ export async function PCLconfigCreation( req, res ) {
569
591
  element4.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
570
592
  element4.approvalEnable = getCLconfig.approver.length ? true : false;
571
593
  element4.remainder = getCLconfig?.remainder || [];
594
+ element4.country = element4?.country ?? element4?.store?.[0]?.country;
595
+ element4.state = element4?.state ?? element4?.store?.[0]?.state;
572
596
  // if ( getCLconfig?.isPlano ) {
573
597
  // let planoDetails = await planoService.findOne( { storeId: element4.store_id, clientId: getCLconfig.client_id }, { _id: 1 } );
574
598
  // element4.planoId = planoDetails?._id;
@@ -2685,3 +2709,33 @@ export async function updateChecklistConfig( req, res ) {
2685
2709
  return res.sendError( e, 500 );
2686
2710
  }
2687
2711
  }
2712
+
2713
+ export async function submittedList( req, res ) {
2714
+ try {
2715
+ let getSubmitChecklist = await processedchecklist.find( { checklistStatus: 'submit', date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ) }, { _id: 1 } );
2716
+ let getSubmitTask = await processedTaskService.find( { checklistStatus: 'submit', date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ), isPlano: { $exists: false } }, { _id: 1 } );
2717
+
2718
+ let result = [ ...getSubmitChecklist?.map( ( ele ) => ele?._id ), ...getSubmitTask?.map( ( ele ) => ele?._id ) ];
2719
+ return res.sendSuccess( result );
2720
+ } catch ( e ) {
2721
+ logger.error( { functionName: 'submittedList', error: e } );
2722
+ return res.sendError( e, 500 );
2723
+ }
2724
+ }
2725
+
2726
+
2727
+ export async function submittedInfo( req, res ) {
2728
+ try {
2729
+ if ( !req.query?.id ) {
2730
+ return res.sendError( 'Id is required', 400 );
2731
+ }
2732
+ let info = await processedchecklist.findOne( { _id: req.query.id } );
2733
+ if ( !info ) {
2734
+ info = await processedTaskService.findOne( { _id: req.query.id } );
2735
+ }
2736
+ return res.sendSuccess( info );
2737
+ } catch ( e ) {
2738
+ logger.error( { functionName: 'getTaskCHecklistDetails', error: e } );
2739
+ return res.sendError( e, 500 );
2740
+ }
2741
+ }
@@ -30,6 +30,9 @@ internalTraxRouter
30
30
  .post( '/countUpdateRunAI', isAllowedInternalAPIHandler, internalController.countUpdateRunAI )
31
31
  .post( '/getRunAIQuestions', isAllowedInternalAPIHandler, internalController.getRunAIQuestions )
32
32
  .get( '/getRunAIList', isAllowedInternalAPIHandler, internalController.getRunAIList )
33
- .post( '/updateChecklistConfig', isAllowedInternalAPIHandler, internalController.updateChecklistConfig );
33
+ .post( '/updateChecklistConfig', isAllowedInternalAPIHandler, internalController.updateChecklistConfig )
34
+ .get( '/submittedList', isAllowedInternalAPIHandler, internalController.submittedList )
35
+ .get( '/getSubmittedDetails', isAllowedInternalAPIHandler, internalController.submittedInfo )
36
+ ;
34
37
 
35
38