tango-app-api-trax 3.2.0-beta.10 → 3.2.0-beta.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.2.0-beta.10",
3
+ "version": "3.2.0-beta.12",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -180,7 +180,14 @@ export async function startChecklist( req, res ) {
180
180
  startTime: { $ifNull: [ '$startTime', '' ] },
181
181
  submitTime: { $ifNull: [ '$submitTime', '' ] },
182
182
  allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
183
- allowedStoreLocation: { $ifNull: [ '$checallowedStoreLocationkListName', false ] },
183
+ // allowedStoreLocation: { $ifNull: [ '$checallowedStoreLocationkListName', false ] },
184
+ allowedStoreLocation: {
185
+ $cond: {
186
+ if: { $eq: [ '$client_id', '11' ] },
187
+ then: false,
188
+ else: { $ifNull: [ '$allowedStoreLocation', false ] },
189
+ },
190
+ },
184
191
  questionAnswers: { $ifNull: [ '$questionAnswers', '' ] },
185
192
  redoStatus: { $ifNull: [ '$redoStatus', '' ] },
186
193
  },
@@ -344,7 +351,14 @@ export async function startTask( req, res ) {
344
351
  startTime: { $ifNull: [ '$startTime', '' ] },
345
352
  submitTime: { $ifNull: [ '$submitTime', '' ] },
346
353
  allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
347
- allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', false ] },
354
+ // allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', false ] },
355
+ allowedStoreLocation: {
356
+ $cond: {
357
+ if: { $eq: [ '$client_id', '11' ] },
358
+ then: false,
359
+ else: { $ifNull: [ '$allowedStoreLocation', false ] },
360
+ },
361
+ },
348
362
  questionAnswers: { $ifNull: [ '$questionAnswers', '' ] },
349
363
  redoStatus: { $ifNull: [ '$redoStatus', '' ] },
350
364
  },
@@ -701,7 +715,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
701
715
  }
702
716
  }
703
717
  } else {
704
- qaans[k].descriptivetype = qaAnswers[j].descriptivetype || '';
718
+ // qaans[k].descriptivetype = qaAnswers[j].descriptivetype || '';
705
719
  qaans[k].validationAnswer = requestSection[i].validationAnswer || '';
706
720
  }
707
721
  ms.push( qaans[k] );
@@ -750,7 +764,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
750
764
  }
751
765
  }
752
766
  } else {
753
- qaans[k].descriptivetype = qaAnswers[j].descriptivetype || '';
767
+ // qaans[k].descriptivetype = qaAnswers[j].descriptivetype || '';
754
768
  qaans[k].validationAnswer = separatedArray[s].validationAnswer || '';
755
769
  }
756
770
 
@@ -2228,7 +2242,14 @@ export async function checklist( req, res ) {
2228
2242
  startTime: { $ifNull: [ '$startTime', '' ] },
2229
2243
  submitTime: { $ifNull: [ '$submitTime', '' ] },
2230
2244
  allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
2231
- allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
2245
+ // allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
2246
+ allowedStoreLocation: {
2247
+ $cond: {
2248
+ if: { $eq: [ '$client_id', '11' ] },
2249
+ then: false,
2250
+ else: { $ifNull: [ '$allowedStoreLocation', false ] },
2251
+ },
2252
+ },
2232
2253
  reinitiateStatus: { $ifNull: [ '$reinitiateStatus', '' ] },
2233
2254
  startTime_string: { $ifNull: [ '$startTime_string', '' ] },
2234
2255
  submitTime_string: { $ifNull: [ '$submitTime_string', '' ] },
@@ -2292,7 +2313,14 @@ export async function checklistv1( req, res ) {
2292
2313
  startTime: { $ifNull: [ '$startTime', '' ] },
2293
2314
  submitTime: { $ifNull: [ '$submitTime', '' ] },
2294
2315
  allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
2295
- allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
2316
+ // allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
2317
+ allowedStoreLocation: {
2318
+ $cond: {
2319
+ if: { $eq: [ '$client_id', '11' ] },
2320
+ then: false,
2321
+ else: { $ifNull: [ '$allowedStoreLocation', false ] },
2322
+ },
2323
+ },
2296
2324
  reinitiateStatus: { $ifNull: [ '$reinitiateStatus', '' ] },
2297
2325
  startTime_string: { $ifNull: [ '$startTime_string', '' ] },
2298
2326
  submitTime_string: { $ifNull: [ '$submitTime_string', '' ] },
@@ -2375,7 +2403,14 @@ export async function questionList( req, res ) {
2375
2403
  startTime: { $ifNull: [ '$startTime', '' ] },
2376
2404
  submitTime: { $ifNull: [ '$submitTime', '' ] },
2377
2405
  allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
2378
- allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
2406
+ // allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
2407
+ allowedStoreLocation: {
2408
+ $cond: {
2409
+ if: { $eq: [ '$client_id', '11' ] },
2410
+ then: false,
2411
+ else: { $ifNull: [ '$allowedStoreLocation', false ] },
2412
+ },
2413
+ },
2379
2414
  reinitiateStatus: { $ifNull: [ '$reinitiateStatus', '' ] },
2380
2415
  questionAnswers: { $ifNull: [ '$questionAnswers', '' ] },
2381
2416
  getchecklist: { $ifNull: [ '$getchecklist', '' ] },
@@ -2673,7 +2708,14 @@ export async function taskQuestionList( req, res ) {
2673
2708
  startTime: { $ifNull: [ '$startTime', '' ] },
2674
2709
  submitTime: { $ifNull: [ '$submitTime', '' ] },
2675
2710
  allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
2676
- allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
2711
+ // allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
2712
+ allowedStoreLocation: {
2713
+ $cond: {
2714
+ if: { $eq: [ '$client_id', '11' ] },
2715
+ then: false,
2716
+ else: { $ifNull: [ '$allowedStoreLocation', false ] },
2717
+ },
2718
+ },
2677
2719
  reinitiateStatus: { $ifNull: [ '$reinitiateStatus', '' ] },
2678
2720
  questionAnswers: { $ifNull: [ '$questionAnswers', '' ] },
2679
2721
  getchecklist: { $ifNull: [ '$getchecklist', '' ] },
@@ -618,9 +618,9 @@ export const flagCardsV1 = async ( req, res ) => {
618
618
  { checkListType: 1 },
619
619
  );
620
620
 
621
- if ( !publishedAiChecklists?.length ) {
622
- return res.sendError( { error: 'No Data Found' }, 204 );
623
- }
621
+ // if ( !publishedAiChecklists?.length ) {
622
+ // return res.sendError( { error: 'No Data Found' }, 204 );
623
+ // }
624
624
 
625
625
  const detectionPayload = { fromDate, toDate, storeId, clientId };
626
626
  const lambdaURL = 'https://f65azvtljclaxp6l7rnx65cdmm0lcgvp.lambda-url.ap-south-1.on.aws/';
@@ -2175,6 +2175,8 @@ async function insertPCBulkV3( getCLconfig, checklistId, currentdate, updatedche
2175
2175
  getsubmitDetails[0].checklistStatus = 'inprogress';
2176
2176
  getsubmitDetails[0].date_string = dayjs( currentdate ).format( 'YYYY-MM-DD' );
2177
2177
  getsubmitDetails[0].date_iso = new Date( date );
2178
+ getsubmitDetails[0].redoStatus = false;
2179
+ getsubmitDetails[0].approvalStatus = false;
2178
2180
  }
2179
2181
  let data = { ...getsubmitDetails[0]._doc };
2180
2182
  await processedchecklist.updateOne( { _id: getsubmitDetails[0]._id }, data );
@@ -3552,8 +3552,9 @@ export async function sendAlert( req, res ) {
3552
3552
  let query = {
3553
3553
  date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
3554
3554
  ...( inputBody?.sourceCheckList_id ) ? { sourceCheckList_id: new mongoose.Types.ObjectId( inputBody.sourceCheckList_id ) } : { _id: { $in: inputBody.id } },
3555
- timeFlag: 0,
3556
- ...( inputBody?.checklistStatus && inputBody?.checklistStatus != 'all' ) ? { checklistStatus: inputBody.status } : { checklistStatus: { $ne: 'submit' } },
3555
+ // timeFlag: 0,
3556
+ // ...( inputBody?.checklistStatus && inputBody?.checklistStatus != 'all' ) ? { checklistStatus: inputBody.status } : { checklistStatus: { $ne: 'submit' } },
3557
+ ...( inputBody?.checklistStatus && ( inputBody?.checklistStatus == 'all' || inputBody?.checklistStatus == 'redo' ) ) ? { checklistStatus: { $ne: 'submit' } } : { checklistStatus: inputBody.checklistStatus },
3557
3558
  };
3558
3559
 
3559
3560
  query = [ { $match: query } ];