tango-app-api-task 3.4.0-alpha-0 → 3.4.0-alpha-1
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,4 +1,4 @@
|
|
|
1
|
-
import { logger, fileUpload, signedUrl, getObject } from 'tango-app-api-middleware';
|
|
1
|
+
import { logger, fileUpload, signedUrl, getObject, insertOpenSearchData } from 'tango-app-api-middleware';
|
|
2
2
|
import * as taskService from '../service/task.service.js';
|
|
3
3
|
import * as checklistLogs from '../service/checklistLog.service.js';
|
|
4
4
|
import * as taskQuestionService from '../service/taskQuestion.service.js';
|
|
@@ -1713,6 +1713,26 @@ export async function createChecklistTask( req, res ) {
|
|
|
1713
1713
|
if ( !searchResponse.ok ) {
|
|
1714
1714
|
return res.sendError( 'Something went wrong', 500 );
|
|
1715
1715
|
}
|
|
1716
|
+
let logData= {
|
|
1717
|
+
'client_id': inputBody.clientId,
|
|
1718
|
+
'createAt': new Date(),
|
|
1719
|
+
'sourceCheckList_id': taskDetails.sourceCheckList_id,
|
|
1720
|
+
'checkListName': inputBody.checkListName,
|
|
1721
|
+
'fromCheckListName': taskDetails.checkListName,
|
|
1722
|
+
'type': 'task',
|
|
1723
|
+
'action': 'created',
|
|
1724
|
+
'store_id': storeDetails?.storeId?storeDetails.storeId:'',
|
|
1725
|
+
'storeName': inputBody?.storeName?inputBody?.storeName:'',
|
|
1726
|
+
'createdByEmail': req.user.email,
|
|
1727
|
+
'createdBy': req.user._id,
|
|
1728
|
+
'userName': inputBody.userName,
|
|
1729
|
+
'userEmail': inputBody.userEmail,
|
|
1730
|
+
'coverage': 'store',
|
|
1731
|
+
'logDetails': {},
|
|
1732
|
+
};
|
|
1733
|
+
let urlopensearch = JSON.parse( process.env.OPENSEARCH );
|
|
1734
|
+
console.log( 'logData', logData );
|
|
1735
|
+
await insertOpenSearchData( urlopensearch.traxActivityLog, logData );
|
|
1716
1736
|
}
|
|
1717
1737
|
await insertSingleProcessData( response?._id );
|
|
1718
1738
|
return res.sendSuccess( 'Task created successfully' );
|
|
@@ -1911,6 +1931,26 @@ export async function createChecklistMultiTask( req, res ) {
|
|
|
1911
1931
|
if ( !searchResponse.ok ) {
|
|
1912
1932
|
return res.sendError( 'Something went wrong', 500 );
|
|
1913
1933
|
}
|
|
1934
|
+
let logData= {
|
|
1935
|
+
'client_id': inputBody.clientId,
|
|
1936
|
+
'createAt': new Date(),
|
|
1937
|
+
'sourceCheckList_id': taskDetails.sourceCheckList_id,
|
|
1938
|
+
'checkListName': inputBody.checkListName,
|
|
1939
|
+
'fromCheckListName': taskDetails.checkListName,
|
|
1940
|
+
'type': 'task',
|
|
1941
|
+
'action': 'created',
|
|
1942
|
+
'store_id': storeDetails?.storeId?storeDetails.storeId:'',
|
|
1943
|
+
'storeName': originaldata?.storeName?originaldata?.storeName:'',
|
|
1944
|
+
'createdByEmail': req.user.email,
|
|
1945
|
+
'createdBy': req.user._id,
|
|
1946
|
+
// 'userName': inputBody.userName,
|
|
1947
|
+
// 'userEmail': inputBody.userEmail,
|
|
1948
|
+
'coverage': 'store',
|
|
1949
|
+
'logDetails': {},
|
|
1950
|
+
};
|
|
1951
|
+
let urlopensearch = JSON.parse( process.env.OPENSEARCH );
|
|
1952
|
+
console.log( 'logData', logData );
|
|
1953
|
+
await insertOpenSearchData( urlopensearch.traxActivityLog, logData );
|
|
1914
1954
|
}
|
|
1915
1955
|
await insertSingleProcessData( response?._id );
|
|
1916
1956
|
}
|
|
@@ -2001,7 +2041,7 @@ export async function redoTask( req, res ) {
|
|
|
2001
2041
|
return res.sendError( 'Question number is Required', 400 );
|
|
2002
2042
|
}
|
|
2003
2043
|
|
|
2004
|
-
let taskDetails = await taskProcessedService.findOne( { _id: req.body.payload._id }, { questionAnswers: 1, redoStatus: 1, checklistStatus: 1, client_id: 1, store_id: 1, storeName: 1, checkListType: 1, sourceCheckList_id: 1, checkListName: 1, submitTime: 1, userName: 1, answerType: 1 } );
|
|
2044
|
+
let taskDetails = await taskProcessedService.findOne( { _id: req.body.payload._id }, { questionAnswers: 1, redoStatus: 1, checklistStatus: 1, client_id: 1, store_id: 1, storeName: 1, checkListType: 1, sourceCheckList_id: 1, checkListName: 1, submitTime: 1, userName: 1, answerType: 1, userEmail: 1, coverage: 1 } );
|
|
2005
2045
|
if ( !taskDetails ) {
|
|
2006
2046
|
return res.sendError( 'No data found', 204 );
|
|
2007
2047
|
}
|
|
@@ -2066,6 +2106,26 @@ export async function redoTask( req, res ) {
|
|
|
2066
2106
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
2067
2107
|
let searchResponse = await fetch( url.redoTask, requestOptions );
|
|
2068
2108
|
// console.log( searchResponse.ok );
|
|
2109
|
+
let logData= {
|
|
2110
|
+
'client_id': taskDetails.client_id,
|
|
2111
|
+
'createAt': new Date(),
|
|
2112
|
+
'sourceCheckList_id': taskDetails.sourceCheckList_id,
|
|
2113
|
+
'checkListName': taskDetails.checkListName,
|
|
2114
|
+
'fromCheckListName': taskDetails.checkListName,
|
|
2115
|
+
'type': 'checklist',
|
|
2116
|
+
'action': 'redo',
|
|
2117
|
+
'storeName': taskDetails?.storeName?taskDetails?.storeName:'',
|
|
2118
|
+
'store_id': taskDetails?.store_id?taskDetails?.store_id:'',
|
|
2119
|
+
'userName': taskDetails.userName,
|
|
2120
|
+
'userEmail': taskDetails.userEmail,
|
|
2121
|
+
'createdByEmail': req.user.email,
|
|
2122
|
+
'createdBy': req.user.userName,
|
|
2123
|
+
'coverage': taskDetails.coverage,
|
|
2124
|
+
'logDetails': {},
|
|
2125
|
+
};
|
|
2126
|
+
let urlopensearch = JSON.parse( process.env.OPENSEARCH );
|
|
2127
|
+
console.log( 'logData', logData );
|
|
2128
|
+
await insertOpenSearchData( urlopensearch.traxActivityLog, logData );
|
|
2069
2129
|
if ( searchResponse.ok ) {
|
|
2070
2130
|
return res.sendSuccess( 'Question redo successfully' );
|
|
2071
2131
|
} else {
|
|
@@ -2095,7 +2155,7 @@ export async function redomultiTask( req, res ) {
|
|
|
2095
2155
|
return res.sendError( 'Question number is Required', 400 );
|
|
2096
2156
|
}
|
|
2097
2157
|
|
|
2098
|
-
let taskDetails = await taskProcessedService.findOne( { _id: originalData.checklistId }, { questionAnswers: 1, redoStatus: 1, checklistStatus: 1, client_id: 1, store_id: 1, storeName: 1, checkListType: 1, sourceCheckList_id: 1, checkListName: 1, submitTime: 1, userName: 1, answerType: 1 } );
|
|
2158
|
+
let taskDetails = await taskProcessedService.findOne( { _id: originalData.checklistId }, { questionAnswers: 1, redoStatus: 1, checklistStatus: 1, client_id: 1, store_id: 1, storeName: 1, checkListType: 1, sourceCheckList_id: 1, checkListName: 1, submitTime: 1, userName: 1, answerType: 1, userEmail: 1, coverage: 1 } );
|
|
2099
2159
|
if ( !taskDetails ) {
|
|
2100
2160
|
return res.sendError( 'No data found', 204 );
|
|
2101
2161
|
}
|
|
@@ -2162,6 +2222,26 @@ export async function redomultiTask( req, res ) {
|
|
|
2162
2222
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
2163
2223
|
let searchResponse = await fetch( url.redoTask, requestOptions );
|
|
2164
2224
|
console.log( searchResponse.ok );
|
|
2225
|
+
let logData= {
|
|
2226
|
+
'client_id': taskDetails.client_id,
|
|
2227
|
+
'createAt': new Date(),
|
|
2228
|
+
'sourceCheckList_id': taskDetails.sourceCheckList_id,
|
|
2229
|
+
'checkListName': taskDetails.checkListName,
|
|
2230
|
+
'fromCheckListName': taskDetails.checkListName,
|
|
2231
|
+
'type': 'checklist',
|
|
2232
|
+
'action': 'redo',
|
|
2233
|
+
'storeName': taskDetails?.storeName?taskDetails?.storeName:'',
|
|
2234
|
+
'store_id': taskDetails?.store_id?taskDetails?.store_id:'',
|
|
2235
|
+
'userName': taskDetails.userName,
|
|
2236
|
+
'userEmail': taskDetails.userEmail,
|
|
2237
|
+
'createdByEmail': req.user.email,
|
|
2238
|
+
'createdBy': req.user.userName,
|
|
2239
|
+
'coverage': taskDetails.coverage,
|
|
2240
|
+
'logDetails': {},
|
|
2241
|
+
};
|
|
2242
|
+
let urlopensearch = JSON.parse( process.env.OPENSEARCH );
|
|
2243
|
+
console.log( 'logData', logData );
|
|
2244
|
+
await insertOpenSearchData( urlopensearch.traxActivityLog, logData );
|
|
2165
2245
|
}
|
|
2166
2246
|
}
|
|
2167
2247
|
return res.sendSuccess( 'Question redo successfully' );
|