whitelabel-db 1.1.72 → 1.1.74
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/dist/libs/liteapiv3.d.ts +3 -0
- package/dist/models/Hotel.js +21 -1
- package/package.json +1 -1
package/dist/libs/liteapiv3.d.ts
CHANGED
package/dist/models/Hotel.js
CHANGED
|
@@ -68,7 +68,27 @@ let Hotel = class Hotel extends sequelize_typescript_1.Model {
|
|
|
68
68
|
}, {});
|
|
69
69
|
}
|
|
70
70
|
// Helper function to get translated value or fallback
|
|
71
|
-
const getNestedValue = (key) => {
|
|
71
|
+
const getNestedValue = (key) => {
|
|
72
|
+
try {
|
|
73
|
+
const translationValue = translation[key];
|
|
74
|
+
// Check if translation value is empty string, empty array, or empty object
|
|
75
|
+
if (!translationValue ||
|
|
76
|
+
translationValue === '' ||
|
|
77
|
+
(Array.isArray(translationValue) && translationValue.length === 0) ||
|
|
78
|
+
(typeof translationValue === 'object' &&
|
|
79
|
+
Object.keys(translationValue).length === 0)) {
|
|
80
|
+
// If it's empty, return the hotel object value
|
|
81
|
+
return hotel[key];
|
|
82
|
+
}
|
|
83
|
+
// Otherwise, return the translation value
|
|
84
|
+
return translationValue;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
// In case of an error, return the hotel value as a fallback
|
|
88
|
+
console.error(`Error getting translation for key "${key}":`, error);
|
|
89
|
+
return hotel[key];
|
|
90
|
+
}
|
|
91
|
+
};
|
|
72
92
|
return Object.assign(hotel, {
|
|
73
93
|
name: getNestedValue('name'),
|
|
74
94
|
hotelDescription: getNestedValue('hotelDescription'),
|