tango-app-api-store-builder 1.0.42 → 1.0.43
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
|
@@ -3613,9 +3613,13 @@ export async function shelfProduct( req, res ) {
|
|
|
3613
3613
|
} ),
|
|
3614
3614
|
);
|
|
3615
3615
|
|
|
3616
|
+
let properCount = shelfProducts.flatMap( ( ele ) => ele?.products.map( ( prod ) => prod?.status ) )?.filter( ( ele ) => ele == 'proper' )?.length;
|
|
3617
|
+
|
|
3618
|
+
let fixtureCompliance = Math.floor( ( properCount / fixture.fixtureCapacity ) * 100 );
|
|
3619
|
+
|
|
3616
3620
|
let storageProducts = await planoMappingService.find( { fixtureId: new mongoose.Types.ObjectId( fixtureId ), type: 'storageBox' } );
|
|
3617
3621
|
storageProducts = await getProducts( storageProducts );
|
|
3618
|
-
return res.sendSuccess( { ...fixture, shelves: shelfProducts, vmConfig: vmDetails, productCount: productCount, storageProducts: storageProducts, fixtureImage: fixtureImage } );
|
|
3622
|
+
return res.sendSuccess( { ...fixture, shelves: shelfProducts, vmConfig: vmDetails, productCount: productCount, storageProducts: storageProducts, fixtureImage: fixtureImage, fixtureCompliance } );
|
|
3619
3623
|
}
|
|
3620
3624
|
|
|
3621
3625
|
return res.sendError( 'Incorrect resolution level', 400 );
|
|
@@ -9204,3 +9208,46 @@ export async function getAllStores( req, res ) {
|
|
|
9204
9208
|
return res.sendError( e, 500 );
|
|
9205
9209
|
}
|
|
9206
9210
|
}
|
|
9211
|
+
|
|
9212
|
+
export async function getShelfDetails( req, res ) {
|
|
9213
|
+
try {
|
|
9214
|
+
if ( !req.body?.antenna ) {
|
|
9215
|
+
return res.sendError( 'ANtennaNo is required', 400 );
|
|
9216
|
+
}
|
|
9217
|
+
if ( !req.body.macId ) {
|
|
9218
|
+
return res.sendError( 'Mac id is required', 400 );
|
|
9219
|
+
}
|
|
9220
|
+
req.body.macId=req.body.macId.replaceAll( ':', '-' );
|
|
9221
|
+
|
|
9222
|
+
let query = [
|
|
9223
|
+
{
|
|
9224
|
+
$addFields: {
|
|
9225
|
+
reader: { $toLower: '$readerId' },
|
|
9226
|
+
},
|
|
9227
|
+
},
|
|
9228
|
+
{
|
|
9229
|
+
$match: {
|
|
9230
|
+
reader: req.body.macId.toLowerCase(),
|
|
9231
|
+
},
|
|
9232
|
+
},
|
|
9233
|
+
{
|
|
9234
|
+
$project: {
|
|
9235
|
+
_id: 1,
|
|
9236
|
+
},
|
|
9237
|
+
},
|
|
9238
|
+
];
|
|
9239
|
+
let fixtureDetails = await storeFixtureService.aggregate( query );
|
|
9240
|
+
if ( !fixtureDetails.length ) {
|
|
9241
|
+
return res.sendError( 'No mac found', 204 );
|
|
9242
|
+
}
|
|
9243
|
+
let shelfDetails = await fixtureShelfService.findOne( { fixtureId: { $in: fixtureDetails.map( ( ele ) => ele._id ) }, antennaNo: { $in: [ req.body?.antenna ] } } );
|
|
9244
|
+
|
|
9245
|
+
if ( !shelfDetails ) {
|
|
9246
|
+
return res.sendError( 'No antenna found', 204 );
|
|
9247
|
+
}
|
|
9248
|
+
return res.sendSuccess( shelfDetails );
|
|
9249
|
+
} catch ( e ) {
|
|
9250
|
+
logger.error( { functionName: 'getShelfDetails', error: e } );
|
|
9251
|
+
return res.sendError( e, 500 );
|
|
9252
|
+
}
|
|
9253
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import { validate, isAllowedSessionHandler, getAssinedStore } from 'tango-app-api-middleware';
|
|
2
|
+
import { validate, isAllowedSessionHandler, getAssinedStore, isAllowedInternalAPIHandler } from 'tango-app-api-middleware';
|
|
3
3
|
import * as validateDtos from '../dtos/validation.dtos.js';
|
|
4
4
|
import * as storeBuilderController from '../controllers/storeBuilder.controller.js';
|
|
5
5
|
// import * as scriptController from '../controllers/script.controller.js';
|
|
@@ -72,4 +72,5 @@ storeBuilderRouter
|
|
|
72
72
|
.post( '/revisionUpdate', storeBuilderController.revisionData )
|
|
73
73
|
.get( '/getAllStores', isAllowedSessionHandler, storeBuilderController.getAllStores )
|
|
74
74
|
.get( '/getStoreFloorsList', isAllowedSessionHandler, storeBuilderController.getStoreFloorsList )
|
|
75
|
+
.post( '/getShelfDetails', isAllowedInternalAPIHandler, storeBuilderController.getShelfDetails )
|
|
75
76
|
;
|