tango-app-api-trax 3.7.30 → 3.7.32
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
|
@@ -2095,8 +2095,32 @@ export async function submitTask( req, res ) {
|
|
|
2095
2095
|
}
|
|
2096
2096
|
|
|
2097
2097
|
const updateResult = await processedTask.updateOne( updateQuery, updateData );
|
|
2098
|
+
if ( submittype == 'submit' ) {
|
|
2099
|
+
updateOpenSearchTask( user, requestData );
|
|
2100
|
+
}
|
|
2098
2101
|
|
|
2099
2102
|
if ( updateResult.modifiedCount > 0 ) {
|
|
2103
|
+
let openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
2104
|
+
let inserttraxlogs = {
|
|
2105
|
+
client_id: req.user.clientId,
|
|
2106
|
+
createAt: new Date(),
|
|
2107
|
+
sourceCheckList_id: checklist.sourceCheckList_id,
|
|
2108
|
+
checkListName: checklist.checkListName,
|
|
2109
|
+
type: 'task',
|
|
2110
|
+
action: requestData?.submittype === 'draft' ? 'save' : 'submit',
|
|
2111
|
+
storeName: checklist.storeName,
|
|
2112
|
+
store_id: checklist.store_id,
|
|
2113
|
+
userName: checklist.userName,
|
|
2114
|
+
userEmail: checklist.userEmail,
|
|
2115
|
+
createdByEmail: checklist.userEmail,
|
|
2116
|
+
createdBy: checklist.userName,
|
|
2117
|
+
coverage: checklist.coverage,
|
|
2118
|
+
checkListType: checklist.checkListType,
|
|
2119
|
+
logDetails: {},
|
|
2120
|
+
userType: req.user.userType,
|
|
2121
|
+
};
|
|
2122
|
+
console.log( 'inserttraxlogs =>', inserttraxlogs );
|
|
2123
|
+
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
2100
2124
|
if ( submittype === 'submit' ) {
|
|
2101
2125
|
const excludedChecklists = [ 'Store Hygiene Check' ];
|
|
2102
2126
|
if ( !excludedChecklists.includes( checklist.checkListName ) ) {
|
|
@@ -2174,31 +2198,31 @@ export async function submitTask( req, res ) {
|
|
|
2174
2198
|
// };
|
|
2175
2199
|
// await checklistLogs.create( logInsertData );
|
|
2176
2200
|
|
|
2177
|
-
if ( submittype == 'submit' ) {
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
}
|
|
2201
|
+
// if ( submittype == 'submit' ) {
|
|
2202
|
+
// updateOpenSearchTask( user, requestData );
|
|
2203
|
+
// let openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
2204
|
+
// // console.log( 'openSearch', openSearch );
|
|
2205
|
+
// let inserttraxlogs = {
|
|
2206
|
+
// client_id: req.user.clientId,
|
|
2207
|
+
// createAt: new Date(),
|
|
2208
|
+
// sourceCheckList_id: checklist.sourceCheckList_id,
|
|
2209
|
+
// checkListName: checklist.checkListName,
|
|
2210
|
+
// type: 'task',
|
|
2211
|
+
// action: requestData?.submittype === 'draft' ? 'save' : 'submit',
|
|
2212
|
+
// storeName: checklist.storeName,
|
|
2213
|
+
// store_id: checklist.store_id,
|
|
2214
|
+
// userName: checklist.userName,
|
|
2215
|
+
// userEmail: checklist.userEmail,
|
|
2216
|
+
// createdByEmail: checklist.userEmail,
|
|
2217
|
+
// createdBy: checklist.userName,
|
|
2218
|
+
// coverage: checklist.coverage,
|
|
2219
|
+
// checkListType: checklist.checkListType,
|
|
2220
|
+
// logDetails: {},
|
|
2221
|
+
// userType: req.user.userType,
|
|
2222
|
+
// };
|
|
2223
|
+
// console.log( 'inserttraxlogs =>', inserttraxlogs );
|
|
2224
|
+
// insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
2225
|
+
// }
|
|
2202
2226
|
|
|
2203
2227
|
return res.sendSuccess( 'Task Updated Successfully' );
|
|
2204
2228
|
} else {
|
|
@@ -3746,7 +3746,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
|
|
|
3746
3746
|
submittedDetails = await processedchecklist.find( query );
|
|
3747
3747
|
}
|
|
3748
3748
|
await Promise.all( allQuestion.map( async ( element4 ) => {
|
|
3749
|
-
let getToken = userDetails.get( element4
|
|
3749
|
+
let getToken = userDetails.get( element4?.userId?.toString() );
|
|
3750
3750
|
if ( getToken && element4?.sendNotification && showEdit ) {
|
|
3751
3751
|
tokenList.push( getToken );
|
|
3752
3752
|
}
|
|
@@ -4511,6 +4511,7 @@ export async function updateAssign( req, res ) {
|
|
|
4511
4511
|
},
|
|
4512
4512
|
];
|
|
4513
4513
|
let assignUserDetails = await userService.aggregate( query );
|
|
4514
|
+
let storeProfileDetails;
|
|
4514
4515
|
if ( req.body.coverage == 'store' ) {
|
|
4515
4516
|
let storeList = req.body.assignedList.map( ( ele ) => ele?.storeId );
|
|
4516
4517
|
storeProfileDetails = await storeService.find( { storeId: { $in: storeList } }, { storeId: 1, city: '$storeProfile.city', country: '$storeProfile.country', state: '$storeProfile.state' } );
|