tango-app-api-task 3.3.1-hotfix-2 → 3.3.1-hotfix-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
|
@@ -126,7 +126,7 @@ async function insertData( requestData ) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
console.log( resultchecklist );
|
|
129
|
+
// console.log( resultchecklist );
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
if ( resultchecklist.length ) {
|
|
@@ -141,7 +141,7 @@ async function insertData( requestData ) {
|
|
|
141
141
|
let startTimeIso; let endTimeIso;
|
|
142
142
|
startTimeIso = dayjs.utc( `${currentdate} ${sTime}`, 'YYYY-MM-DD hh:mm A' );
|
|
143
143
|
endTimeIso = dayjs.utc( getCLconfig.scheduleEndTimeISO );
|
|
144
|
-
console.log( endTimeIso );
|
|
144
|
+
// console.log( endTimeIso );
|
|
145
145
|
|
|
146
146
|
let insertdata = {};
|
|
147
147
|
insertdata.date_iso = new Date( dayjs( currentdate, 'YYYY-MM-DD' ).format( 'YYYY-MM-DD' ) );
|
|
@@ -269,7 +269,7 @@ async function insertData( requestData ) {
|
|
|
269
269
|
if ( userIdList.length ) {
|
|
270
270
|
allQuestion = allQuestion.filter( ( item ) => typeof item._id == 'undefined' );
|
|
271
271
|
}
|
|
272
|
-
console.log( allQuestion );
|
|
272
|
+
// console.log( allQuestion );
|
|
273
273
|
|
|
274
274
|
if ( allQuestion ) {
|
|
275
275
|
let assigndeletequery = {};
|
|
@@ -542,14 +542,14 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
542
542
|
{
|
|
543
543
|
$project: {
|
|
544
544
|
newEmail: { $toLower: '$email' },
|
|
545
|
-
isActive: 1,
|
|
545
|
+
// isActive: 1,
|
|
546
546
|
clientId: 1,
|
|
547
547
|
},
|
|
548
548
|
},
|
|
549
549
|
{
|
|
550
550
|
$match: {
|
|
551
551
|
newEmail: { $in: userEmailList },
|
|
552
|
-
isActive: true,
|
|
552
|
+
// isActive: true,
|
|
553
553
|
clientId: { $ne: req.body.clientId },
|
|
554
554
|
},
|
|
555
555
|
},
|
|
@@ -590,7 +590,7 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
590
590
|
let newStoreList = storeList.filter( ( ele ) => ele != null && !existsStore.includes( ele.toLowerCase() ) );
|
|
591
591
|
if ( req.body.coverage == 'store' ) {
|
|
592
592
|
assignDetails.forEach( ( item ) => {
|
|
593
|
-
let getStoreDetails = storeDetails.find( ( store ) => store.storeName.toLowerCase() == item.storeName.toLowerCase() );
|
|
593
|
+
let getStoreDetails = storeDetails.find( ( store ) => store.storeName.toLowerCase() == item.storeName.trim().toLowerCase() );
|
|
594
594
|
if ( getStoreDetails ) {
|
|
595
595
|
let storeUserDetails = userDetails.find( ( ele ) => ele.newEmail.toLowerCase() == item.userEmail.toLowerCase() );
|
|
596
596
|
item._id = getStoreDetails._id;
|
|
@@ -612,6 +612,10 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
612
612
|
}
|
|
613
613
|
|
|
614
614
|
if ( ( newUserList.length || newStoreList.length || existEmail.length || inActiveStores.length ) && !req.body?.addUser ) {
|
|
615
|
+
newStoreList = [ ...new Set( newStoreList.map( ( item ) => item ) ) ];
|
|
616
|
+
newUserList = [ ...new Set( newUserList.map( ( item ) => item ) ) ];
|
|
617
|
+
existEmail = [ ...new Set( existEmail.map( ( item ) => item ) ) ];
|
|
618
|
+
inActiveStores = [ ...new Set( inActiveStores.map( ( item ) => item ) ) ];
|
|
615
619
|
return res.sendError( { validate: false, user: newUserList, store: newStoreList, existEmail, inActiveStores, data: assignDetails }, 400 );
|
|
616
620
|
}
|
|
617
621
|
await Promise.all( newUserList.map( async ( ele ) => {
|
|
@@ -963,7 +967,7 @@ export async function taskConfig( req, res ) {
|
|
|
963
967
|
return res.sendSuccess( { id: inputBody._id, message: message } );
|
|
964
968
|
}
|
|
965
969
|
} catch ( e ) {
|
|
966
|
-
console.log( 'e', e );
|
|
970
|
+
// console.log( 'e', e );
|
|
967
971
|
logger.error( { functionName: 'taskConfig =>', error: e, message: req.body } );
|
|
968
972
|
return res.sendError( e, 500 );
|
|
969
973
|
}
|
|
@@ -1357,7 +1361,7 @@ export async function uploadImage( req, res ) {
|
|
|
1357
1361
|
|
|
1358
1362
|
async function createUser( data ) {
|
|
1359
1363
|
try {
|
|
1360
|
-
console.log( 'createUser ====>', data );
|
|
1364
|
+
// console.log( 'createUser ====>', data );
|
|
1361
1365
|
let params = {
|
|
1362
1366
|
userName: data.userName,
|
|
1363
1367
|
email: data.email,
|
|
@@ -1825,7 +1829,7 @@ export async function redoTask( req, res ) {
|
|
|
1825
1829
|
};
|
|
1826
1830
|
|
|
1827
1831
|
let response = await taskProcessedService.updateOne( { _id: req.body.payload._id }, updateData );
|
|
1828
|
-
console.log( response );
|
|
1832
|
+
// console.log( response );
|
|
1829
1833
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
1830
1834
|
let storeTimeZone = await storeService.findOne( { storeName: taskDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
1831
1835
|
let currentDateTime;
|
|
@@ -1865,7 +1869,7 @@ export async function redoTask( req, res ) {
|
|
|
1865
1869
|
};
|
|
1866
1870
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
1867
1871
|
let searchResponse = await fetch( url.redoTask, requestOptions );
|
|
1868
|
-
console.log( searchResponse.ok );
|
|
1872
|
+
// console.log( searchResponse.ok );
|
|
1869
1873
|
if ( searchResponse.ok ) {
|
|
1870
1874
|
return res.sendSuccess( 'Question redo successfully' );
|
|
1871
1875
|
} else {
|
|
@@ -3708,19 +3712,21 @@ export async function updateAssign( req, res ) {
|
|
|
3708
3712
|
},
|
|
3709
3713
|
];
|
|
3710
3714
|
let assignUserDetails = await userService.aggregate( query );
|
|
3711
|
-
|
|
3715
|
+
for ( let assign of req.body.assignedList ) {
|
|
3716
|
+
// await Promise.all( req.body.assignedList.map( async ( assign ) => {
|
|
3712
3717
|
let userDetails = assignUserDetails.find( ( ele ) => ele.email.toLowerCase() == assign.userEmail.toLowerCase() );
|
|
3713
3718
|
if ( !userDetails ) {
|
|
3714
3719
|
let userData = {
|
|
3715
3720
|
userName: assign.userName,
|
|
3716
3721
|
email: assign.userEmail,
|
|
3717
|
-
mobileNumber: assign?.
|
|
3722
|
+
mobileNumber: assign?.userPhone || '',
|
|
3718
3723
|
clientId: req.body.clientId,
|
|
3719
3724
|
};
|
|
3720
3725
|
userDetails = await createUser( userData );
|
|
3721
3726
|
}
|
|
3722
3727
|
let data = {
|
|
3723
3728
|
...assign,
|
|
3729
|
+
userEmail: userDetails?.email,
|
|
3724
3730
|
store_id: assign?.storeId,
|
|
3725
3731
|
client_id: req.body.clientId,
|
|
3726
3732
|
checkListId: req.body.taskId,
|
|
@@ -3731,7 +3737,8 @@ export async function updateAssign( req, res ) {
|
|
|
3731
3737
|
};
|
|
3732
3738
|
delete data._id;
|
|
3733
3739
|
assignedUserList.push( data );
|
|
3734
|
-
} ) );
|
|
3740
|
+
// } ) );
|
|
3741
|
+
}
|
|
3735
3742
|
let assignGroupDetails = [];
|
|
3736
3743
|
if ( req.body.coverage == 'store' ) {
|
|
3737
3744
|
assignGroupDetails = await clusterServices.findcluster( { _id: { $in: req.body.assignedGroup } } );
|
|
@@ -3979,7 +3986,7 @@ export async function taskcreation( req, res ) {
|
|
|
3979
3986
|
|
|
3980
3987
|
|
|
3981
3988
|
let finduser = await userService.findOne( { clientId: inputBody.clientId, email: req.body.user, userType: 'client', isActive: true }, { userName: '$userName', email: 1, userId: '$_id' } );
|
|
3982
|
-
console.log( finduser );
|
|
3989
|
+
// console.log( finduser );
|
|
3983
3990
|
|
|
3984
3991
|
if ( !finduser ) {
|
|
3985
3992
|
return res.sendError( 'No user Found', 500 );
|
|
@@ -88,7 +88,7 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
88
88
|
resultData = { taskApproval: { count: taskCount?.[0]?.count || 0 }, checklistApproval: { count: checklistCount?.[0]?.count || 0 } };
|
|
89
89
|
return res.sendSuccess( { cardData: resultData } );
|
|
90
90
|
} catch ( error ) {
|
|
91
|
-
console.log( 'error =>', error );
|
|
91
|
+
// console.log( 'error =>', error );
|
|
92
92
|
logger.error( { error: error, function: 'overallCards' } );
|
|
93
93
|
return res.sendError( error, 500 );
|
|
94
94
|
}
|
|
@@ -160,6 +160,7 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
162
|
coverage: { $first: '$coverage' },
|
|
163
|
+
userName: { $first: '$userName' },
|
|
163
164
|
},
|
|
164
165
|
},
|
|
165
166
|
{
|
|
@@ -179,6 +180,7 @@ export const approvalTableV1 = async ( req, res ) => {
|
|
|
179
180
|
storeName: 1,
|
|
180
181
|
redo: '$_id.redoType',
|
|
181
182
|
coverage: 1,
|
|
183
|
+
userName: 1,
|
|
182
184
|
},
|
|
183
185
|
},
|
|
184
186
|
{
|
|
@@ -364,7 +366,7 @@ export const overallCards = async ( req, res ) => {
|
|
|
364
366
|
let resultData = await overallCardsData( requestData );
|
|
365
367
|
return res.sendSuccess( resultData );
|
|
366
368
|
} catch ( error ) {
|
|
367
|
-
console.log( 'error =>', error );
|
|
369
|
+
// console.log( 'error =>', error );
|
|
368
370
|
logger.error( { error: error, function: 'overallCards' } );
|
|
369
371
|
return res.sendError( error, 500 );
|
|
370
372
|
}
|
|
@@ -383,7 +385,7 @@ async function overallCardsData( requestData ) {
|
|
|
383
385
|
// resultData.card = cardData;
|
|
384
386
|
return { cardData: cardData };
|
|
385
387
|
} catch ( error ) {
|
|
386
|
-
console.log( 'error =>', error );
|
|
388
|
+
// console.log( 'error =>', error );
|
|
387
389
|
logger.error( { error: error, message: data, function: 'overallCardsData' } );
|
|
388
390
|
}
|
|
389
391
|
}
|
|
@@ -394,7 +396,7 @@ export const approvalTable = async ( req, res ) => {
|
|
|
394
396
|
let resultData = await approvalTableData( requestData );
|
|
395
397
|
return res.sendSuccess( resultData );
|
|
396
398
|
} catch ( error ) {
|
|
397
|
-
console.log( 'error =>', error );
|
|
399
|
+
// console.log( 'error =>', error );
|
|
398
400
|
logger.error( { error: error, function: 'taskTable' } );
|
|
399
401
|
return res.sendError( error, 500 );
|
|
400
402
|
}
|
|
@@ -461,7 +463,7 @@ async function approvalTableData( requestData ) {
|
|
|
461
463
|
};
|
|
462
464
|
return tableData;
|
|
463
465
|
} catch ( error ) {
|
|
464
|
-
console.log( 'error =>', error );
|
|
466
|
+
// console.log( 'error =>', error );
|
|
465
467
|
logger.error( { error: error, message: requestData, function: 'approvalTableData' } );
|
|
466
468
|
return res.sendError( error, 500 );
|
|
467
469
|
}
|
|
@@ -473,7 +475,7 @@ export const activityLog = async ( req, res ) => {
|
|
|
473
475
|
let resultData = await activityLogData( requestData );
|
|
474
476
|
return res.sendSuccess( resultData );
|
|
475
477
|
} catch ( error ) {
|
|
476
|
-
console.log( 'error =>', error );
|
|
478
|
+
// console.log( 'error =>', error );
|
|
477
479
|
logger.error( { error: error, function: 'activityLog' } );
|
|
478
480
|
return res.sendError( error, 500 );
|
|
479
481
|
}
|
|
@@ -536,7 +538,7 @@ async function activityLogData( requestData ) {
|
|
|
536
538
|
};
|
|
537
539
|
return activityLogData;
|
|
538
540
|
} catch ( error ) {
|
|
539
|
-
console.log( 'error =>', error );
|
|
541
|
+
// console.log( 'error =>', error );
|
|
540
542
|
logger.error( { error: error, message: requestData, function: 'activityLogData' } );
|
|
541
543
|
return res.sendError( error, 500 );
|
|
542
544
|
}
|
|
@@ -11,7 +11,7 @@ export const overallCards = async ( req, res ) => {
|
|
|
11
11
|
let resultData = await overallCardsData( requestData );
|
|
12
12
|
return res.sendSuccess( resultData );
|
|
13
13
|
} catch ( error ) {
|
|
14
|
-
console.log( 'error =>', error );
|
|
14
|
+
// console.log( 'error =>', error );
|
|
15
15
|
logger.error( { error: error, function: 'overallCards' } );
|
|
16
16
|
return res.sendError( error, 500 );
|
|
17
17
|
}
|
|
@@ -42,7 +42,7 @@ async function overallCardsData( requestData ) {
|
|
|
42
42
|
// resultData.card = cardData;
|
|
43
43
|
return { cardData: cardData };
|
|
44
44
|
} catch ( error ) {
|
|
45
|
-
console.log( 'error =>', error );
|
|
45
|
+
// console.log( 'error =>', error );
|
|
46
46
|
logger.error( { error: error, message: data, function: 'overallCardsData' } );
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -108,7 +108,6 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
108
108
|
};
|
|
109
109
|
export const taskTableV1 = async ( req, res ) => {
|
|
110
110
|
try {
|
|
111
|
-
console.log( 'req.body', req.body );
|
|
112
111
|
let limit = parseInt( req.body.limit ) || 10;
|
|
113
112
|
let offset = parseInt( req.body.offset - 1 ) || 0;
|
|
114
113
|
let page = offset * limit;
|
|
@@ -190,7 +189,7 @@ export const taskTableV1 = async ( req, res ) => {
|
|
|
190
189
|
{ $sort: { createdAt: -1 } },
|
|
191
190
|
);
|
|
192
191
|
}
|
|
193
|
-
console.log( 'page', page );
|
|
192
|
+
// console.log( 'page', page );
|
|
194
193
|
query.push( {
|
|
195
194
|
$facet: {
|
|
196
195
|
data: [
|
|
@@ -221,7 +220,7 @@ export const taskTableV1 = async ( req, res ) => {
|
|
|
221
220
|
|
|
222
221
|
return res.sendSuccess( { taskTableData: checkList[0].data, totalCount: checkList[0].count[0].totalCount } );
|
|
223
222
|
} catch ( e ) {
|
|
224
|
-
console.log( 'e', e );
|
|
223
|
+
// console.log( 'e', e );
|
|
225
224
|
logger.error( 'checklist =>', e );
|
|
226
225
|
return res.sendError( e, 500 );
|
|
227
226
|
}
|
|
@@ -422,7 +421,7 @@ export const taskInfoTableV1 = async ( req, res ) => {
|
|
|
422
421
|
}
|
|
423
422
|
return res.sendSuccess( result );
|
|
424
423
|
} catch ( error ) {
|
|
425
|
-
console.log( 'error =>', error );
|
|
424
|
+
// console.log( 'error =>', error );
|
|
426
425
|
logger.error( { error: error, message: req.query, function: 'taskInfo' } );
|
|
427
426
|
return res.sendError( { error: error }, 500 );
|
|
428
427
|
}
|
|
@@ -434,7 +433,7 @@ export const taskTable = async ( req, res ) => {
|
|
|
434
433
|
let resultData = await taskTableData( requestData );
|
|
435
434
|
return res.sendSuccess( resultData );
|
|
436
435
|
} catch ( error ) {
|
|
437
|
-
console.log( 'error =>', error );
|
|
436
|
+
// console.log( 'error =>', error );
|
|
438
437
|
logger.error( { error: error, function: 'taskTable' } );
|
|
439
438
|
return res.sendError( error, 500 );
|
|
440
439
|
}
|
|
@@ -528,7 +527,7 @@ async function taskTableData( requestData ) {
|
|
|
528
527
|
};
|
|
529
528
|
return tableData;
|
|
530
529
|
} catch ( error ) {
|
|
531
|
-
console.log( 'error =>', error );
|
|
530
|
+
// console.log( 'error =>', error );
|
|
532
531
|
logger.error( { error: error, message: requestData, function: 'taskTableData' } );
|
|
533
532
|
return res.sendError( error, 500 );
|
|
534
533
|
}
|
|
@@ -540,7 +539,7 @@ export const taskInfoTable = async ( req, res ) => {
|
|
|
540
539
|
let resultData = await taskInfoTableData( requestData );
|
|
541
540
|
return res.sendSuccess( resultData );
|
|
542
541
|
} catch ( error ) {
|
|
543
|
-
console.log( 'error =>', error );
|
|
542
|
+
// console.log( 'error =>', error );
|
|
544
543
|
logger.error( { error: error, function: 'taskInfoTable' } );
|
|
545
544
|
return res.sendError( error, 500 );
|
|
546
545
|
}
|
|
@@ -674,7 +673,7 @@ async function taskInfoTableData( requestData ) {
|
|
|
674
673
|
};
|
|
675
674
|
return tableInfoData;
|
|
676
675
|
} catch ( error ) {
|
|
677
|
-
console.log( 'error =>', error );
|
|
676
|
+
// console.log( 'error =>', error );
|
|
678
677
|
logger.error( { error: error, message: requestData, function: 'tableInfoData' } );
|
|
679
678
|
return res.sendError( error, 500 );
|
|
680
679
|
}
|
|
@@ -685,7 +684,7 @@ export const taskDropdownList = async ( req, res ) => {
|
|
|
685
684
|
let resultData = await taskDropdownListData( requestData );
|
|
686
685
|
return res.sendSuccess( resultData );
|
|
687
686
|
} catch ( error ) {
|
|
688
|
-
console.log( 'error =>', error );
|
|
687
|
+
// console.log( 'error =>', error );
|
|
689
688
|
logger.error( { error: error, function: 'taskDropdownList' } );
|
|
690
689
|
return res.sendError( error, 500 );
|
|
691
690
|
}
|
|
@@ -738,7 +737,7 @@ async function taskDropdownListData( requestData ) {
|
|
|
738
737
|
};
|
|
739
738
|
return taskDropdownListData;
|
|
740
739
|
} catch ( error ) {
|
|
741
|
-
console.log( 'error =>', error );
|
|
740
|
+
// console.log( 'error =>', error );
|
|
742
741
|
logger.error( { error: error, message: requestData, function: 'taskDropdownListData' } );
|
|
743
742
|
return res.sendError( error, 500 );
|
|
744
743
|
}
|
|
@@ -799,7 +798,7 @@ export const taskDropdownListV1 = async ( req, res ) => {
|
|
|
799
798
|
result.taskDropdown = getChecklistData;
|
|
800
799
|
return res.sendSuccess( result );
|
|
801
800
|
} catch ( error ) {
|
|
802
|
-
console.log( 'error =>', error );
|
|
801
|
+
// console.log( 'error =>', error );
|
|
803
802
|
logger.error( { error: error, message: req.query, function: 'checklistDropdown' } );
|
|
804
803
|
return res.sendError( { error: error }, 500 );
|
|
805
804
|
}
|
|
@@ -907,7 +906,7 @@ export const taskDropdownListNew = async ( req, res ) => {
|
|
|
907
906
|
result.taskDropdown = getChecklistData;
|
|
908
907
|
return res.sendSuccess( result );
|
|
909
908
|
} catch ( error ) {
|
|
910
|
-
console.log( 'error =>', error );
|
|
909
|
+
// console.log( 'error =>', error );
|
|
911
910
|
logger.error( { error: error, message: req.query, function: 'checklistDropdownV1' } );
|
|
912
911
|
return res.sendError( { error: error }, 500 );
|
|
913
912
|
}
|
|
@@ -918,7 +917,7 @@ export const taskInfoView = async ( req, res ) => {
|
|
|
918
917
|
let resultData = await taskInfoViewData( requestData );
|
|
919
918
|
return res.sendSuccess( resultData );
|
|
920
919
|
} catch ( error ) {
|
|
921
|
-
console.log( 'error =>', error );
|
|
920
|
+
// console.log( 'error =>', error );
|
|
922
921
|
logger.error( { error: error, function: 'taskInfoView' } );
|
|
923
922
|
return res.sendError( error, 500 );
|
|
924
923
|
}
|
|
@@ -949,7 +948,7 @@ async function taskInfoViewData( requestData ) {
|
|
|
949
948
|
};
|
|
950
949
|
return taskInfoViewData;
|
|
951
950
|
} catch ( error ) {
|
|
952
|
-
console.log( 'error =>', error );
|
|
951
|
+
// console.log( 'error =>', error );
|
|
953
952
|
logger.error( { error: error, message: requestData, function: 'taskInfoViewData' } );
|
|
954
953
|
return res.sendError( error, 500 );
|
|
955
954
|
}
|
|
@@ -964,7 +963,7 @@ export const taskDeleteV1 = async ( req, res ) => {
|
|
|
964
963
|
|
|
965
964
|
const taskConfig = await taskService.findOne( { _id: new mongoose.Types.ObjectId( requestData.taskId ) }, { _id: 1 } );
|
|
966
965
|
if ( !taskConfig ) {
|
|
967
|
-
console.log( 'Task found:', taskConfig );
|
|
966
|
+
// console.log( 'Task found:', taskConfig );
|
|
968
967
|
return res.sendError( 'Task not found', 404 );
|
|
969
968
|
}
|
|
970
969
|
|
|
@@ -974,7 +973,7 @@ export const taskDeleteV1 = async ( req, res ) => {
|
|
|
974
973
|
);
|
|
975
974
|
|
|
976
975
|
if ( resultData ) {
|
|
977
|
-
console.log( 'Update result:', resultData );
|
|
976
|
+
// console.log( 'Update result:', resultData );
|
|
978
977
|
return res.sendSuccess( { message: 'Task deleted successfully' } );
|
|
979
978
|
} else {
|
|
980
979
|
return res.sendError( 'Something went wrong please try again', 500 );
|