tango-app-api-trax 3.5.2-alpha-9 → 3.5.2-alpha-11

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-trax",
3
- "version": "3.5.2-alpha-9",
3
+ "version": "3.5.2-alpha-11",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -280,11 +280,17 @@ export const checklistDropdown = async ( req, res ) => {
280
280
 
281
281
  export async function approveChecklist( req, res ) {
282
282
  try {
283
+ if ( !( req.body.storeId.length > 0 || req.body.userEmail.length > 0 ) ) {
284
+ return res.sendError( 'StoreId or user Email required', 400 );
285
+ }
283
286
  let toDate = new Date( req.body.toDate );
284
287
  let userTimezoneOffset = toDate.getTimezoneOffset() * 60000;
285
288
  toDate = new Date( toDate.getTime() - userTimezoneOffset );
286
289
  toDate.setUTCHours( 23, 59, 59, 59 );
287
290
  let query = { sourceCheckList_id: req.body.sourceCheckList_id, date_iso: { $gte: req.body.fromDate, $lte: toDate }, $or: [ { checklistStatus: 'submit' }, { redoStatus: true } ], approvalEnable: true };
291
+ if ( !( req.body.assignedStores && req.body.assignedStores.length >0 ) ) {
292
+ req.body.assignedStores = req.body.storeId;
293
+ }
288
294
  if ( req.body?.storeId?.length ) {
289
295
  const filteredStoreIds = req.body.storeId.filter( ( store ) => req.body.assignedStores.includes( store ) );
290
296
  query['store_id'] = { $in: filteredStoreIds };
@@ -338,7 +344,7 @@ export async function approveChecklist( req, res ) {
338
344
  };
339
345
  let url = JSON.parse( process.env.LAMBDAURL );
340
346
  let searchResponse = await fetch( url.approveChecklist, requestOptions );
341
- console.log( searchResponse );
347
+ // console.log( searchResponse );
342
348
  const filteredStoreIds = req.body.storeId.filter( ( store ) => req.body.assignedStores.includes( store ) );
343
349
  let logData= {
344
350
  'client_id': checklistDetails[0].client_id,