tango-app-api-trax 3.5.0-alpha-0 → 3.5.0-alpha-2
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
|
@@ -14,6 +14,12 @@ import dayjs from 'dayjs';
|
|
|
14
14
|
import { aggregateTeams, findteams } from '../services/teams.service.js';
|
|
15
15
|
import { aggregate } from '../services/user.service.js';
|
|
16
16
|
// import axios from 'axios';
|
|
17
|
+
import timeZone from 'dayjs/plugin/timezone.js';
|
|
18
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
19
|
+
|
|
20
|
+
dayjs.extend( customParseFormat );
|
|
21
|
+
dayjs.extend( timeZone );
|
|
22
|
+
|
|
17
23
|
async function LamdaServiceCall( url, data ) {
|
|
18
24
|
try {
|
|
19
25
|
const requestOptions = {
|
|
@@ -291,11 +297,12 @@ export async function approveChecklist( req, res ) {
|
|
|
291
297
|
let approvalUpdateData = {
|
|
292
298
|
approvalStatus: true,
|
|
293
299
|
approvalTime: new Date(),
|
|
294
|
-
approvalTime_string: dayjs().format( 'hh:mm A, DD MMM YYYY' ),
|
|
300
|
+
// approvalTime_string: dayjs().format( 'hh:mm A, DD MMM YYYY' ),
|
|
301
|
+
approvalTime_string: dayjs().tz( 'Asia/Kolkata' ).format( 'hh:mm A, DD MMM YYYY' ),
|
|
295
302
|
approvalByName: req.user.userName,
|
|
296
303
|
approvalByEmail: req.user.email,
|
|
297
304
|
};
|
|
298
|
-
let updateResponse = await processedChecklist.updateMany( { _id: { $in: idList } }, approvalUpdateData );
|
|
305
|
+
let updateResponse = await processedChecklist.updateMany( { _id: { $in: idList }, approvalStatus: false }, approvalUpdateData );
|
|
299
306
|
if ( updateResponse.modifiedCount || updateResponse.matchedCount ) {
|
|
300
307
|
let inputstores = checklistDetails.filter( ( data ) => data.checklistStatus == 'submit' );
|
|
301
308
|
let storeNames = inputstores.map( ( data ) => data.storeName );
|
|
@@ -312,7 +319,7 @@ export async function approveChecklist( req, res ) {
|
|
|
312
319
|
'upsert': {
|
|
313
320
|
approvalStatus: true,
|
|
314
321
|
approvalTime: new Date(),
|
|
315
|
-
approvalTime_string: dayjs().format( 'hh:mm A, DD MMM YYYY' ),
|
|
322
|
+
approvalTime_string: dayjs().tz( 'Asia/Kolkata' ).format( 'hh:mm A, DD MMM YYYY' ),
|
|
316
323
|
approvalByName: req.user.userName,
|
|
317
324
|
approvalByEmail: req.user.email,
|
|
318
325
|
},
|
|
@@ -364,6 +371,7 @@ export async function approveChecklist( req, res ) {
|
|
|
364
371
|
return res.sendError( `${redoList.length} stores has not been approved since those stores are not submitted`, 400 );
|
|
365
372
|
}
|
|
366
373
|
} catch ( e ) {
|
|
374
|
+
// console.log( 'e', e );
|
|
367
375
|
logger.error( { function: 'approveChecklist', error: e } );
|
|
368
376
|
return res.sendError( e, 500 );
|
|
369
377
|
}
|