tango-app-api-store-builder 1.0.0-beta-193 → 1.0.0-beta-194

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-store-builder",
3
- "version": "1.0.0-beta-193",
3
+ "version": "1.0.0-beta-194",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -963,7 +963,7 @@ export async function getMasterList( req, res ) {
963
963
  } :
964
964
  {} ),
965
965
  ...( req.body?.filter?.category?.length ?
966
- { fixtureCategory: { $in: req.body.filter.category } } :
966
+ { fixtureCate: { $in: req.body.filter.category } } :
967
967
  {} ),
968
968
  ...( req.body?.filter?.subCategory?.length ?
969
969
  { productSubCategory: { $in: req.body.subCategory.category } } :
@@ -971,6 +971,18 @@ export async function getMasterList( req, res ) {
971
971
  };
972
972
 
973
973
  const query = [
974
+ {
975
+ $addFields: {
976
+ fixtureCate: {
977
+ $concat: [
978
+ '$fixtureCategory',
979
+ ' - ',
980
+ { $toString: '$fixtureWidth.value' },
981
+ '$fixtureWidth.unit',
982
+ ],
983
+ },
984
+ },
985
+ },
974
986
  { $match: matchStage },
975
987
  {
976
988
  $lookup: {
@@ -998,6 +1010,7 @@ export async function getMasterList( req, res ) {
998
1010
  {
999
1011
  $project: {
1000
1012
  fixtureCategory: 1,
1013
+ fixtureCate: 1,
1001
1014
  fixtureName: 1,
1002
1015
  fixtureWidth: 1,
1003
1016
  clientId: 1,
@@ -1392,11 +1392,12 @@ async function getMaxVMLibCode() {
1392
1392
 
1393
1393
  export async function fixtureNameList( req, res ) {
1394
1394
  try {
1395
- let getFixtureDetails = await planoLibraryService.aggregate( [
1395
+ // planoLibraryService
1396
+ let getFixtureDetails = await fixtureTemplateService.aggregate( [
1396
1397
  {
1397
1398
  $match: {
1398
1399
  clientId: req.query.clientId,
1399
- status: 'complete',
1400
+ templateType: 'master',
1400
1401
  },
1401
1402
  },
1402
1403
  {
@@ -1422,7 +1423,14 @@ export async function fixtureNameList( req, res ) {
1422
1423
  },
1423
1424
  ] );
1424
1425
 
1425
- return res.sendSuccess( getFixtureDetails?.[0]?.fixtureDetails || [] );
1426
+ let result = getFixtureDetails?.[0]?.fixtureDetails.reduce( ( acc, ele ) => {
1427
+ if ( !acc[ele.fixtureName] ) {
1428
+ acc[ele.fixtureName] = ele;
1429
+ }
1430
+ return acc;
1431
+ }, {} );
1432
+
1433
+ return res.sendSuccess( result ? Object.values( result ) : [] );
1426
1434
  } catch ( e ) {
1427
1435
  logger.error( { functionName: 'fixtureNameList', error: e } );
1428
1436
  return res.sendError( e, 500 );