tango-app-api-task 3.4.1-activitylog-2 → 3.4.1-activitylog-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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-task",
3
- "version": "3.4.1-activitylog-2",
3
+ "version": "3.4.1-activitylog-4",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -248,6 +248,7 @@ export async function createUpdateTask( req, res ) {
248
248
  questionEdit: questionList.questionEdit,
249
249
  questionDelete: questionList.questionDelete,
250
250
  },
251
+ userType: req?.user?.userType || '',
251
252
  };
252
253
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, insertLogData );
253
254
  }
@@ -266,6 +267,7 @@ export async function createUpdateTask( req, res ) {
266
267
  createdBy: req.user.userName,
267
268
  coverage: 'store',
268
269
  logDetails: {},
270
+ userType: req?.user?.userType || '',
269
271
  };
270
272
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
271
273
  }
@@ -285,6 +287,7 @@ export async function createUpdateTask( req, res ) {
285
287
  createdBy: req.user.userName,
286
288
  coverage: 'store',
287
289
  logDetails: {},
290
+ userType: req?.user?.userType || '',
288
291
  };
289
292
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
290
293
  }
@@ -1158,6 +1161,7 @@ export async function taskConfig( req, res ) {
1158
1161
  ...( inputBody.coverage == 'user' ) ? { userAdded: inputBody.added } :{ userAdded: [] },
1159
1162
  ...( req.body.removed.user.length ) ? { userRemoved: inputBody.removed.user } :{ userRemoved: [] },
1160
1163
  },
1164
+ userType: req?.user?.userType || '',
1161
1165
  };
1162
1166
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, insertData );
1163
1167
  }
@@ -1176,6 +1180,7 @@ export async function taskConfig( req, res ) {
1176
1180
  createdBy: req.user.userName,
1177
1181
  coverage: inputBody.coverage,
1178
1182
  logDetails: {},
1183
+ userType: req?.user?.userType || '',
1179
1184
  };
1180
1185
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
1181
1186
  }
@@ -1819,6 +1824,7 @@ export async function reinitiateTask( req, res ) {
1819
1824
  storeRemoved: [],
1820
1825
  userAdded: [],
1821
1826
  userRemoved: [],
1827
+ userType: req?.user?.userType || '',
1822
1828
  },
1823
1829
  };
1824
1830
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, insertData );
@@ -1907,15 +1913,26 @@ export async function createChecklistTask( req, res ) {
1907
1913
  }
1908
1914
 
1909
1915
  if ( response?._id ) {
1916
+ inputBody.question[0].answers.forEach( ( ans ) => {
1917
+ ans.validation = false;
1918
+ ans.showLinked = false;
1919
+ ans.linkedQuestion = 0;
1920
+ ans.validationType = '';
1921
+ if ( ![ 'image', 'descriptiveImage', 'multipleImage' ].includes( inputBody.question[0].answerType ) ) {
1922
+ ans.referenceImage = '';
1923
+ }
1924
+ } );
1910
1925
  if ( inputBody.question[0].questionReferenceImage.length ) {
1911
1926
  let images = [];
1912
1927
  inputBody.question[0].questionReferenceImage.forEach( ( ele ) => {
1913
- let imgUrl = decodeURIComponent( ele.split( '?' )[0] );
1914
- let url = imgUrl.split( '/' );
1915
- if ( url.includes( 'https:' ) || url.includes( 'http:' ) ) {
1916
- url.splice( 0, 3 );
1928
+ if ( ele.trim() ) {
1929
+ let imgUrl = decodeURIComponent( ele.split( '?' )[0] );
1930
+ let url = imgUrl.split( '/' );
1931
+ if ( url.includes( 'https:' ) || url.includes( 'http:' ) ) {
1932
+ url.splice( 0, 3 );
1933
+ }
1934
+ images.push( url.join( '/' ) );
1917
1935
  }
1918
- images.push( url.join( '/' ) );
1919
1936
  } );
1920
1937
  inputBody.question[0].questionReferenceImage = images;
1921
1938
  }
@@ -2026,6 +2043,7 @@ export async function createChecklistTask( req, res ) {
2026
2043
  'userEmail': inputBody.userEmail,
2027
2044
  'coverage': 'store',
2028
2045
  'logDetails': {},
2046
+ 'userType': req?.user?.userType || '',
2029
2047
  };
2030
2048
  let urlopensearch = JSON.parse( process.env.OPENSEARCH );
2031
2049
  console.log( 'logData', logData );
@@ -2245,6 +2263,7 @@ export async function createChecklistMultiTask( req, res ) {
2245
2263
  // 'userEmail': inputBody.userEmail,
2246
2264
  'coverage': 'store',
2247
2265
  'logDetails': {},
2266
+ 'userType': req?.user?.userType || '',
2248
2267
  };
2249
2268
  let urlopensearch = JSON.parse( process.env.OPENSEARCH );
2250
2269
  console.log( 'logData', logData );
@@ -2319,6 +2338,7 @@ export async function approveTask( req, res ) {
2319
2338
  'logDetails': {
2320
2339
  'approved': storeNames,
2321
2340
  },
2341
+ 'userType': req?.user?.userType || '',
2322
2342
  };
2323
2343
  let urlopensearch = JSON.parse( process.env.OPENSEARCH );
2324
2344
  console.log( 'logData', logData );
@@ -2438,6 +2458,7 @@ export async function redoTask( req, res ) {
2438
2458
  'createdBy': req.user.userName,
2439
2459
  'coverage': taskDetails.coverage,
2440
2460
  'logDetails': {},
2461
+ 'userType': req?.user?.userType || '',
2441
2462
  };
2442
2463
  let urlopensearch = JSON.parse( process.env.OPENSEARCH );
2443
2464
  console.log( 'logData', logData );
@@ -2554,6 +2575,7 @@ export async function redomultiTask( req, res ) {
2554
2575
  'createdBy': req.user.userName,
2555
2576
  'coverage': taskDetails.coverage,
2556
2577
  'logDetails': {},
2578
+ 'userType': req?.user?.userType || '',
2557
2579
  };
2558
2580
  let urlopensearch = JSON.parse( process.env.OPENSEARCH );
2559
2581
  console.log( 'logData', logData );
@@ -2998,6 +3020,7 @@ export const updatePublish = async ( req, res ) => {
2998
3020
  createdBy: req.user.userName,
2999
3021
  coverage: getCheckDetails.coverage,
3000
3022
  logDetails: {},
3023
+ userType: req?.user?.userType || '',
3001
3024
  };
3002
3025
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
3003
3026
  return res.sendSuccess( { checklistName: getCheckDetails.checkListName, message: 'Updated Successfully' } );
@@ -3084,6 +3107,7 @@ export const duplicateChecklist = async ( req, res ) => {
3084
3107
  createdBy: req.user.userName,
3085
3108
  coverage: checkDetails.coverage,
3086
3109
  logDetails: {},
3110
+ userType: req?.user?.userType || '',
3087
3111
  };
3088
3112
  insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, logObj );
3089
3113
  return res.sendSuccess( { message: 'Task Duplicated Successfully' } );
@@ -750,6 +750,7 @@ export const taskDropdownListV1 = async ( req, res ) => {
750
750
  let findAndQuery = [];
751
751
  findAndQuery.push(
752
752
  { client_id: requestData.clientId },
753
+ { $and: [ { checkListName: { $ne: '' } }, { checkListName: { $ne: null } } ] },
753
754
  // { checkListType: 'task' },
754
755
  // { isdeleted: false },
755
756
  );