@infrab4a/connect 4.9.7-beta.20 → 4.9.7-beta.21

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/index.cjs.js CHANGED
@@ -2541,8 +2541,6 @@ class ProductsIndex {
2541
2541
  'rate',
2542
2542
  ];
2543
2543
  const filter = [{ term: { published: true } }];
2544
- if (shop && shop !== exports.Shops.ALL)
2545
- filter.push({ term: { tags: shop == exports.Shops.GLAMSHOP ? 'feminino' : 'masculino' } });
2546
2544
  if (size > 9)
2547
2545
  fields.push(...['pricePaid', 'isGift', 'stock', 'weight', 'tags']);
2548
2546
  const query = {
@@ -5882,6 +5880,24 @@ class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
5882
5880
  ],
5883
5881
  });
5884
5882
  }
5883
+ async updateManyStatus(reviews) {
5884
+ return await this.mutation('update_product_review_many', ['affected_rows'], {
5885
+ updates: {
5886
+ type: '[product_review_updates!]',
5887
+ required: true,
5888
+ value: [
5889
+ {
5890
+ _set: { status: true },
5891
+ where: { id: { _in: reviews.filter((review) => review.status).map((review) => review.id) } },
5892
+ },
5893
+ {
5894
+ _set: { status: false },
5895
+ where: { id: { _in: reviews.filter((review) => !review.status).map((review) => review.id) } },
5896
+ },
5897
+ ],
5898
+ },
5899
+ });
5900
+ }
5885
5901
  aproveReview(id) {
5886
5902
  return this.update({ id, status: true });
5887
5903
  }
@@ -6143,6 +6159,15 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6143
6159
  }),
6144
6160
  },
6145
6161
  },
6162
+ {
6163
+ metadatas: {
6164
+ columnName: 'metadatas',
6165
+ fields: ['shop', 'title', 'description'],
6166
+ bindPersistData: (value) => ({
6167
+ metadatas: { data: value },
6168
+ }),
6169
+ },
6170
+ },
6146
6171
  { isCollection: { columnName: 'is_collection' } },
6147
6172
  { isWishlist: { columnName: 'is_wishlist' } },
6148
6173
  'reference',
@@ -6162,6 +6187,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6162
6187
  'theme',
6163
6188
  { bannerUrl: { columnName: 'banner_url' } },
6164
6189
  { personHasPhoto: { columnName: 'person_has_photo' } },
6190
+ { mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
6165
6191
  ],
6166
6192
  });
6167
6193
  this.categoryFilterRepository = categoryFilterRepository;
package/index.esm.js CHANGED
@@ -2535,8 +2535,6 @@ class ProductsIndex {
2535
2535
  'rate',
2536
2536
  ];
2537
2537
  const filter = [{ term: { published: true } }];
2538
- if (shop && shop !== Shops.ALL)
2539
- filter.push({ term: { tags: shop == Shops.GLAMSHOP ? 'feminino' : 'masculino' } });
2540
2538
  if (size > 9)
2541
2539
  fields.push(...['pricePaid', 'isGift', 'stock', 'weight', 'tags']);
2542
2540
  const query = {
@@ -5876,6 +5874,24 @@ class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
5876
5874
  ],
5877
5875
  });
5878
5876
  }
5877
+ async updateManyStatus(reviews) {
5878
+ return await this.mutation('update_product_review_many', ['affected_rows'], {
5879
+ updates: {
5880
+ type: '[product_review_updates!]',
5881
+ required: true,
5882
+ value: [
5883
+ {
5884
+ _set: { status: true },
5885
+ where: { id: { _in: reviews.filter((review) => review.status).map((review) => review.id) } },
5886
+ },
5887
+ {
5888
+ _set: { status: false },
5889
+ where: { id: { _in: reviews.filter((review) => !review.status).map((review) => review.id) } },
5890
+ },
5891
+ ],
5892
+ },
5893
+ });
5894
+ }
5879
5895
  aproveReview(id) {
5880
5896
  return this.update({ id, status: true });
5881
5897
  }
@@ -6137,6 +6153,15 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6137
6153
  }),
6138
6154
  },
6139
6155
  },
6156
+ {
6157
+ metadatas: {
6158
+ columnName: 'metadatas',
6159
+ fields: ['shop', 'title', 'description'],
6160
+ bindPersistData: (value) => ({
6161
+ metadatas: { data: value },
6162
+ }),
6163
+ },
6164
+ },
6140
6165
  { isCollection: { columnName: 'is_collection' } },
6141
6166
  { isWishlist: { columnName: 'is_wishlist' } },
6142
6167
  'reference',
@@ -6156,6 +6181,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6156
6181
  'theme',
6157
6182
  { bannerUrl: { columnName: 'banner_url' } },
6158
6183
  { personHasPhoto: { columnName: 'person_has_photo' } },
6184
+ { mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
6159
6185
  ],
6160
6186
  });
6161
6187
  this.categoryFilterRepository = categoryFilterRepository;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.9.7-beta.20",
3
+ "version": "4.9.7-beta.21",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -3,4 +3,5 @@ import { ProductReviews } from '../models';
3
3
  export interface ProductReviewsRepository extends CrudRepository<ProductReviews> {
4
4
  aproveReview(id: number): Promise<ProductReviews>;
5
5
  disaproveReview(id: number): Promise<ProductReviews>;
6
+ updateManyStatus(reviews: Pick<ProductReviews, 'id' | 'status'>[]): Promise<void>;
6
7
  }
@@ -6,7 +6,7 @@ export declare class ProductsIndex {
6
6
  private index;
7
7
  constructor(adapter: ElasticSearchAdapter<Product>);
8
8
  getById(id: string): Promise<Product>;
9
- search(searchTerm: string, total: number, shop: string): Promise<import("..").ElasticSearchResult<Product>>;
9
+ search(searchTerm: string, total: number, shop?: string): Promise<import("..").ElasticSearchResult<Product>>;
10
10
  save(product: ProductHasuraGraphQL): Promise<void>;
11
11
  update(product: ProductHasuraGraphQL): Promise<void>;
12
12
  delete(id: string): Promise<void>;
@@ -6,6 +6,7 @@ declare const ProductReviewsHasuraGraphQLRepository_base: import("../../../../ut
6
6
  }, [HasuraConstructorParams<ProductReviews> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
7
7
  export declare class ProductReviewsHasuraGraphQLRepository extends ProductReviewsHasuraGraphQLRepository_base implements ProductReviewsRepository {
8
8
  constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<ProductReviews>, 'endpoint' | 'authOptions' | 'interceptors'>);
9
+ updateManyStatus(reviews: Pick<ProductReviews, 'id' | 'status'>[]): Promise<void>;
9
10
  aproveReview(id: number): Promise<ProductReviews>;
10
11
  disaproveReview(id: number): Promise<ProductReviews>;
11
12
  }