tango-app-api-trax 3.3.1-beta-44 → 3.3.1-beta-45

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-beta-44",
3
+ "version": "3.3.1-beta-45",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -543,17 +543,13 @@ export const flagCardsV1 = async ( req, res ) => {
543
543
  let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
544
544
  let getUserEmails = await getChecklistUsers( loginUser );
545
545
  // End: Get User Based Checklist////
546
-
547
546
  const findQuery = [
548
547
  {
549
548
  $match: {
550
549
  client_id: clientId,
551
- $or: [
552
- { store_id: { $in: storeId } },
553
- { aiStoreList: { $in: storeId } },
554
- ],
550
+ // $or: [ { store_id: { $in: storeId } }, { aiStoreList: { $in: storeId } } ],
555
551
  date_iso: { $gte: adjustedFromDate, $lte: adjustedToDate },
556
- $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
552
+ $or: [ { store_id: { $in: storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } }, { aiStoreList: { $in: storeId } } ],
557
553
  },
558
554
  },
559
555
  {
@@ -690,12 +686,9 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
690
686
  // End: Get User Based Checklist////
691
687
  const createFindQuery = ( fromDate, toDate ) => [
692
688
  { $match: { client_id: requestData.clientId,
693
- $or: [
694
- { store_id: { $in: requestData.storeId } },
695
- { aiStoreList: { $in: requestData.storeId } },
696
- ],
689
+ // $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ],
697
690
  date_iso: { $gte: fromDate, $lte: toDate },
698
- $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ],
691
+ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } }, { aiStoreList: { $in: requestData.storeId } } ],
699
692
  } },
700
693
  {
701
694
  $project: {
@@ -720,12 +713,8 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
720
713
  let comparisonData = Math.abs( ( ( rangeOneVal - rangeTwoVal ) / rangeTwoVal ) * 100 );
721
714
  if ( comparisonData === Infinity ) comparisonData = 0;
722
715
  comparisonData = comparisonData % 1 === 0 ? comparisonData.toFixed( 0 ) : comparisonData.toFixed( 1 );
723
-
724
716
  comparisonData = parseInt( comparisonData );
725
-
726
-
727
717
  const ComparisonFlag = rangeOneVal > rangeTwoVal;
728
-
729
718
  return { comparisonData, ComparisonFlag };
730
719
  };
731
720
 
@@ -737,13 +726,10 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
737
726
  clientId: requestData.clientId,
738
727
  };
739
728
 
740
- console.log( dayjs( fromDate ).format( 'YYYY-MM-DD' ), 'from date' );
741
-
742
- console.log( dayjs( toDate ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' ), 'current' );
743
-
744
- console.log( dayjs( toDate ).format( 'YYYY-MM-DD' ), 'previous' );
745
-
746
- console.log( dayjs( toDate ).startOf( 'day' ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' ), 'new start of' );
729
+ // console.log( dayjs( fromDate ).format( 'YYYY-MM-DD' ), 'from date' );
730
+ // console.log( dayjs( toDate ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' ), 'current' );
731
+ // console.log( dayjs( toDate ).format( 'YYYY-MM-DD' ), 'previous' );
732
+ // console.log( dayjs( toDate ).startOf( 'day' ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' ), 'new start of' );
747
733
 
748
734
  const publishedAiChecklists = await checklistconfigService.find(
749
735
  {
@@ -759,9 +745,7 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
759
745
 
760
746
  const LamdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
761
747
  const resultData = await LamdaServiceCall( LamdaURL, detectionPayload );
762
-
763
748
  const published = publishedAiChecklists.map( ( val ) => val?.checkListType );
764
-
765
749
  if ( resultData?.status_code === '200' ) {
766
750
  let result = 0;
767
751
  published.forEach( ( item ) => {
@@ -816,15 +800,14 @@ export const flagTablesV1 = async ( req, res ) => {
816
800
  let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
817
801
  let getUserEmails = await getChecklistUsers( loginUser );
818
802
  // End: Get User Based Checklist////
819
-
803
+ console.log( 'getUserEmails =>', getUserEmails );
820
804
  let findQuery = [];
821
805
  let findAndQuery = [];
822
806
  findAndQuery.push(
823
807
  { client_id: requestData.clientId },
824
- { $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ] },
825
- { date_iso: { $gte: fromDate } },
826
- { date_iso: { $lte: toDate } },
827
- { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
808
+ // { $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ] },
809
+ { date_iso: { $gte: fromDate, $lte: toDate } },
810
+ { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } }, { aiStoreList: { $in: requestData.storeId } } ] },
828
811
  );
829
812
 
830
813
  if ( requestData?.filter === 'all' ) {
@@ -1881,7 +1864,7 @@ export const flagChecklistCardsV1 = async ( req, res ) => {
1881
1864
  { date_iso: { $lte: dayjs.utc( reqestData.toDate ).endOf( 'day' ).toDate() } },
1882
1865
  { sourceCheckList_id: new mongoose.Types.ObjectId( reqestData.sourceCheckList_id ) },
1883
1866
  // { store_id: { $in: reqestData?.storeId } },
1884
- { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
1867
+ { $or: [ { store_id: { $in: reqestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
1885
1868
  ],
1886
1869
  },
1887
1870
  },
@@ -2398,7 +2381,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
2398
2381
  // ],
2399
2382
  // },
2400
2383
  // { store_id: { $in: reqestData?.storeId } },
2401
- { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2384
+ { $or: [ { store_id: { $in: reqestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
2402
2385
  ],
2403
2386
  },
2404
2387
  };
@@ -2659,12 +2642,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
2659
2642
  let findQuery = [
2660
2643
  { $match: { $and: [
2661
2644
  { client_id: requestData.clientId },
2662
- {
2663
- $or: [
2664
- { store_id: { $in: requestData.storeId } },
2665
- { aiStoreList: { $in: requestData.storeId } },
2666
- ],
2667
- },
2645
+ { $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ] },
2668
2646
  { date_iso: { $gte: fromDate } },
2669
2647
  { date_iso: { $lte: toDate } },
2670
2648
  {