tango-app-api-task 3.2.1-beta-32 → 3.2.1-beta-34
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
|
@@ -484,7 +484,7 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
484
484
|
|
|
485
485
|
const duplicateStores = Object.keys( duplicateStore ).filter( ( storeName ) => duplicateStore[storeName].count > 1 );
|
|
486
486
|
if ( duplicateStores.length ) {
|
|
487
|
-
return res.
|
|
487
|
+
return res.sendError( { validate: false, duplicates: duplicateStores, message: 'Store and email is duplicated' }, 400 );
|
|
488
488
|
}
|
|
489
489
|
} else {
|
|
490
490
|
const duplicateUser = assignDetails.reduce( ( acc, obj ) => {
|
|
@@ -507,7 +507,7 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
507
507
|
|
|
508
508
|
const duplicateUsers = Object.keys( duplicateUser ).filter( ( storeName ) => duplicateUser[storeName].count > 1 );
|
|
509
509
|
if ( duplicateUsers.length ) {
|
|
510
|
-
return res.
|
|
510
|
+
return res.sendError( { validate: false, duplicates: duplicateUsers, message: 'Email is Duplicated' }, 400 );
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
|
|
@@ -527,6 +527,7 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
527
527
|
newEmail: { $toLower: '$email' },
|
|
528
528
|
isActive: 1,
|
|
529
529
|
clientId: 1,
|
|
530
|
+
userName: 1,
|
|
530
531
|
},
|
|
531
532
|
},
|
|
532
533
|
{
|
|
@@ -596,9 +597,10 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
596
597
|
} );
|
|
597
598
|
} else {
|
|
598
599
|
assignDetails.forEach( ( item ) => {
|
|
599
|
-
let
|
|
600
|
-
if (
|
|
601
|
-
item._id =
|
|
600
|
+
let getUserDetails = userDetails.find( ( user ) => user.newEmail.toLowerCase() == item.userEmail.toLowerCase() );
|
|
601
|
+
if ( getUserDetails ) {
|
|
602
|
+
item._id = getUserDetails._id;
|
|
603
|
+
item.userName = getUserDetails.userName;
|
|
602
604
|
}
|
|
603
605
|
} );
|
|
604
606
|
}
|
|
@@ -881,6 +883,7 @@ export async function taskConfig( req, res ) {
|
|
|
881
883
|
let endDate = dayjs.utc( configDetails?.scheduleDate ).format( 'YYYY-MM-DD' ) + ' ' + configDetails.scheduleEndTime;
|
|
882
884
|
configDetails.scheduleEndTimeISO = dayjs.utc( endDate, 'YYYY-MM-DD hh:mm A' ).format();
|
|
883
885
|
configDetails.publishDate = dayjs.utc( dayjs().format( 'hh:mm A' ), 'hh:mm A' ).format();
|
|
886
|
+
configDetails.storeCount = inputBody?.assignedUsers?.length || 0;
|
|
884
887
|
|
|
885
888
|
let response = await taskService.updateOne( { _id: inputBody._id }, configDetails );
|
|
886
889
|
if ( inputBody?.approver.length ) {
|
|
@@ -3573,7 +3576,7 @@ export async function customertrial( params ) {
|
|
|
3573
3576
|
export async function taskAssign( req, res ) {
|
|
3574
3577
|
try {
|
|
3575
3578
|
if ( !req.body.taskId ) {
|
|
3576
|
-
return res.sendError( '
|
|
3579
|
+
return res.sendError( 'task id is required', 400 );
|
|
3577
3580
|
}
|
|
3578
3581
|
if ( !req.body.coverage ) {
|
|
3579
3582
|
return res.sendError( 'Coverage is required', 400 );
|
|
@@ -3670,6 +3673,7 @@ export async function updateAssign( req, res ) {
|
|
|
3670
3673
|
clientId: req.body.clientId,
|
|
3671
3674
|
};
|
|
3672
3675
|
userDetails = await createUser( userData );
|
|
3676
|
+
userDetails = [ userDetails ];
|
|
3673
3677
|
}
|
|
3674
3678
|
let data = {
|
|
3675
3679
|
...assign,
|
|
@@ -3678,7 +3682,7 @@ export async function updateAssign( req, res ) {
|
|
|
3678
3682
|
checkListId: req.body.taskId,
|
|
3679
3683
|
coverage: req.body.coverage,
|
|
3680
3684
|
assignId: assign._id,
|
|
3681
|
-
userId: userDetails
|
|
3685
|
+
userId: userDetails?.[0]?._id,
|
|
3682
3686
|
checkListName: taskDetails.checkListName,
|
|
3683
3687
|
};
|
|
3684
3688
|
delete data._id;
|
|
@@ -9,7 +9,7 @@ taskRouter
|
|
|
9
9
|
.post( '/create', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isAdd' ] } ] } ), taskController.createUpdateTask )
|
|
10
10
|
.post( '/delete/:taskIds', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.deleteTask )
|
|
11
11
|
.get( '/details', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskController.taskDetails )
|
|
12
|
-
.get( '/userDetails', isAllowedSessionHandler,
|
|
12
|
+
.get( '/userDetails', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskController.userDetails )
|
|
13
13
|
.post( '/upload', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.validateUserv1 )
|
|
14
14
|
.post( '/uploadImage', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.uploadImage )
|
|
15
15
|
.post( '/config', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.taskConfig )
|