tango-app-api-store-builder 1.0.0-beta-223 → 1.0.0-beta-224
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
|
@@ -3369,7 +3369,7 @@ export async function fixtureShelfProductv2( req, res ) {
|
|
|
3369
3369
|
mappings.map( async ( mapping ) => {
|
|
3370
3370
|
const productData = productMap.get( mapping?.productId?.toString() ) || {};
|
|
3371
3371
|
delete productData._id;
|
|
3372
|
-
let mappingCompliance = await planoComplianceService.
|
|
3372
|
+
let mappingCompliance = await planoComplianceService.findLean( {
|
|
3373
3373
|
planoMappingId: mapping._id,
|
|
3374
3374
|
date: currentDate,
|
|
3375
3375
|
} );
|
|
@@ -3377,7 +3377,7 @@ export async function fixtureShelfProductv2( req, res ) {
|
|
|
3377
3377
|
Object.keys( shelfMapping ).forEach( ( ele ) => {
|
|
3378
3378
|
let eleArr = ele.split( ',' );
|
|
3379
3379
|
if ( eleArr.includes( productData.brandName.toLowerCase() ) ) {
|
|
3380
|
-
mappingCompliance = { ...mappingCompliance
|
|
3380
|
+
mappingCompliance = { ...mappingCompliance, fixtureDetails: shelfMapping[ele]?.[0] || {} };
|
|
3381
3381
|
}
|
|
3382
3382
|
} );
|
|
3383
3383
|
}
|
|
@@ -3427,6 +3427,7 @@ export async function fixtureShelfProductv2( req, res ) {
|
|
|
3427
3427
|
|
|
3428
3428
|
return res.sendError( 'Incorrect resolution level', 400 );
|
|
3429
3429
|
} catch ( e ) {
|
|
3430
|
+
console.log( e );
|
|
3430
3431
|
logger.error( { functionName: 'fixtureShelfProductv1', error: e, message: req.body } );
|
|
3431
3432
|
return res.sendError( e, 500 );
|
|
3432
3433
|
}
|
|
@@ -7012,12 +7013,13 @@ export async function searchProduct( req, res ) {
|
|
|
7012
7013
|
|
|
7013
7014
|
export async function updateProductMapping( req, res ) {
|
|
7014
7015
|
try {
|
|
7015
|
-
let storeDetails = await storeService.find( { clientId: req.body.clientId, ...( req.body.stores && { storeName: { $in: req.body.stores } } ), status: 'active' }, { storeId: 1 } );
|
|
7016
|
+
let storeDetails = await storeService.find( { clientId: req.body.clientId, ...( req.body.stores && { storeName: { $in: req.body.stores } } ), status: 'active' }, { storeId: 1, storeName: 1 } );
|
|
7016
7017
|
if ( !storeDetails.length ) {
|
|
7017
7018
|
return res.sendError( 'No data found', 204 );
|
|
7018
7019
|
}
|
|
7019
7020
|
await Promise.all( storeDetails.map( async ( store ) => {
|
|
7020
|
-
let
|
|
7021
|
+
let number = Number( store.storeName.replace( /\D/g, '' ) );
|
|
7022
|
+
let getLatestData = await fetch( `${JSON.parse( process.env.LAMBDAURL )?.getRFIDDetails}/${number}`, { method: 'GET' } );
|
|
7021
7023
|
if ( getLatestData.status == 200 ) {
|
|
7022
7024
|
let response = await getLatestData.json();
|
|
7023
7025
|
let data = response.mac_details.flatMap( ( ele ) => ele.body );
|
|
@@ -27,3 +27,7 @@ export async function updateOne( query, record ) {
|
|
|
27
27
|
export async function count( data ) {
|
|
28
28
|
return model.planoComplianceModel.countDocuments( data );
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
export async function findLean( query={}, field={} ) {
|
|
32
|
+
return model.planoComplianceModel.findOne( query, field ).lean();
|
|
33
|
+
}
|