@infrab4a/connect 4.0.0-beta.21 → 4.0.0-beta.23
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/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +9 -8
- package/fesm2015/infrab4a-connect.mjs +19 -12
- package/fesm2015/infrab4a-connect.mjs.map +1 -1
- package/fesm2020/infrab4a-connect.mjs +8 -7
- package/fesm2020/infrab4a-connect.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2019,18 +2019,19 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2019
2019
|
interceptors,
|
|
2020
2020
|
});
|
|
2021
2021
|
this.homeCategoryGroupToPlain = (homeCategoryGroup) => ({
|
|
2022
|
-
category: homeCategoryGroup
|
|
2023
|
-
products: homeCategoryGroup
|
|
2022
|
+
category: homeCategoryGroup?.category?.toPlain(),
|
|
2023
|
+
products: homeCategoryGroup?.products?.map((product) => product?.toPlain()).filter(Boolean) || [],
|
|
2024
2024
|
});
|
|
2025
2025
|
this.plainToHomeCategoryGroup = (homeCategoryGroup) => ({
|
|
2026
|
-
category: Category.toInstance(homeCategoryGroup
|
|
2027
|
-
products: homeCategoryGroup.products
|
|
2026
|
+
category: Category.toInstance(homeCategoryGroup?.category),
|
|
2027
|
+
products: homeCategoryGroup.products?.map((product) => Product.toInstance(product)),
|
|
2028
2028
|
});
|
|
2029
2029
|
}
|
|
2030
2030
|
buildModelInstance() {
|
|
2031
2031
|
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
2032
2032
|
return {
|
|
2033
2033
|
toFirestore: (data) => {
|
|
2034
|
+
console.log(data);
|
|
2034
2035
|
const modifiedData = this.homeToFirestore(data);
|
|
2035
2036
|
return toFirestore(modifiedData);
|
|
2036
2037
|
},
|
|
@@ -2042,9 +2043,9 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2042
2043
|
}
|
|
2043
2044
|
homeToFirestore(home) {
|
|
2044
2045
|
if (home.data?.data) {
|
|
2045
|
-
home.data.data.discoverProducts = home.data.data.discoverProducts
|
|
2046
|
-
home.data.data.featuredProducts = home.data.data.featuredProducts
|
|
2047
|
-
home.data.data.verticalProducts = home.data.data.verticalProducts
|
|
2046
|
+
home.data.data.discoverProducts = home.data.data.discoverProducts?.map(this.homeCategoryGroupToPlain) || [];
|
|
2047
|
+
home.data.data.featuredProducts = home.data.data.featuredProducts?.map(this.homeCategoryGroupToPlain) || [];
|
|
2048
|
+
home.data.data.verticalProducts = home.data.data.verticalProducts?.map(this.homeCategoryGroupToPlain) || [];
|
|
2048
2049
|
}
|
|
2049
2050
|
return home;
|
|
2050
2051
|
}
|