tango-app-api-store-builder 1.0.0-beta-27 → 1.0.0-beta-29
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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { storeBuilderRouter } from './src/routes/storeBuilder.routes.js';
|
|
2
|
-
import {
|
|
2
|
+
import { storeBuilderTaskRouter } from './src/routes/task.routes.js';
|
|
3
3
|
|
|
4
|
-
export { storeBuilderRouter,
|
|
4
|
+
export { storeBuilderRouter, storeBuilderTaskRouter };
|
package/package.json
CHANGED
|
@@ -948,6 +948,13 @@ export async function fixtureShelfProductv1( req, res ) {
|
|
|
948
948
|
if ( !planogram ) return res.sendError( 'Planogram not found', 204 );
|
|
949
949
|
if ( !fixture ) return res.sendError( 'Fixture not found', 204 );
|
|
950
950
|
|
|
951
|
+
let params = {
|
|
952
|
+
Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
953
|
+
file_path: fixture.imageUrl,
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
fixture.imageUrl = await signedUrl( params );
|
|
957
|
+
|
|
951
958
|
const currentDate = new Date( dayjs().format( 'YYYY-MM-DD' ) );
|
|
952
959
|
|
|
953
960
|
const getProducts = async ( mappings ) => {
|
|
@@ -972,6 +979,15 @@ export async function fixtureShelfProductv1( req, res ) {
|
|
|
972
979
|
const vmMappings = await planoMappingService.find( { fixtureId: new mongoose.Types.ObjectId( fixtureId ), type: 'vm' } );
|
|
973
980
|
const vmIds = vmMappings.map( ( mapping ) => mapping.productId );
|
|
974
981
|
const vms = await planoProductService.find( { _id: { $in: vmIds }, type: 'vm' } );
|
|
982
|
+
await Promise.all( vms.map( async ( vm ) => {
|
|
983
|
+
if ( vm?.productImageUrl ) {
|
|
984
|
+
let params = {
|
|
985
|
+
Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
986
|
+
file_path: vm?.productImageUrl,
|
|
987
|
+
};
|
|
988
|
+
vm.productImageUrl = await signedUrl( params );
|
|
989
|
+
}
|
|
990
|
+
} ) );
|
|
975
991
|
const vmMap = new Map( vms.map( ( vm ) => [ vm._id.toString(), vm.toObject() ] ) );
|
|
976
992
|
const vmDetails = vmMappings.map( ( mapping ) => vmMap.get( mapping.productId.toString() ) || {} );
|
|
977
993
|
|
|
@@ -1669,8 +1685,7 @@ export async function updateMissing( req, res ) {
|
|
|
1669
1685
|
|
|
1670
1686
|
export async function bulkFixtureUpload( req, res ) {
|
|
1671
1687
|
try {
|
|
1672
|
-
|
|
1673
|
-
const fixture = await storeFixtureService.findOne( { _id: new mongoose.Types.ObjectId( '' ) } );
|
|
1688
|
+
const fixture = await storeFixtureService.findOne( { _id: new mongoose.Types.ObjectId( req.body.id ) } );
|
|
1674
1689
|
|
|
1675
1690
|
console.log( fixture );
|
|
1676
1691
|
|
|
@@ -287,8 +287,7 @@ export async function updateStatus( req, res ) {
|
|
|
287
287
|
if ( !taskDetails ) {
|
|
288
288
|
return res.sendError( 'No data found', 204 );
|
|
289
289
|
}
|
|
290
|
-
|
|
291
|
-
taskDetails.save();
|
|
290
|
+
await processedService.updateOne( { _id: req.body.taskId }, { checklistStatus: req.body.status } );
|
|
292
291
|
return res.sendSuccess( 'Task status updated successfully' );
|
|
293
292
|
} catch ( e ) {
|
|
294
293
|
logger.error( { functionName: 'storeLayout', error: e } );
|
|
@@ -2,9 +2,9 @@ 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
|
-
export const
|
|
5
|
+
export const storeBuilderTaskRouter = express.Router();
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
storeBuilderTaskRouter
|
|
8
8
|
.post( '/createTask', taskController.createTask )
|
|
9
9
|
.get( '/taskDetails', taskController.getTaskDetails )
|
|
10
10
|
.post( '/uploadImage', taskController.uploadImage )
|
|
@@ -8,6 +8,10 @@ export async function findOne( query = {}, field = {} ) {
|
|
|
8
8
|
return model.taskProcessedModel.findOne( query, field );
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export async function updateOne( query = {}, record = {} ) {
|
|
12
|
+
return model.taskProcessedModel.updateOne( query, { $set: record } );
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
export async function find( query = {}, field = {} ) {
|
|
12
16
|
return model.taskProcessedModel.find( query, field );
|
|
13
17
|
}
|