tango-app-api-store-builder 1.0.11-dont-user → 1.0.12

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.11-dont-user",
3
+ "version": "1.0.12",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "path": "^0.12.7",
33
33
  "selenium-webdriver": "^4.31.0",
34
34
  "sharp": "^0.34.1",
35
- "tango-api-schema": "^2.5.3",
35
+ "tango-api-schema": "^2.5.11",
36
36
  "tango-app-api-middleware": "3.1.48",
37
37
  "url": "^0.11.4",
38
38
  "winston": "^3.17.0",
@@ -1012,7 +1012,10 @@ export async function updateFixtureStatus( req, res ) {
1012
1012
  await planoTaskService.updateOnefilters(
1013
1013
  { _id: new mongoose.Types.ObjectId( req.body._id ) },
1014
1014
  {
1015
- $set: { 'answers.$[ans].status': req.body.type },
1015
+ $set: {
1016
+ 'answers.$[ans].status': req.body.type,
1017
+ 'answers.$[ans].userAction': req.body.userAction
1018
+ }
1016
1019
  },
1017
1020
  [
1018
1021
  { 'ans._id': new mongoose.Types.ObjectId( req.body.answerId ) },
@@ -1277,7 +1280,7 @@ export async function updateStoreFixture( req, res ) {
1277
1280
 
1278
1281
  const currentFixture = await storeFixtureService.findOne( { _id: new mongoose.Types.ObjectId( fixtureId ) } );
1279
1282
  let currentFixtureDoc = currentFixture.toObject();
1280
- if ( req?.body?.taskType?.includes( 'fixture' ) || data?.taskType?.includes( 'fixture' ) ) {
1283
+ if ( data?.userAction === 'editWithAi' || data?.userAction === 'acceptAi' ) {
1281
1284
  let shelfDetails = await fixtureShelfService.find( { fixtureId: fixtureId } );
1282
1285
  data.shelfConfig.forEach( ( ele ) => {
1283
1286
  let findShelfProduct = shelfDetails.find( ( shelf ) => shelf.shelfNumber == ele.shelfNumber );
@@ -1513,7 +1516,8 @@ export async function updateStoreFixture( req, res ) {
1513
1516
  } );
1514
1517
  }
1515
1518
  await planoService.updateOne( { _id: currentFixtureDoc?.planoId }, { $set: { updatedAt: new Date() } } );
1516
- if ( data?.taskType?.includes( 'fixture' ) ) {
1519
+
1520
+ if ( data?.userAction === 'editWithAi' || data?.userAction === 'editWithPlano' ) {
1517
1521
  let comments = {
1518
1522
  userId: req.user._id,
1519
1523
  userName: req.user.userName,
@@ -1521,17 +1525,19 @@ export async function updateStoreFixture( req, res ) {
1521
1525
  responsetype: 'agree',
1522
1526
  comment: '',
1523
1527
  };
1524
- await planoTaskService.updateOne( { planoId: currentFixture.planoId, floorId: currentFixture.floorId, fixtureId: currentFixture._id }, { 'answers.0.status': 'agree', 'approvalStatus': 'approved' } );
1528
+ await planoTaskService.updateOne( { planoId: currentFixture.planoId, floorId: currentFixture.floorId, fixtureId: currentFixture._id }, { 'answers.0.status': 'agree', 'approvalStatus': 'approved','answers.0.userAction': data.userAction } );
1529
+
1525
1530
  await planoTaskService.updateOnefilters(
1526
- { planoId: new mongoose.Types.ObjectId( currentFixture.planoId ), floorId: new mongoose.Types.ObjectId( currentFixture.floorId ), fixtureId: new mongoose.Types.ObjectId( currentFixture._id ) },
1527
- {
1528
- $push: { 'answers.0.comments': comments },
1529
- },
1531
+ { planoId: new mongoose.Types.ObjectId(currentFixture.planoId), floorId: new mongoose.Types.ObjectId(currentFixture.floorId), fixtureId: new mongoose.Types.ObjectId(currentFixture._id) },
1532
+ {
1533
+ $push: { 'answers.0.comments': comments },
1534
+ },
1530
1535
  );
1536
+
1531
1537
  }
1532
- if ( req.body?.editMode ) {
1533
- await floorService.updateOne( { _id: new mongoose.Types.ObjectId( currentFixture.floorId ) }, { isEdited: true } );
1534
- }
1538
+ // if ( req.body?.editMode ) {
1539
+ // await floorService.updateOne( { _id: new mongoose.Types.ObjectId( currentFixture.floorId ) }, { isEdited: true } );
1540
+ // }
1535
1541
  res.sendSuccess( { message: 'Updated Successfully', ...( configId && { id: configId } ) } );
1536
1542
  } catch ( e ) {
1537
1543
  logger.error( { functionName: 'updateStoreFixture', error: e } );