@infrab4a/connect 4.0.0-beta.32 → 4.0.0-beta.34

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.
@@ -2305,6 +2305,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
2305
2305
  cleanShoppingCountFromIds() {
2306
2306
  return;
2307
2307
  }
2308
+ findCatalog(params) {
2309
+ return this.find(params);
2310
+ }
2308
2311
  }
2309
2312
 
2310
2313
  class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
@@ -3998,11 +4001,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3998
4001
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
3999
4002
  },
4000
4003
  },
4004
+ { hasStock: { columnName: 'has_stock' } },
4001
4005
  'slug',
4002
4006
  'type',
4003
4007
  'video',
4004
4008
  'weight',
4005
4009
  'gender',
4010
+ { intGender: { columnName: 'int_gender' } },
4006
4011
  { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
4007
4012
  { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
4008
4013
  { isKit: { columnName: 'is_kit' } },
@@ -4112,8 +4117,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4112
4117
  options.options?.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
4113
4118
  if (options.options?.maximum?.includes('price'))
4114
4119
  options.options?.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
4115
- options.options?.minimal.splice(options.options?.minimal.indexOf('price'), 1);
4116
- options.options?.maximum.splice(options.options?.maximum.indexOf('price'), 1);
4120
+ options.options?.minimal?.splice(options.options?.minimal.indexOf('price'), 1);
4121
+ options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
4117
4122
  return super.find({
4118
4123
  ...options,
4119
4124
  filters: { ...filters, productId: { operator: Where.ISNULL } },
@@ -4177,6 +4182,17 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4177
4182
  })),
4178
4183
  ], []);
4179
4184
  }
4185
+ async findCatalog(params, mainGender) {
4186
+ return this.find({
4187
+ ...params,
4188
+ filters: { ...params.filters, published: true },
4189
+ orderBy: {
4190
+ hasStock: 'desc',
4191
+ intGender: mainGender === 'female' ? 'desc' : 'asc',
4192
+ ...omit(params.orderBy, ['hasStock', 'intGender']),
4193
+ },
4194
+ });
4195
+ }
4180
4196
  async updateCategories(productId, { categories }) {
4181
4197
  if ('action' in categories && categories.action === 'remove') {
4182
4198
  await this.mutation('delete_category_product', ['affected_rows'], {
@@ -4424,6 +4440,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4424
4440
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
4425
4441
  },
4426
4442
  },
4443
+ { hasStock: { columnName: 'has_stock' } },
4427
4444
  'weight',
4428
4445
  { name: { to: () => '', from: () => undefined } },
4429
4446
  { hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },