@infrab4a/connect 4.0.0-beta.20 → 4.0.0-beta.22
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 +25 -25
- package/fesm2015/infrab4a-connect.mjs +33 -27
- package/fesm2015/infrab4a-connect.mjs.map +1 -1
- package/fesm2020/infrab4a-connect.mjs +25 -25
- package/fesm2020/infrab4a-connect.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2018,33 +2018,13 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2018
2018
|
model: Home,
|
|
2019
2019
|
interceptors,
|
|
2020
2020
|
});
|
|
2021
|
-
this.homeToFirestore = (home) => {
|
|
2022
|
-
if (home.data?.data) {
|
|
2023
|
-
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
|
|
2024
|
-
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.homeCategoryGroupToPlain);
|
|
2025
|
-
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.homeCategoryGroupToPlain);
|
|
2026
|
-
}
|
|
2027
|
-
return home;
|
|
2028
|
-
};
|
|
2029
2021
|
this.homeCategoryGroupToPlain = (homeCategoryGroup) => ({
|
|
2030
|
-
category: homeCategoryGroup.category
|
|
2031
|
-
products: homeCategoryGroup.products
|
|
2032
|
-
});
|
|
2033
|
-
this.homeFromFirestore = (home) => {
|
|
2034
|
-
if (home.data?.data) {
|
|
2035
|
-
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
2036
|
-
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
2037
|
-
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
2038
|
-
home.data.createdAt =
|
|
2039
|
-
home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
2040
|
-
home.data.expiresAt =
|
|
2041
|
-
home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
2042
|
-
}
|
|
2043
|
-
return home;
|
|
2044
|
-
};
|
|
2022
|
+
category: homeCategoryGroup.category?.toPlain(),
|
|
2023
|
+
products: homeCategoryGroup.products?.map((product) => product?.toPlain()).filter(Boolean) || [],
|
|
2024
|
+
});
|
|
2045
2025
|
this.plainToHomeCategoryGroup = (homeCategoryGroup) => ({
|
|
2046
|
-
category: Category.toInstance(homeCategoryGroup
|
|
2047
|
-
products: homeCategoryGroup.products
|
|
2026
|
+
category: Category.toInstance(homeCategoryGroup?.category),
|
|
2027
|
+
products: homeCategoryGroup.products?.map((product) => Product.toInstance(product)),
|
|
2048
2028
|
});
|
|
2049
2029
|
}
|
|
2050
2030
|
buildModelInstance() {
|
|
@@ -2060,6 +2040,26 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2060
2040
|
},
|
|
2061
2041
|
};
|
|
2062
2042
|
}
|
|
2043
|
+
homeToFirestore(home) {
|
|
2044
|
+
if (home.data?.data) {
|
|
2045
|
+
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
|
|
2046
|
+
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.homeCategoryGroupToPlain);
|
|
2047
|
+
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.homeCategoryGroupToPlain);
|
|
2048
|
+
}
|
|
2049
|
+
return home;
|
|
2050
|
+
}
|
|
2051
|
+
homeFromFirestore(home) {
|
|
2052
|
+
if (home.data?.data) {
|
|
2053
|
+
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
2054
|
+
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
2055
|
+
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
2056
|
+
home.data.createdAt =
|
|
2057
|
+
home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
2058
|
+
home.data.expiresAt =
|
|
2059
|
+
home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
2060
|
+
}
|
|
2061
|
+
return home;
|
|
2062
|
+
}
|
|
2063
2063
|
}
|
|
2064
2064
|
|
|
2065
2065
|
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|