@infrab4a/connect-angular 4.11.0 → 4.11.1

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.
@@ -2020,6 +2020,21 @@ class WishlistService {
2020
2020
  personType: personType ?? PersonTypes.NONE,
2021
2021
  personIsSubscriber: personIsSubscriber ?? false,
2022
2022
  };
2023
+ const hasWishlist = await this.wishlistRepository
2024
+ .find({
2025
+ filters: {
2026
+ personId,
2027
+ },
2028
+ options: {
2029
+ enableCount: false,
2030
+ },
2031
+ orderBy: {
2032
+ id: 'asc',
2033
+ },
2034
+ })
2035
+ .then((res) => res.data);
2036
+ if (hasWishlist.length)
2037
+ return hasWishlist.at(0);
2023
2038
  const newWishlist = await this.wishlistRepository.create(data);
2024
2039
  await this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
2025
2040
  return Wishlist.toInstance({ ...newWishlist.toPlain(), slug: newWishlist.id });