tango-app-api-store-builder 1.0.0-beta-48 → 1.0.0-beta-49
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
|
@@ -8,6 +8,8 @@ import { logger, fileUpload, signedUrl } from 'tango-app-api-middleware';
|
|
|
8
8
|
import * as planoTaskService from '../service/planoTask.service.js';
|
|
9
9
|
import * as planoService from '../service/planogram.service.js';
|
|
10
10
|
import * as checklistService from '../service/checklist.service.js';
|
|
11
|
+
import timeZone from 'dayjs/plugin/timezone.js';
|
|
12
|
+
dayjs.extend( timeZone );
|
|
11
13
|
|
|
12
14
|
async function createUser( data ) {
|
|
13
15
|
try {
|
|
@@ -404,7 +406,15 @@ export async function updateStatus( req, res ) {
|
|
|
404
406
|
if ( !taskDetails ) {
|
|
405
407
|
return res.sendError( 'No data found', 204 );
|
|
406
408
|
}
|
|
407
|
-
await
|
|
409
|
+
let storeTimeZone = await storeService.findOne( { storeName: { $regex: taskDetails.storeName, $options: 'i' }, clientId: taskDetails.client_id }, { 'storeProfile.timeZone': 1 } );
|
|
410
|
+
let currentDateTime;
|
|
411
|
+
if ( storeTimeZone?.storeProfile?.timeZone ) {
|
|
412
|
+
currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
|
|
413
|
+
} else {
|
|
414
|
+
currentDateTime = requestData?.currentTime ? dayjs( requestData.currentTime, 'HH:mm:ss' ) : dayjs();
|
|
415
|
+
}
|
|
416
|
+
let submitTimeString = currentDateTime.format( 'hh:mm A, DD MMM YYYY' );
|
|
417
|
+
await processedService.updateOne( { _id: req.body.taskId }, { checklistStatus: req.body.status, ...( req.body.status == 'inprogress' ) ? { startTime_string: submitTimeString } : { submitTime_string: submitTimeString } } );
|
|
408
418
|
if ( req.body.status == 'submit' ) {
|
|
409
419
|
await processedService.deleteMany( { _id: req.body.taskId, date_iso: { $gt: new Date( dayjs().format( 'YYYY-MM-DD' ) ) } } );
|
|
410
420
|
}
|
|
@@ -12,6 +12,10 @@ export async function updateOne( query = {}, record = {} ) {
|
|
|
12
12
|
return model.taskProcessedModel.updateOne( query, { $set: record }, { upsert: true } );
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export async function deleteMany( query = {} ) {
|
|
16
|
+
return model.taskProcessedModel.deleteMany( query );
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
export async function find( query = {}, field = {} ) {
|
|
16
20
|
return model.taskProcessedModel.find( query, field );
|
|
17
21
|
}
|