tango-app-api-trax 3.3.1-beta-24 → 3.3.1-beta-26
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
|
@@ -397,6 +397,7 @@ export async function redoChecklist( req, res ) {
|
|
|
397
397
|
};
|
|
398
398
|
|
|
399
399
|
let response = await processedChecklist.updateOne( { _id: req.body.payload._id }, updateData );
|
|
400
|
+
conosole.log( response );
|
|
400
401
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
401
402
|
let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
402
403
|
let currentDateTime;
|
|
@@ -413,8 +414,8 @@ export async function redoChecklist( req, res ) {
|
|
|
413
414
|
sectionName: question[sectionIndex].sectionName,
|
|
414
415
|
questionName: question[sectionIndex].questions[findQuestion].qname,
|
|
415
416
|
action: 'redo',
|
|
416
|
-
store_id: checklistDetails
|
|
417
|
-
storeName: checklistDetails
|
|
417
|
+
store_id: checklistDetails?.store_id?checklistDetails?.store_id:'',
|
|
418
|
+
storeName: checklistDetails?.storeName?checklistDetails?.storeName:'',
|
|
418
419
|
client_id: checklistDetails.client_id,
|
|
419
420
|
processedChecklistId: checklistDetails._id,
|
|
420
421
|
type: checklistDetails.checkListType,
|
|
@@ -438,7 +439,7 @@ export async function redoChecklist( req, res ) {
|
|
|
438
439
|
};
|
|
439
440
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
440
441
|
let searchResponse = await fetch( url.redoChecklist, requestOptions );
|
|
441
|
-
|
|
442
|
+
console.log( searchResponse.ok );
|
|
442
443
|
|
|
443
444
|
if ( searchResponse.ok ) {
|
|
444
445
|
return res.sendSuccess( 'Question redo successfully' );
|
|
@@ -2061,13 +2061,13 @@ export async function assignChecklistUser( req, res ) {
|
|
|
2061
2061
|
let inputBody = req.body;
|
|
2062
2062
|
let assignDetails = inputBody.assignUsers;
|
|
2063
2063
|
let newUsers = inputBody.newUsers;
|
|
2064
|
-
if ( inputBody.type == 'upload' ) {
|
|
2065
|
-
await assignedService.deleteMany( { checkListId: inputBody.checklistId } );
|
|
2066
|
-
}
|
|
2067
2064
|
let checklistDetails = await checklistService.findOne( { _id: inputBody.checklistId } );
|
|
2068
2065
|
if ( !checklistDetails ) {
|
|
2069
2066
|
return res.sendError( 'No data found', 204 );
|
|
2070
2067
|
}
|
|
2068
|
+
if ( inputBody.type == 'upload' ) {
|
|
2069
|
+
await assignedService.deleteMany( { checkListId: inputBody.checklistId } );
|
|
2070
|
+
}
|
|
2071
2071
|
await Promise.all( newUsers.map( async ( user ) => {
|
|
2072
2072
|
let getUser = inputBody.assignUsers.find( ( ele ) => ele.userEmail.toLowerCase() == user.toLowerCase() );
|
|
2073
2073
|
let userData = {
|
|
@@ -2078,15 +2078,15 @@ export async function assignChecklistUser( req, res ) {
|
|
|
2078
2078
|
};
|
|
2079
2079
|
await createUser( userData );
|
|
2080
2080
|
} ) );
|
|
2081
|
-
await Promise.all( assignDetails.map( async ( assign ) => {
|
|
2081
|
+
let assignData = await Promise.all( assignDetails.map( async ( assign ) => {
|
|
2082
2082
|
assign.checklistId = inputBody.checklistId;
|
|
2083
2083
|
assign.checkListName = checklistDetails.checkListName;
|
|
2084
2084
|
assign.coverage = inputBody.coverage;
|
|
2085
2085
|
assign.clientId = inputBody.clientId;
|
|
2086
2086
|
assign.upload = inputBody.type;
|
|
2087
|
-
await assignUsers( assign );
|
|
2087
|
+
return await assignUsers( assign );
|
|
2088
2088
|
} ) );
|
|
2089
|
-
return res.sendSuccess(
|
|
2089
|
+
return res.sendSuccess( { idList: assignData.map( ( item ) => item.assignId ), assignData } );
|
|
2090
2090
|
} catch ( e ) {
|
|
2091
2091
|
logger.error( { functionName: 'assignUser', error: e } );
|
|
2092
2092
|
return res.sendError( e, 500 );
|
|
@@ -81,9 +81,10 @@ export const checklistPageValidation = {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
export const uploadUserSchema = joi.object( {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
id: joi.string().optional(),
|
|
85
|
+
checklistId: joi.string().optional(),
|
|
86
|
+
assignedUsers: joi.array().optional(),
|
|
87
|
+
uploadUser: joi.boolean().optional(),
|
|
87
88
|
type: joi.string().optional().allow( '' ),
|
|
88
89
|
addUser: joi.boolean().optional(),
|
|
89
90
|
delete: joi.boolean().optional(),
|