tango-app-api-store-builder 1.0.14 → 1.0.15
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
|
@@ -893,7 +893,6 @@ export async function updateStorePlano(req, res) {
|
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
895
|
|
|
896
|
-
// ❗ async changed here
|
|
897
896
|
for (let i = 0; i < currentFixtures.length; i++) {
|
|
898
897
|
const fixture = currentFixtures[i];
|
|
899
898
|
|
|
@@ -926,11 +925,14 @@ export async function updateStorePlano(req, res) {
|
|
|
926
925
|
}
|
|
927
926
|
}
|
|
928
927
|
|
|
928
|
+
|
|
929
929
|
await planoService.updateOne(
|
|
930
930
|
{ _id: floorData.toObject()?.planoId },
|
|
931
931
|
{ $set: { updatedAt: new Date() } },
|
|
932
932
|
);
|
|
933
933
|
|
|
934
|
+
updateFixtureNumber(floorId);
|
|
935
|
+
|
|
934
936
|
res.sendSuccess('Updated Successfully');
|
|
935
937
|
} catch (e) {
|
|
936
938
|
logger.error({ functionName: 'updateStorePlano', error: e });
|
|
@@ -938,6 +940,25 @@ export async function updateStorePlano(req, res) {
|
|
|
938
940
|
}
|
|
939
941
|
}
|
|
940
942
|
|
|
943
|
+
async function updateFixtureNumber(floorId){
|
|
944
|
+
let fixtureDetails = await storeFixtureService.findAndSort({ floorId: new mongoose.Types.ObjectId(floorId), fixtureType: { $ne: 'other' } }, {}, { fixtureType: -1, associatedElementNumber: 1 });
|
|
945
|
+
|
|
946
|
+
fixtureDetails.sort((a, b) => {
|
|
947
|
+
if (a.associatedElementNumber !== b.associatedElementNumber) {
|
|
948
|
+
return a.associatedElementNumber - b.associatedElementNumber;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
return a.associatedElementFixtureNumber - b.associatedElementFixtureNumber;
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
let fixtureNumber = 0;
|
|
955
|
+
|
|
956
|
+
for (let fixture of fixtureDetails) {
|
|
957
|
+
fixtureNumber++;
|
|
958
|
+
storeFixtureService.updateOne({ _id: fixture._id }, { fixtureNumber: fixtureNumber });
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
941
962
|
|
|
942
963
|
export async function fixtureList(req, res) {
|
|
943
964
|
try {
|