tango-app-api-store-builder 1.0.0-beta-51 → 1.0.0-beta-53
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
|
@@ -350,7 +350,7 @@ export async function getTaskDetails( req, res ) {
|
|
|
350
350
|
return res.sendError( 'Store id is required', 400 );
|
|
351
351
|
}
|
|
352
352
|
let date = req.query?.date || dayjs().format( 'YYYY-MM-DD' );
|
|
353
|
-
let getDetails = await processedService.find( { store_id: req.query.storeId, date_string: date, isPlano: true, checklistStatus: { $ne: 'submit' } }, { checkListName: 1, taskType: '$planoType' } );
|
|
353
|
+
let getDetails = await processedService.find( { store_id: req.query.storeId, date_string: date, isPlano: true, checklistStatus: { $ne: 'submit' }, userId: req.user._id }, { checkListName: 1, taskType: '$planoType' } );
|
|
354
354
|
return res.sendSuccess( getDetails );
|
|
355
355
|
} catch ( e ) {
|
|
356
356
|
logger.error( { functionName: 'getTaskDetails', error: e } );
|
|
@@ -448,6 +448,18 @@ export async function updateAnswers( req, res ) {
|
|
|
448
448
|
ans.video = ans.video.split( '.com/' )[1].split( '?' )[0];
|
|
449
449
|
ans.video = decodeURIComponent( ans.video );
|
|
450
450
|
}
|
|
451
|
+
if ( ans?.newVms?.length ) {
|
|
452
|
+
ans.newVms.forEach( ( vms ) => {
|
|
453
|
+
if ( vms?.imageUrl ) {
|
|
454
|
+
vms.imageUrl = vms.imageUrl.split( '.com/' )[1].split( '?' )[0];
|
|
455
|
+
vms.imageUrl = decodeURIComponent( vms.imageUrl );
|
|
456
|
+
}
|
|
457
|
+
if ( vms?.video ) {
|
|
458
|
+
vms.video = vms.video.split( '.com/' )[1].split( '?' )[0];
|
|
459
|
+
vms.video = decodeURIComponent( vms.video );
|
|
460
|
+
}
|
|
461
|
+
} );
|
|
462
|
+
}
|
|
451
463
|
} );
|
|
452
464
|
|
|
453
465
|
let data = {
|
|
@@ -506,6 +518,24 @@ export async function getFixtureDetails( req, res ) {
|
|
|
506
518
|
}
|
|
507
519
|
}
|
|
508
520
|
}
|
|
521
|
+
if ( ans?.newVms?.length ) {
|
|
522
|
+
for ( let fixture of ans.newVms ) {
|
|
523
|
+
if ( fixture.imageUrl ) {
|
|
524
|
+
let params = {
|
|
525
|
+
Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
526
|
+
file_path: fixture.imageUrl,
|
|
527
|
+
};
|
|
528
|
+
fixture.imageUrl = await signedUrl( params );
|
|
529
|
+
}
|
|
530
|
+
if ( fixture.video ) {
|
|
531
|
+
let params = {
|
|
532
|
+
Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
533
|
+
file_path: fixture.video,
|
|
534
|
+
};
|
|
535
|
+
fixture.video = await signedUrl( params );
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
509
539
|
if ( ans.image ) {
|
|
510
540
|
let params = {
|
|
511
541
|
Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
|
|
2
|
+
import { isAllowedSessionHandler } from 'tango-app-api-middleware';
|
|
3
3
|
import * as taskController from '../controllers/task.controller.js';
|
|
4
4
|
|
|
5
5
|
export const storeBuilderTaskRouter = express.Router();
|
|
@@ -7,7 +7,7 @@ export const storeBuilderTaskRouter = express.Router();
|
|
|
7
7
|
storeBuilderTaskRouter
|
|
8
8
|
.post( '/createTask', taskController.createTask )
|
|
9
9
|
.post( '/createPlano', taskController.createPlano )
|
|
10
|
-
.get( '/taskDetails', taskController.getTaskDetails )
|
|
10
|
+
.get( '/taskDetails', isAllowedSessionHandler, taskController.getTaskDetails )
|
|
11
11
|
.post( '/uploadImage', taskController.uploadImage )
|
|
12
12
|
.post( '/updateStatus', taskController.updateStatus )
|
|
13
13
|
.post( '/updateAnswers', taskController.updateAnswers )
|