tango-app-api-store-builder 1.0.0-beta-71 → 1.0.0-beta-73
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 +2 -2
- package/src/controllers/script.controller.js +130 -0
- package/src/controllers/storeBuilder.controller.js +63 -8
- package/src/controllers/task.controller.js +54 -12
- package/src/routes/script.routes.js +1 -0
- package/src/routes/storeBuilder.routes.js +5 -4
- package/src/routes/task.routes.js +2 -1
- package/src/service/fixtureShelf.service.js +8 -0
- package/src/service/{planoStaticBrandCategories.service.js → planoStaticData.service.js} +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-store-builder",
|
|
3
|
-
"version": "1.0.0-beta-
|
|
3
|
+
"version": "1.0.0-beta-73",
|
|
4
4
|
"description": "storeBuilder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"jszip": "^3.10.1",
|
|
25
25
|
"mongodb": "^6.12.0",
|
|
26
26
|
"nodemon": "^3.1.9",
|
|
27
|
-
"tango-api-schema": "^2.2.
|
|
27
|
+
"tango-api-schema": "^2.2.94",
|
|
28
28
|
"tango-app-api-middleware": "^3.1.48",
|
|
29
29
|
"winston": "^3.17.0",
|
|
30
30
|
"winston-daily-rotate-file": "^5.0.0",
|
|
@@ -1928,6 +1928,8 @@ export async function updatelayoutFeedback( req, res ) {
|
|
|
1928
1928
|
},
|
|
1929
1929
|
];
|
|
1930
1930
|
|
|
1931
|
+
await storeBuilderService.updateOne( { _id: floorDoc._id }, { layoutPolygon: layoutPolygon } );
|
|
1932
|
+
|
|
1931
1933
|
console.log( layoutPolygon, floorDoc._id );
|
|
1932
1934
|
}
|
|
1933
1935
|
}
|
|
@@ -1958,3 +1960,131 @@ export async function extractZipFileNames( req, res ) {
|
|
|
1958
1960
|
return res.sendError( e.message || 'Internal Server Error', 500 );
|
|
1959
1961
|
}
|
|
1960
1962
|
}
|
|
1963
|
+
|
|
1964
|
+
export async function updateFixtureFeedback( req, res ) {
|
|
1965
|
+
try {
|
|
1966
|
+
if ( req?.headers?.authorization?.split( ' ' )[1] !== 'hwjXfCD6TgMvc82cuSGZ9bNv9MuXsaiQ6uvx' ) {
|
|
1967
|
+
return res.sendError( 'Unauthorized', 401 );
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
if ( !req.body.length ) {
|
|
1971
|
+
return res.sendError( 'Store List is required', 400 );
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
const storeList = req.body;
|
|
1975
|
+
|
|
1976
|
+
for ( let i = 0; i < storeList.length; i++ ) {
|
|
1977
|
+
const store = storeList[i];
|
|
1978
|
+
|
|
1979
|
+
// const issueTypes = [
|
|
1980
|
+
// 'Fixture size is wrong',
|
|
1981
|
+
// 'Fixture type is wrong',
|
|
1982
|
+
// 'Fixture brand is wrong',
|
|
1983
|
+
// 'Fixture not in the store',
|
|
1984
|
+
// 'Shelves count/Product Category/Capacity is wrong',
|
|
1985
|
+
// 'Others',
|
|
1986
|
+
// ];
|
|
1987
|
+
|
|
1988
|
+
const planogram = await planoService.findOne( { storeName: store.storeName } );
|
|
1989
|
+
|
|
1990
|
+
const fixtureTaskList = await planoTaskService.find( { planoId: planogram.toObject()._id, type: 'fixture' } );
|
|
1991
|
+
|
|
1992
|
+
for ( let j = 0; j < fixtureTaskList.length; j++ ) {
|
|
1993
|
+
const fixtureTask = fixtureTaskList[j].toObject();
|
|
1994
|
+
|
|
1995
|
+
const [ q1 ] = fixtureTask.answers;
|
|
1996
|
+
|
|
1997
|
+
if ( q1.value === true ) {
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
const fixture = await storeFixtureService.findOne( { _id: fixtureTask.fixtureId } );
|
|
2002
|
+
|
|
2003
|
+
const fixtureDoc = fixture?.toObject();
|
|
2004
|
+
|
|
2005
|
+
|
|
2006
|
+
if ( q1.issues.includes( 'Shelves count/Product Category/Capacity is wrong' ) ) {
|
|
2007
|
+
const taskShelves = q1.data.shelves;
|
|
2008
|
+
|
|
2009
|
+
const fixtureShelves = await fixtureShelfService.findAndSort( { fixtureId: fixtureTask.fixtureId }, {}, { shelfNumber: 1 } );
|
|
2010
|
+
|
|
2011
|
+
const shelfCount = q1.data.shelves.length;
|
|
2012
|
+
|
|
2013
|
+
const fixtureCapacity = q1.data.shelves.reduce( ( sum, item ) => sum + ( item.productCapacity ? item.productCapacity : 0 ), 0 );
|
|
2014
|
+
|
|
2015
|
+
const updateFixture = await storeFixtureService.updateOne( { _id: fixtureDoc._id }, { shelfcount: shelfCount, fixtureCapacity: fixtureCapacity } );
|
|
2016
|
+
|
|
2017
|
+
console.log( updateFixture );
|
|
2018
|
+
|
|
2019
|
+
for ( let k = 0; k < taskShelves.length; k++ ) {
|
|
2020
|
+
const taskShelf = taskShelves[k];
|
|
2021
|
+
const productCapacity = taskShelf.productCapacity;
|
|
2022
|
+
const section = taskShelf.section;
|
|
2023
|
+
const subBrand = taskShelf.subBrand;
|
|
2024
|
+
const formattedsubBrand = subBrand.length ? ( subBrand.length > 1 ? subBrand.join( ' + ' ) : subBrand[0] ) : undefined;
|
|
2025
|
+
if ( taskShelves.length === fixtureShelves.length ) {
|
|
2026
|
+
const fixtureShelf = fixtureShelves.filter( ( shelf ) => {
|
|
2027
|
+
return shelf.toObject().shelfNumber === k+1;
|
|
2028
|
+
} );
|
|
2029
|
+
|
|
2030
|
+
const updateShelf = await fixtureShelfService.updateOne( { _id: fixtureShelf?.[0].toObject()._id }, { shelfCapacity: productCapacity, sectionName: formattedsubBrand, sectionZone: section } );
|
|
2031
|
+
|
|
2032
|
+
console.log( updateShelf );
|
|
2033
|
+
} else if ( taskShelves.length < fixtureShelves.length ) {
|
|
2034
|
+
const fixtureShelf = fixtureShelves.filter( ( shelf ) => {
|
|
2035
|
+
return shelf.toObject().shelfNumber === k+1;
|
|
2036
|
+
} );
|
|
2037
|
+
|
|
2038
|
+
|
|
2039
|
+
const updateShelf = await fixtureShelfService.updateOne( { _id: fixtureShelf?.[0].toObject()._id }, { shelfCapacity: productCapacity, sectionName: formattedsubBrand, sectionZone: section } );
|
|
2040
|
+
|
|
2041
|
+
console.log( updateShelf );
|
|
2042
|
+
|
|
2043
|
+
|
|
2044
|
+
const shelfDifference = fixtureShelves.length - taskShelves.length;
|
|
2045
|
+
|
|
2046
|
+
const shelvesToDelete = fixtureShelves.slice( -shelfDifference );
|
|
2047
|
+
|
|
2048
|
+
shelvesToDelete.map( async ( shelf ) => {
|
|
2049
|
+
await fixtureShelfService.deleteOne( { _id: shelf.toObject()._id } );
|
|
2050
|
+
} );
|
|
2051
|
+
} else if ( taskShelves.length > fixtureShelves.length ) {
|
|
2052
|
+
if ( k + 1 <= fixtureShelves.length ) {
|
|
2053
|
+
const fixtureShelf = fixtureShelves.filter( ( shelf ) => {
|
|
2054
|
+
return shelf.toObject().shelfNumber === k+1;
|
|
2055
|
+
} );
|
|
2056
|
+
|
|
2057
|
+
|
|
2058
|
+
const updateShelf = await fixtureShelfService.updateOne( { _id: fixtureShelf?.[0].toObject()._id }, { shelfCapacity: productCapacity, sectionName: formattedsubBrand, sectionZone: section } );
|
|
2059
|
+
|
|
2060
|
+
console.log( updateShelf );
|
|
2061
|
+
} else if ( k + 1 > fixtureShelves.length ) {
|
|
2062
|
+
const insertData = {
|
|
2063
|
+
'clientId': planogram.toObject().clientId,
|
|
2064
|
+
'storeName': planogram.toObject().storeName,
|
|
2065
|
+
'storeId': planogram.toObject().storeId,
|
|
2066
|
+
'planoId': planogram.toObject()._id,
|
|
2067
|
+
'floorId': fixtureDoc.floorId,
|
|
2068
|
+
'fixtureId': fixtureDoc._id,
|
|
2069
|
+
'shelfNumber': k+1,
|
|
2070
|
+
'shelfOrder': 'LTR',
|
|
2071
|
+
'shelfCapacity': productCapacity,
|
|
2072
|
+
'sectionName': formattedsubBrand,
|
|
2073
|
+
'sectionZone': section,
|
|
2074
|
+
};
|
|
2075
|
+
|
|
2076
|
+
|
|
2077
|
+
await fixtureShelfService.create( insertData );
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
res.sendSuccess( 'Updated successfully' );
|
|
2086
|
+
} catch ( e ) {
|
|
2087
|
+
logger.error( { functionName: 'updatelayoutFeedback', error: e } );
|
|
2088
|
+
return res.sendError( e.message || 'Internal Server Error', 500 );
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
@@ -14,7 +14,7 @@ import * as planoComplianceService from '../service/planoCompliance.service.js';
|
|
|
14
14
|
import * as planoTaskComplianceService from '../service/planoTask.service.js';
|
|
15
15
|
import * as planoQrConversionRequestService from '../service/planoQrConversionRequest.service.js';
|
|
16
16
|
import * as fixtureConfigService from '../service/fixtureConfig.service.js';
|
|
17
|
-
import * as
|
|
17
|
+
import * as planoStaticData from '../service/planoStaticData.service.js';
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
import path from 'path';
|
|
@@ -607,7 +607,7 @@ export async function storeFixturesv1( req, res ) {
|
|
|
607
607
|
date: currentDate,
|
|
608
608
|
} );
|
|
609
609
|
|
|
610
|
-
const shelves = await fixtureShelfService.
|
|
610
|
+
const shelves = await fixtureShelfService.findAndSort( { fixtureId: fixture._id }, { shelfNumber: 1, sectionName: 1, sectionZone: 1, shelfCapacity: 1 }, { shelfNumber: 1 } );
|
|
611
611
|
|
|
612
612
|
const shelfDetails = await Promise.all(
|
|
613
613
|
shelves.map( async ( shelf ) => {
|
|
@@ -702,7 +702,7 @@ export async function storeFixturesv1( req, res ) {
|
|
|
702
702
|
date: currentDate,
|
|
703
703
|
} );
|
|
704
704
|
|
|
705
|
-
const shelves = await fixtureShelfService.
|
|
705
|
+
const shelves = await fixtureShelfService.findAndSort( { fixtureId: fixture._id }, { shelfNumber: 1, sectionName: 1, sectionZone: 1, shelfCapacity: 1 }, { shelfNumber: 1 } );
|
|
706
706
|
|
|
707
707
|
const shelfDetails = await Promise.all(
|
|
708
708
|
shelves.map( async ( shelf ) => {
|
|
@@ -1081,7 +1081,7 @@ export async function fixtureShelfProductv1( req, res ) {
|
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
1083
|
if ( [ 'L2', 'L4' ].includes( fixture.toObject().productResolutionLevel ) ) {
|
|
1084
|
-
const fixtureShelves = await fixtureShelfService.
|
|
1084
|
+
const fixtureShelves = await fixtureShelfService.findAndSort( { fixtureId: new mongoose.Types.ObjectId( fixtureId ) }, {}, { shelfNumber: 1 } );
|
|
1085
1085
|
// if ( !fixtureShelves.length ) return res.sendError( 'No shelves found for the fixture', 204 );
|
|
1086
1086
|
const productCount = await planoMappingService.count( { fixtureId: new mongoose.Types.ObjectId( fixtureId ), type: 'product' } );
|
|
1087
1087
|
const shelfProducts = await Promise.all(
|
|
@@ -1095,7 +1095,7 @@ export async function fixtureShelfProductv1( req, res ) {
|
|
|
1095
1095
|
}
|
|
1096
1096
|
|
|
1097
1097
|
if ( fixture.toObject().productResolutionLevel === 'L3' ) {
|
|
1098
|
-
const fixtureShelves = await fixtureShelfService.
|
|
1098
|
+
const fixtureShelves = await fixtureShelfService.findAndSort( { fixtureId: new mongoose.Types.ObjectId( fixtureId ) }, {}, { shelfNumber: 1 } );
|
|
1099
1099
|
// if ( !fixtureShelves.length ) return res.sendError( 'No shelves found for the fixture', 204 );
|
|
1100
1100
|
const productCount = await planoMappingService.count( { fixtureId: new mongoose.Types.ObjectId( fixtureId ), type: 'product' } );
|
|
1101
1101
|
const groupedShelves = fixtureShelves.reduce( async ( accPromise, shelf ) => {
|
|
@@ -2048,7 +2048,7 @@ export async function storeFixturesTask( req, res ) {
|
|
|
2048
2048
|
date_string: req.body?.date,
|
|
2049
2049
|
}, { status: 1 } );
|
|
2050
2050
|
|
|
2051
|
-
const shelves = await fixtureShelfService.
|
|
2051
|
+
const shelves = await fixtureShelfService.findAndSort( { fixtureId: fixture._id }, { shelfNumber: 1, sectionName: 1, sectionZone: 1, shelfCapacity: 1 }, { shelfNumber: 1 } );
|
|
2052
2052
|
|
|
2053
2053
|
const shelfDetails = await Promise.all(
|
|
2054
2054
|
shelves.map( async ( shelf ) => {
|
|
@@ -2128,7 +2128,7 @@ export async function storeFixturesTask( req, res ) {
|
|
|
2128
2128
|
date_string: req.body?.date,
|
|
2129
2129
|
}, { status: 1 } );
|
|
2130
2130
|
|
|
2131
|
-
const shelves = await fixtureShelfService.
|
|
2131
|
+
const shelves = await fixtureShelfService.findAndSort( { fixtureId: fixture._id }, { shelfNumber: 1, sectionName: 1, sectionZone: 1, shelfCapacity: 1 }, { shelfNumber: 1 } );
|
|
2132
2132
|
|
|
2133
2133
|
const shelfDetails = await Promise.all(
|
|
2134
2134
|
shelves.map( async ( shelf ) => {
|
|
@@ -2437,6 +2437,61 @@ export const fixtureQrUpdate = async ( req, res ) => {
|
|
|
2437
2437
|
}
|
|
2438
2438
|
};
|
|
2439
2439
|
|
|
2440
|
+
export const fixtureQrUpdatev1 = async ( req, res ) => {
|
|
2441
|
+
try {
|
|
2442
|
+
const { fixtureId, date, productQr } = req.body;
|
|
2443
|
+
|
|
2444
|
+
const fixture = await storeFixtureService.findOne( { _id: new mongoose.Types.ObjectId( fixtureId ) }, { _id: 1 } );
|
|
2445
|
+
|
|
2446
|
+
if ( !fixture ) {
|
|
2447
|
+
return res.sendError( { message: 'Invalid fixture Id' }, 400 );
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
const fixtureShelves = await fixtureShelfService.find( { fixtureId: new mongoose.Types.ObjectId( fixtureId ) } );
|
|
2451
|
+
|
|
2452
|
+
let productIndex = 0;
|
|
2453
|
+
|
|
2454
|
+
const complianceData = fixtureShelves.map( ( shelf ) => {
|
|
2455
|
+
const shelfObj = shelf.toObject();
|
|
2456
|
+
const products = shelfObj.shelfCapacity ?
|
|
2457
|
+
Array.from( { length: shelfObj.shelfCapacity }, () => ( {
|
|
2458
|
+
category: shelfObj.sectionName,
|
|
2459
|
+
productIndex: productIndex++,
|
|
2460
|
+
status: 'missing',
|
|
2461
|
+
} ) ) :
|
|
2462
|
+
[];
|
|
2463
|
+
|
|
2464
|
+
return { ...shelfObj, products };
|
|
2465
|
+
} );
|
|
2466
|
+
|
|
2467
|
+
const productMap = new Map();
|
|
2468
|
+
productQr.forEach( ( productCv, i ) => {
|
|
2469
|
+
if ( productCv.parent_brand ) {
|
|
2470
|
+
productMap.set( i, productCv );
|
|
2471
|
+
}
|
|
2472
|
+
} );
|
|
2473
|
+
|
|
2474
|
+
complianceData.forEach( ( shelf ) => {
|
|
2475
|
+
shelf.products.forEach( ( product ) => {
|
|
2476
|
+
const matchedProduct = productMap.get( product.productIndex );
|
|
2477
|
+
if ( matchedProduct && product.category === matchedProduct.parent_brand ) {
|
|
2478
|
+
Object.assign( product, { status: 'proper', barcode: matchedProduct.barcode } );
|
|
2479
|
+
}
|
|
2480
|
+
} );
|
|
2481
|
+
} );
|
|
2482
|
+
|
|
2483
|
+
const currentDate = new Date( date );
|
|
2484
|
+
|
|
2485
|
+
await planoQrConversionRequestService.updateOne( { fixtureId: new mongoose.Types.ObjectId( fixtureId ), date: currentDate }, { status: 'data-received', receivedQr: productQr, processedData: complianceData } );
|
|
2486
|
+
|
|
2487
|
+
res.sendSuccess( complianceData );
|
|
2488
|
+
} catch ( error ) {
|
|
2489
|
+
logger.error( 'fixtureQrUpdate =>', error );
|
|
2490
|
+
return res.sendError( { message: 'Internal Server Error' }, 500 );
|
|
2491
|
+
}
|
|
2492
|
+
};
|
|
2493
|
+
|
|
2494
|
+
|
|
2440
2495
|
export const updateDetailedDistance = async ( req, res ) => {
|
|
2441
2496
|
try {
|
|
2442
2497
|
const { floorId, elementNumber, elementType, detailedDistance } = req.body;
|
|
@@ -2725,7 +2780,7 @@ export const getFixtureBrands = async ( req, res ) => {
|
|
|
2725
2780
|
|
|
2726
2781
|
// const [ data ] = sections;
|
|
2727
2782
|
|
|
2728
|
-
const brandCategories = await
|
|
2783
|
+
const brandCategories = await planoStaticData.findOne( { type: 'brandCategory' } );
|
|
2729
2784
|
|
|
2730
2785
|
return res.sendSuccess( brandCategories.toObject().data );
|
|
2731
2786
|
} catch ( error ) {
|
|
@@ -9,6 +9,7 @@ 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
11
|
import timeZone from 'dayjs/plugin/timezone.js';
|
|
12
|
+
import * as planoProductService from '../service/planoProduct.service.js';
|
|
12
13
|
dayjs.extend( timeZone );
|
|
13
14
|
|
|
14
15
|
async function createUser( data ) {
|
|
@@ -110,6 +111,32 @@ export async function createTask( req, res ) {
|
|
|
110
111
|
if ( !taskDetails.length ) {
|
|
111
112
|
return res.sendError( 'No data found', 204 );
|
|
112
113
|
}
|
|
114
|
+
let userEmailList = [ ...new Set( req.body.stores.map( ( ele ) => ele.email ) ) ];
|
|
115
|
+
for ( let mail of userEmailList ) {
|
|
116
|
+
let query = [
|
|
117
|
+
{
|
|
118
|
+
$addFields: {
|
|
119
|
+
emailLower: { $toLower: '$email' },
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
$match: {
|
|
124
|
+
clientId: req.body.clientId,
|
|
125
|
+
emailLower: mail.toLowerCase(),
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
userDetails = await userService.aggregate( query );
|
|
130
|
+
if ( !userDetails.length ) {
|
|
131
|
+
let userData = {
|
|
132
|
+
clientId: req.body.clientId,
|
|
133
|
+
mobileNumber: '',
|
|
134
|
+
email: mail,
|
|
135
|
+
userName: mail.split( '@' )[0],
|
|
136
|
+
};
|
|
137
|
+
await createUser( userData );
|
|
138
|
+
}
|
|
139
|
+
}
|
|
113
140
|
let endDate = dayjs().add( req.body.days, 'day' ).format( 'YYYY-MM-DD' );
|
|
114
141
|
await Promise.all( taskDetails.map( async ( task ) => {
|
|
115
142
|
let data = {
|
|
@@ -183,22 +210,22 @@ export async function createTask( req, res ) {
|
|
|
183
210
|
{
|
|
184
211
|
$match: {
|
|
185
212
|
clientId: req.body.clientId,
|
|
186
|
-
email: getUserEmail.email,
|
|
213
|
+
email: getUserEmail.email.toLowerCase(),
|
|
187
214
|
},
|
|
188
215
|
},
|
|
189
216
|
];
|
|
190
217
|
userDetails = await userService.aggregate( query );
|
|
191
|
-
if ( !userDetails.length ) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
} else {
|
|
200
|
-
|
|
201
|
-
}
|
|
218
|
+
// if ( !userDetails.length ) {
|
|
219
|
+
// let userData = {
|
|
220
|
+
// clientId: req.body.clientId,
|
|
221
|
+
// mobileNumber: '',
|
|
222
|
+
// email: getUserEmail.email,
|
|
223
|
+
// userName: getUserEmail.email.split( '@' )[0],
|
|
224
|
+
// };
|
|
225
|
+
// userDetails = await createUser( userData );
|
|
226
|
+
// } else {
|
|
227
|
+
userDetails = userDetails[0];
|
|
228
|
+
// }
|
|
202
229
|
}
|
|
203
230
|
let taskData = { ...data };
|
|
204
231
|
taskData.store_id = store.storeId;
|
|
@@ -564,3 +591,18 @@ export async function getFixtureDetails( req, res ) {
|
|
|
564
591
|
return res.sendError( e, 500 );
|
|
565
592
|
}
|
|
566
593
|
}
|
|
594
|
+
|
|
595
|
+
export async function getVmDetails( req, res ) {
|
|
596
|
+
try {
|
|
597
|
+
let getVms = await planoProductService.find( { type: 'vm' }, { productName: 1 } );
|
|
598
|
+
if ( !getVms.length ) {
|
|
599
|
+
return res.sendError( 'No data found', 204 );
|
|
600
|
+
}
|
|
601
|
+
getVms = [ ...new Set( getVms.map( ( ele ) => ele.productName ) ) ];
|
|
602
|
+
getVms.push( 'other' );
|
|
603
|
+
return res.sendSuccess( getVms );
|
|
604
|
+
} catch ( e ) {
|
|
605
|
+
logger.error( { functionName: 'getVmDetails', error: e } );
|
|
606
|
+
return res.sendError( e, 500 );
|
|
607
|
+
}
|
|
608
|
+
}
|
|
@@ -18,4 +18,5 @@ scriptRouter
|
|
|
18
18
|
.post( '/updateRfidProduct2', scriptController.updateRfidProduct2 )
|
|
19
19
|
.post( '/getProdTaskData', scriptController.getProdTaskData )
|
|
20
20
|
.post( '/updateLayoutFeedback', scriptController.updatelayoutFeedback )
|
|
21
|
+
.post( '/updateFixtureFeedback', scriptController.updateFixtureFeedback )
|
|
21
22
|
.post( '/getFileNames', scriptController.extractZipFileNames );
|
|
@@ -23,22 +23,23 @@ storeBuilderRouter
|
|
|
23
23
|
// .post( '/FixtureShelfDetails', storeBuilderController.fixtureShelfProduct )
|
|
24
24
|
// .post( '/scan', storeBuilderController.scan )
|
|
25
25
|
.post( '/storeLayout', isAllowedSessionHandler, validate( validateDtos.storeList ), storeBuilderController.storeLayout )
|
|
26
|
-
.post( '/storeFixtures',
|
|
27
|
-
.post( '/FixtureShelfDetails',
|
|
26
|
+
.post( '/storeFixtures', validate( validateDtos.storeList ), storeBuilderController.storeFixturesv1 )
|
|
27
|
+
.post( '/FixtureShelfDetails', validate( validateDtos.fixtureShelfProduct ), storeBuilderController.fixtureShelfProductv1 )
|
|
28
28
|
.post( '/scan', isAllowedSessionHandler, storeBuilderController.scanv1 )
|
|
29
29
|
.post( '/updateMissing', isAllowedSessionHandler, storeBuilderController.updateMissing )
|
|
30
30
|
.post( '/bulkFixtureUpload', isAllowedSessionHandler, storeBuilderController.bulkFixtureUpload )
|
|
31
31
|
.post( '/uploadImage', isAllowedSessionHandler, storeBuilderController.uploadImage )
|
|
32
|
-
.post( '/storeFixturesTask',
|
|
32
|
+
.post( '/storeFixturesTask', storeBuilderController.storeFixturesTask )
|
|
33
33
|
.post( '/qrFileUpload', isAllowedSessionHandler, storeBuilderController.qrFileUpload )
|
|
34
34
|
.post( '/updateQrCvProcessRequest', isAllowedSessionHandler, storeBuilderController.updateQrCvProcessRequest )
|
|
35
35
|
.post( '/getQrCvProcessRequest', isAllowedSessionHandler, storeBuilderController.getQrCvProcessRequest )
|
|
36
36
|
.post( '/fixtureQrUpdate', isAllowedSessionHandler, storeBuilderController.fixtureQrUpdate )
|
|
37
|
+
.post( '/fixtureQrUpdatev1', isAllowedSessionHandler, storeBuilderController.fixtureQrUpdatev1 )
|
|
37
38
|
.post( '/updateDeatailedDistance', isAllowedSessionHandler, storeBuilderController.updateDetailedDistance )
|
|
38
39
|
.post( '/upsertFixture', isAllowedSessionHandler, storeBuilderController.upsertFixtures )
|
|
39
40
|
.post( '/getshelfSections', isAllowedSessionHandler, storeBuilderController.getShelfSections )
|
|
40
41
|
.post( '/getFixtureTypes', isAllowedSessionHandler, storeBuilderController.getFixtureTypes )
|
|
41
42
|
.post( '/getFixtureLengths', isAllowedSessionHandler, storeBuilderController.getFixtureLengths )
|
|
42
|
-
.post( '/getFixtureBrands',
|
|
43
|
+
.post( '/getFixtureBrands', storeBuilderController.getFixtureBrands )
|
|
43
44
|
.post( '/checkPlanoExist', isAllowedSessionHandler, storeBuilderController.checkPlanoExist )
|
|
44
45
|
.post( '/storeLayoutElements', isAllowedSessionHandler, storeBuilderController.storeLayoutElements );
|
|
@@ -11,4 +11,5 @@ storeBuilderTaskRouter
|
|
|
11
11
|
.post( '/uploadImage', isAllowedSessionHandler, taskController.uploadImage )
|
|
12
12
|
.post( '/updateStatus', isAllowedSessionHandler, taskController.updateStatus )
|
|
13
13
|
.post( '/updateAnswers', isAllowedSessionHandler, taskController.updateAnswers )
|
|
14
|
-
.get( '/getFixtureDetails', isAllowedSessionHandler, taskController.getFixtureDetails )
|
|
14
|
+
.get( '/getFixtureDetails', isAllowedSessionHandler, taskController.getFixtureDetails )
|
|
15
|
+
.get( '/getVmDetails', isAllowedSessionHandler, taskController.getVmDetails );
|
|
@@ -4,6 +4,10 @@ export async function find( query={}, field={} ) {
|
|
|
4
4
|
return model.fixtureShelfModel.find( query, field );
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export async function findAndSort( query={}, field={}, sortField={} ) {
|
|
8
|
+
return model.fixtureShelfModel.find( query, field ).sort( sortField );
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
export async function findOne( query={}, field={} ) {
|
|
8
12
|
return model.fixtureShelfModel.findOne( query, field );
|
|
9
13
|
}
|
|
@@ -27,3 +31,7 @@ export async function create( data ) {
|
|
|
27
31
|
export async function count( data ) {
|
|
28
32
|
return model.fixtureShelfModel.countDocuments( data );
|
|
29
33
|
}
|
|
34
|
+
|
|
35
|
+
export async function deleteOne( query ) {
|
|
36
|
+
return model.fixtureShelfModel.deleteOne( query );
|
|
37
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import model from 'tango-api-schema';
|
|
2
2
|
|
|
3
3
|
export async function find( query={}, field={} ) {
|
|
4
|
-
return model.
|
|
4
|
+
return model.planoStaticData.find( query, field );
|
|
5
5
|
}
|
|
6
6
|
export async function findOne( query={}, field={} ) {
|
|
7
|
-
return model.
|
|
7
|
+
return model.planoStaticData.findOne( query, field );
|
|
8
8
|
}
|