@infrab4a/connect 4.0.0-beta.33 → 4.0.0-beta.35

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) {
@@ -3170,7 +3173,9 @@ const withFindHasuraGraphQL = (MixinBase) => {
3170
3173
  this.bindOrderByAttributes = (orderBy, fields) => Object.keys(orderBy).reduce((acc, current) => ({
3171
3174
  ...acc,
3172
3175
  [AttributeOptionHelper.FindByAttribute(current, fields)
3173
- .columnName]: orderBy[current],
3176
+ .columnName]: orderBy[current] === 'asc'
3177
+ ? 'asc_nulls_last'
3178
+ : 'desc_nulls_last',
3174
3179
  }), {});
3175
3180
  this.bindAggretageAttributes = (aggregates, fields) => [
3176
3181
  ...(aggregates?.minimal?.length
@@ -3998,11 +4003,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3998
4003
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
3999
4004
  },
4000
4005
  },
4006
+ { hasStock: { columnName: 'has_stock' } },
4001
4007
  'slug',
4002
4008
  'type',
4003
4009
  'video',
4004
4010
  'weight',
4005
4011
  'gender',
4012
+ { intGender: { columnName: 'int_gender' } },
4006
4013
  { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
4007
4014
  { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
4008
4015
  { isKit: { columnName: 'is_kit' } },
@@ -4177,6 +4184,17 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4177
4184
  })),
4178
4185
  ], []);
4179
4186
  }
4187
+ async findCatalog(params, mainGender) {
4188
+ return this.find({
4189
+ ...params,
4190
+ filters: { ...params.filters, published: true },
4191
+ orderBy: {
4192
+ hasStock: 'desc',
4193
+ intGender: mainGender === 'female' ? 'desc' : 'asc',
4194
+ ...omit(params.orderBy, ['hasStock', 'intGender']),
4195
+ },
4196
+ });
4197
+ }
4180
4198
  async updateCategories(productId, { categories }) {
4181
4199
  if ('action' in categories && categories.action === 'remove') {
4182
4200
  await this.mutation('delete_category_product', ['affected_rows'], {
@@ -4424,6 +4442,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4424
4442
  to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
4425
4443
  },
4426
4444
  },
4445
+ { hasStock: { columnName: 'has_stock' } },
4427
4446
  'weight',
4428
4447
  { name: { to: () => '', from: () => undefined } },
4429
4448
  { hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },