tango-app-api-task 3.6.0-task-1 → 3.6.0-task-4
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-
|
|
3
|
+
"version": "3.6.0-task-4",
|
|
4
4
|
"description": "Task",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"mongodb": "^6.10.0",
|
|
26
26
|
"nodemon": "^3.1.7",
|
|
27
27
|
"npm": "^10.9.2",
|
|
28
|
-
"tango-api-schema": "^2.2.
|
|
28
|
+
"tango-api-schema": "^2.2.193",
|
|
29
29
|
"tango-app-api-middleware": "^3.1.77",
|
|
30
30
|
"winston": "^3.17.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
@@ -1276,6 +1276,7 @@ export async function insertSingleProcessData( checklistId, answerTypechange, in
|
|
|
1276
1276
|
insertdata.restrictAttendance = getCLconfig?.restrictAttendance;
|
|
1277
1277
|
insertdata.coverage = getCLconfig?.coverage;
|
|
1278
1278
|
insertdata.checkListFrom = getCLconfig?.checkListFrom;
|
|
1279
|
+
insertdata.zoneName = getCLconfig?.zoneName || '';
|
|
1279
1280
|
let collectSections = [];
|
|
1280
1281
|
let sectionQuery = [];
|
|
1281
1282
|
sectionQuery.push( {
|
|
@@ -1523,6 +1524,7 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
|
|
|
1523
1524
|
element4.restrictAttendance = getCLconfig?.restrictAttendance;
|
|
1524
1525
|
element4.coverage = getCLconfig?.coverage;
|
|
1525
1526
|
element4.checkListFrom = getCLconfig?.checkListFrom;
|
|
1527
|
+
element4.zoneName = getCLconfig?.zoneName || '';
|
|
1526
1528
|
if ( inputBody && inputBody?.streamId ) {
|
|
1527
1529
|
element4.streamId = inputBody?.streamId;
|
|
1528
1530
|
}
|
|
@@ -2711,17 +2713,20 @@ export const taskDropdown = async ( req, res ) => {
|
|
|
2711
2713
|
let requestData = req.body;
|
|
2712
2714
|
let fromDate = new Date( requestData.fromDate );
|
|
2713
2715
|
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 );
|
|
2716
|
+
// let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
|
|
2717
|
+
// toDate = new Date( toDate.getTime() - userTimezoneOffset );
|
|
2718
|
+
// toDate.setUTCHours( 23, 59, 59, 59 );
|
|
2717
2719
|
let result = {};
|
|
2720
|
+
toDate.setDate( toDate.getDate() + 1 );
|
|
2718
2721
|
|
|
2719
2722
|
let findQuery = [];
|
|
2720
2723
|
let findAndQuery = [];
|
|
2721
2724
|
findAndQuery.push(
|
|
2722
2725
|
{ client_id: requestData.clientId },
|
|
2723
|
-
{ date_iso: { $gte: fromDate } },
|
|
2724
|
-
{ date_iso: { $lte: toDate } },
|
|
2726
|
+
// { date_iso: { $gte: fromDate } },
|
|
2727
|
+
// { date_iso: { $lte: toDate } },
|
|
2728
|
+
{ scheduleStartTime_iso: { $lt: toDate } },
|
|
2729
|
+
{ scheduleEndTime_iso: { $gte: fromDate } },
|
|
2725
2730
|
{ checkListType: { $in: [ 'task', 'checklistTask', 'cctv' ] } },
|
|
2726
2731
|
);
|
|
2727
2732
|
|
|
@@ -3681,7 +3686,7 @@ export async function StoreHygienetaskOld( req, res ) {
|
|
|
3681
3686
|
return res.sendError( e, 500 );
|
|
3682
3687
|
}
|
|
3683
3688
|
}
|
|
3684
|
-
export async function
|
|
3689
|
+
export async function eyeTesttask( req, res ) {
|
|
3685
3690
|
try {
|
|
3686
3691
|
let inputBody = req.body;
|
|
3687
3692
|
inputBody.clientId = 11;
|
|
@@ -5471,6 +5476,8 @@ export async function StoreHygienetask( req, res ) {
|
|
|
5471
5476
|
...( inputBody?.checkListId ) ? { referenceCheckListId: inputBody?.checkListId } : {},
|
|
5472
5477
|
coverage: 'store',
|
|
5473
5478
|
checkListFrom: 'api',
|
|
5479
|
+
zoneName: inputBody.zoneName || '',
|
|
5480
|
+
checkListType: 'task',
|
|
5474
5481
|
};
|
|
5475
5482
|
data['approver'] = userAdmin;
|
|
5476
5483
|
|
|
@@ -5593,14 +5600,14 @@ export async function StoreHygienetask( req, res ) {
|
|
|
5593
5600
|
}
|
|
5594
5601
|
}
|
|
5595
5602
|
|
|
5596
|
-
export async function
|
|
5603
|
+
export async function eyeTesttaskNew( req, res ) {
|
|
5597
5604
|
try {
|
|
5598
5605
|
let inputBody = req.body;
|
|
5599
5606
|
inputBody.clientId = 11;
|
|
5600
5607
|
inputBody.taskDescription = '';
|
|
5601
5608
|
let userId;
|
|
5602
5609
|
let storeDetails = await storeService.findOne( { storeName: inputBody.storeName, clientId: inputBody.clientId, status: 'active' }, { storeId: 1, storeName: 1, storeProfile: 1 } );
|
|
5603
|
-
console.log( 'storeDetails =>', storeDetails );
|
|
5610
|
+
// console.log( 'storeDetails =>', storeDetails );
|
|
5604
5611
|
if ( !storeDetails ) {
|
|
5605
5612
|
return res.sendError( 'Store Not Found', 500 );
|
|
5606
5613
|
}
|
|
@@ -5890,6 +5897,8 @@ async function insertStoreHygienetaskSingleProcessedTask( checkTask, inputBody,
|
|
|
5890
5897
|
newData.createdAt = new Date();
|
|
5891
5898
|
newData.updatedAt = new Date();
|
|
5892
5899
|
newData.questionAnswers = [ questions ];
|
|
5900
|
+
newData.zoneName = inputBody.zoneName || '';
|
|
5901
|
+
newData.checkListType = 'task' || '';
|
|
5893
5902
|
let insertprocessdata = await taskProcessedService.insert( newData );
|
|
5894
5903
|
if ( insertprocessdata ) {
|
|
5895
5904
|
return true;
|
|
@@ -5964,7 +5973,7 @@ async function insertEyetestSingleProcessedTask( checkTask, inputBody, date, tim
|
|
|
5964
5973
|
delete newData._id;
|
|
5965
5974
|
newData.date_iso = new Date( dayjs( date, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ) );
|
|
5966
5975
|
newData.date_string = dayjs( date ).format( 'YYYY-MM-DD' );
|
|
5967
|
-
newData.scheduleStartTime_iso =
|
|
5976
|
+
newData.scheduleStartTime_iso = dayjs.utc().format( 'YYYY-MM-DD hh:mm A' );
|
|
5968
5977
|
newData.scheduleEndTime_iso = dayjs.utc( `${date} ${time}`, 'YYYY-MM-DD hh:mm A' ).format();
|
|
5969
5978
|
newData.store_id = storeDetails.storeId;
|
|
5970
5979
|
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:
|
|
315
|
+
_id: 1,
|
|
316
316
|
checkListName: 1,
|
|
317
317
|
createdByName: 1,
|
|
318
318
|
userName: 1,
|
|
@@ -336,6 +336,8 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
336
336
|
restrictAttendance: 1,
|
|
337
337
|
approvalByEmail: 1,
|
|
338
338
|
approvalTime_string: 1,
|
|
339
|
+
zoneName: 1,
|
|
340
|
+
checkListFrom: 1,
|
|
339
341
|
},
|
|
340
342
|
} );
|
|
341
343
|
|
|
@@ -347,7 +349,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
347
349
|
|
|
348
350
|
findQuery.push( {
|
|
349
351
|
$project: {
|
|
350
|
-
_id:
|
|
352
|
+
_id: 1,
|
|
351
353
|
checkListName: 1,
|
|
352
354
|
checkListChar: { $substr: [ '$checkListName', 0, 2 ] },
|
|
353
355
|
createdByName: 1,
|
|
@@ -388,6 +390,8 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
388
390
|
restrictAttendance: 1,
|
|
389
391
|
approvalByEmail: 1,
|
|
390
392
|
approvalTime_string: 1,
|
|
393
|
+
zoneName: 1,
|
|
394
|
+
checkListFrom: 1,
|
|
391
395
|
},
|
|
392
396
|
} );
|
|
393
397
|
|
|
@@ -408,7 +412,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
408
412
|
} );
|
|
409
413
|
|
|
410
414
|
let taskInfoData = await processedTaskService.aggregate( findQuery );
|
|
411
|
-
console.log( 'taskInfoData =>', taskInfoData
|
|
415
|
+
// console.log( 'taskInfoData =>', taskInfoData );
|
|
412
416
|
|
|
413
417
|
if ( !taskInfoData[0].data.length ) {
|
|
414
418
|
return res.sendError( 'no data found', 204 );
|
|
@@ -425,11 +429,12 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
425
429
|
for ( let task of result.taskInfo ) {
|
|
426
430
|
exportResult.push( {
|
|
427
431
|
'Store': task?.storeName ||'--',
|
|
428
|
-
'
|
|
432
|
+
'user Name': task?.userEmail ||'--',
|
|
433
|
+
'User Email': task?.userEmail ||'--',
|
|
434
|
+
...( task?.checkListFrom === 'api' && { 'Zone Name': task?.zoneName || '--' } ),
|
|
429
435
|
'Due On': dayjs.utc( task?.scheduleEndTime_iso ).format( 'DD MMM, YYYY' ) || '--',
|
|
430
436
|
'status': task?.checklistStatus ||'--',
|
|
431
437
|
'Submitted On': task?.submitTime_string || '--',
|
|
432
|
-
'Assigned To': task?.storeCount ||'--',
|
|
433
438
|
'Approval By': task.approvalByEmail || '--',
|
|
434
439
|
'Approval On': task.approvalTime_string || '--',
|
|
435
440
|
} );
|
|
@@ -774,7 +779,7 @@ export const taskDropdownListV1 = async ( req, res ) => {
|
|
|
774
779
|
);
|
|
775
780
|
findQuery.push( { $match: { $and: findAndQuery } }, { $sort: { date_iso: -1 } } );
|
|
776
781
|
|
|
777
|
-
findQuery.push( { $match: { $or: [ { checkListName: 'Store Hygiene Check' }, { checkListName: '
|
|
782
|
+
// findQuery.push( { $match: { $or: [ { checkListName: 'Store Hygiene Check' }, { checkListName: 'Store Hygiene Check new' } ] } } );
|
|
778
783
|
|
|
779
784
|
findQuery.push(
|
|
780
785
|
{
|