tango-app-api-task 3.6.0-task-1 → 3.6.0-task-3

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.0-task-1",
3
+ "version": "3.6.0-task-3",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2711,17 +2711,20 @@ export const taskDropdown = async ( req, res ) => {
2711
2711
  let requestData = req.body;
2712
2712
  let fromDate = new Date( requestData.fromDate );
2713
2713
  let toDate = new Date( requestData.toDate );
2714
- let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
2715
- toDate = new Date( toDate.getTime() - userTimezoneOffset );
2716
- toDate.setUTCHours( 23, 59, 59, 59 );
2714
+ // let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
2715
+ // toDate = new Date( toDate.getTime() - userTimezoneOffset );
2716
+ // toDate.setUTCHours( 23, 59, 59, 59 );
2717
2717
  let result = {};
2718
+ toDate.setDate( toDate.getDate() + 1 );
2718
2719
 
2719
2720
  let findQuery = [];
2720
2721
  let findAndQuery = [];
2721
2722
  findAndQuery.push(
2722
2723
  { client_id: requestData.clientId },
2723
- { date_iso: { $gte: fromDate } },
2724
- { date_iso: { $lte: toDate } },
2724
+ // { date_iso: { $gte: fromDate } },
2725
+ // { date_iso: { $lte: toDate } },
2726
+ { scheduleStartTime_iso: { $lt: toDate } },
2727
+ { scheduleEndTime_iso: { $gte: fromDate } },
2725
2728
  { checkListType: { $in: [ 'task', 'checklistTask', 'cctv' ] } },
2726
2729
  );
2727
2730
 
@@ -3681,7 +3684,7 @@ export async function StoreHygienetaskOld( req, res ) {
3681
3684
  return res.sendError( e, 500 );
3682
3685
  }
3683
3686
  }
3684
- export async function eyeTesttaskOld( req, res ) {
3687
+ export async function eyeTesttask( req, res ) {
3685
3688
  try {
3686
3689
  let inputBody = req.body;
3687
3690
  inputBody.clientId = 11;
@@ -5593,14 +5596,14 @@ export async function StoreHygienetask( req, res ) {
5593
5596
  }
5594
5597
  }
5595
5598
 
5596
- export async function eyeTesttask( req, res ) {
5599
+ export async function eyeTesttaskNew( req, res ) {
5597
5600
  try {
5598
5601
  let inputBody = req.body;
5599
5602
  inputBody.clientId = 11;
5600
5603
  inputBody.taskDescription = '';
5601
5604
  let userId;
5602
5605
  let storeDetails = await storeService.findOne( { storeName: inputBody.storeName, clientId: inputBody.clientId, status: 'active' }, { storeId: 1, storeName: 1, storeProfile: 1 } );
5603
- console.log( 'storeDetails =>', storeDetails );
5606
+ // console.log( 'storeDetails =>', storeDetails );
5604
5607
  if ( !storeDetails ) {
5605
5608
  return res.sendError( 'Store Not Found', 500 );
5606
5609
  }
@@ -5964,7 +5967,7 @@ async function insertEyetestSingleProcessedTask( checkTask, inputBody, date, tim
5964
5967
  delete newData._id;
5965
5968
  newData.date_iso = new Date( dayjs( date, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ) );
5966
5969
  newData.date_string = dayjs( date ).format( 'YYYY-MM-DD' );
5967
- newData.scheduleStartTime_iso = date;
5970
+ newData.scheduleStartTime_iso = dayjs.utc().format( 'YYYY-MM-DD hh:mm A' );
5968
5971
  newData.scheduleEndTime_iso = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).format();
5969
5972
  newData.store_id = storeDetails.storeId;
5970
5973
  newData.storeName = storeDetails.storeName;
@@ -39,6 +39,10 @@ export const overallCardsV1 = async ( req, res ) => {
39
39
  let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
40
40
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
41
41
  toDate.setUTCHours( 23, 59, 59, 59 );
42
+
43
+ let taskToDate = new Date( requestData.toDate );
44
+ taskToDate.setDate( taskToDate.getDate() + 1 );
45
+
42
46
  let groupQuery = {
43
47
  $group: {
44
48
  _id: '',
@@ -55,7 +59,9 @@ export const overallCardsV1 = async ( req, res ) => {
55
59
  let taskQuery = [
56
60
  {
57
61
  $match: {
58
- date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
62
+ // date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
63
+ scheduleStartTime_iso: { $lt: taskToDate },
64
+ scheduleEndTime_iso: { $gte: fromDate },
59
65
  sourceCheckList_id: { $in: taskIdList },
60
66
  checklistStatus: 'submit',
61
67
  approvalStatus: false,
@@ -130,6 +136,9 @@ export const approvalTableV1 = async ( req, res ) => {
130
136
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
131
137
  toDate.setUTCHours( 23, 59, 59, 59 );
132
138
 
139
+ let taskToDate = new Date( requestData.toDate );
140
+ taskToDate.setDate( taskToDate.getDate() + 1 );
141
+
133
142
  let groupQuery = [ {
134
143
  $sort: {
135
144
  checkListName: 1,
@@ -202,7 +211,9 @@ export const approvalTableV1 = async ( req, res ) => {
202
211
  query = [
203
212
  {
204
213
  $match: {
205
- date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
214
+ // date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
215
+ scheduleStartTime_iso: { $lt: taskToDate },
216
+ scheduleEndTime_iso: { $gte: fromDate },
206
217
  sourceCheckList_id: { $in: taskIdList },
207
218
  // ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } :{},
208
219
  $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes || [] } } ],
@@ -312,7 +312,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
312
312
 
313
313
  findQuery.push( {
314
314
  $project: {
315
- _id: 0,
315
+ _id: 1,
316
316
  checkListName: 1,
317
317
  createdByName: 1,
318
318
  userName: 1,
@@ -347,7 +347,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
347
347
 
348
348
  findQuery.push( {
349
349
  $project: {
350
- _id: 0,
350
+ _id: 1,
351
351
  checkListName: 1,
352
352
  checkListChar: { $substr: [ '$checkListName', 0, 2 ] },
353
353
  createdByName: 1,
@@ -774,7 +774,7 @@ export const taskDropdownListV1 = async ( req, res ) => {
774
774
  );
775
775
  findQuery.push( { $match: { $and: findAndQuery } }, { $sort: { date_iso: -1 } } );
776
776
 
777
- findQuery.push( { $match: { $or: [ { checkListName: 'Store Hygiene Check' }, { checkListName: 'EyeTest QR Verification' } ] } } );
777
+ // findQuery.push( { $match: { $or: [ { checkListName: 'Store Hygiene Check' }, { checkListName: 'EyeTest QR Verification' } ] } } );
778
778
 
779
779
  findQuery.push(
780
780
  {