@infrab4a/connect 5.3.0-beta.10 → 5.3.0-beta.12

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
@@ -830,6 +830,10 @@ class ProductReview extends BaseModel {
830
830
  return ['id'];
831
831
  }
832
832
  }
833
+ tslib.__decorate([
834
+ classTransformer.Type(() => Product),
835
+ tslib.__metadata("design:type", Product)
836
+ ], ProductReview.prototype, "product", void 0);
833
837
 
834
838
  class ProductBase extends BaseModel {
835
839
  get evaluation() {
@@ -7892,22 +7896,6 @@ const fieldsConfiguration$2 = [
7892
7896
  subscriberPrice: data.subscriber_price,
7893
7897
  fullPriceDiscountPercentage: data.full_price_discount_percentage,
7894
7898
  }),
7895
- bindFindFilter: (sentence) => {
7896
- const filters = Object.values(sentence).shift();
7897
- return {
7898
- ...((filters?.price || filters?.price === 0) && { price: filters.price }),
7899
- ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
7900
- ...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
7901
- subscriber_discount_percentage: filters.subscriberDiscountPercentage,
7902
- }),
7903
- ...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
7904
- subscriber_price: filters.subscriberPrice,
7905
- }),
7906
- ...((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
7907
- full_price_discount_percentage: filters.fullPriceDiscountPercentage,
7908
- }),
7909
- };
7910
- },
7911
7899
  bindPersistData: (priceData) => ({
7912
7900
  ...((priceData?.price || 0) >= 0 && { price: priceData.price }),
7913
7901
  ...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
@@ -8484,7 +8472,25 @@ class ProductReviewHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHas
8484
8472
  product: {
8485
8473
  columnName: 'product',
8486
8474
  foreignKeyColumn: { id: 'productId' },
8487
- fields: ['id', 'ean', 'sku', 'name', 'brand', 'slug', 'images', 'grade', 'gender'],
8475
+ fields: [
8476
+ 'id',
8477
+ {
8478
+ productId: {
8479
+ columnName: 'main_product_id',
8480
+ to: (value) => +value,
8481
+ from: (value) => value?.toString(),
8482
+ },
8483
+ },
8484
+ 'ean',
8485
+ 'sku',
8486
+ 'name',
8487
+ 'brand',
8488
+ 'slug',
8489
+ 'images',
8490
+ 'grade',
8491
+ 'gender',
8492
+ '',
8493
+ ],
8488
8494
  },
8489
8495
  },
8490
8496
  ],
@@ -8677,6 +8683,7 @@ const fieldsConfiguration$1 = [
8677
8683
  },
8678
8684
  },
8679
8685
  'group',
8686
+ 'type',
8680
8687
  'validity',
8681
8688
  'published',
8682
8689
  { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
@@ -8773,6 +8780,17 @@ const fieldsConfiguration$1 = [
8773
8780
  fields: ['id', 'name', 'reference', 'slug'],
8774
8781
  },
8775
8782
  },
8783
+ {
8784
+ categories: {
8785
+ columnName: 'categories',
8786
+ fields: ['category_id'],
8787
+ bindPersistData: (value) => ({
8788
+ categories: { data: value.map((category) => ({ category_id: +category })) },
8789
+ }),
8790
+ to: (categories) => categories.map((categoryId) => +categoryId),
8791
+ from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
8792
+ },
8793
+ },
8776
8794
  {
8777
8795
  metadata: {
8778
8796
  columnName: 'metadata',
package/index.esm.js CHANGED
@@ -806,6 +806,10 @@ class ProductReview extends BaseModel {
806
806
  return ['id'];
807
807
  }
808
808
  }
809
+ __decorate([
810
+ Type(() => Product),
811
+ __metadata("design:type", Product)
812
+ ], ProductReview.prototype, "product", void 0);
809
813
 
810
814
  class ProductBase extends BaseModel {
811
815
  get evaluation() {
@@ -7868,22 +7872,6 @@ const fieldsConfiguration$2 = [
7868
7872
  subscriberPrice: data.subscriber_price,
7869
7873
  fullPriceDiscountPercentage: data.full_price_discount_percentage,
7870
7874
  }),
7871
- bindFindFilter: (sentence) => {
7872
- const filters = Object.values(sentence).shift();
7873
- return {
7874
- ...((filters?.price || filters?.price === 0) && { price: filters.price }),
7875
- ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
7876
- ...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
7877
- subscriber_discount_percentage: filters.subscriberDiscountPercentage,
7878
- }),
7879
- ...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
7880
- subscriber_price: filters.subscriberPrice,
7881
- }),
7882
- ...((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
7883
- full_price_discount_percentage: filters.fullPriceDiscountPercentage,
7884
- }),
7885
- };
7886
- },
7887
7875
  bindPersistData: (priceData) => ({
7888
7876
  ...((priceData?.price || 0) >= 0 && { price: priceData.price }),
7889
7877
  ...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
@@ -8460,7 +8448,25 @@ class ProductReviewHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHas
8460
8448
  product: {
8461
8449
  columnName: 'product',
8462
8450
  foreignKeyColumn: { id: 'productId' },
8463
- fields: ['id', 'ean', 'sku', 'name', 'brand', 'slug', 'images', 'grade', 'gender'],
8451
+ fields: [
8452
+ 'id',
8453
+ {
8454
+ productId: {
8455
+ columnName: 'main_product_id',
8456
+ to: (value) => +value,
8457
+ from: (value) => value?.toString(),
8458
+ },
8459
+ },
8460
+ 'ean',
8461
+ 'sku',
8462
+ 'name',
8463
+ 'brand',
8464
+ 'slug',
8465
+ 'images',
8466
+ 'grade',
8467
+ 'gender',
8468
+ '',
8469
+ ],
8464
8470
  },
8465
8471
  },
8466
8472
  ],
@@ -8653,6 +8659,7 @@ const fieldsConfiguration$1 = [
8653
8659
  },
8654
8660
  },
8655
8661
  'group',
8662
+ 'type',
8656
8663
  'validity',
8657
8664
  'published',
8658
8665
  { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
@@ -8749,6 +8756,17 @@ const fieldsConfiguration$1 = [
8749
8756
  fields: ['id', 'name', 'reference', 'slug'],
8750
8757
  },
8751
8758
  },
8759
+ {
8760
+ categories: {
8761
+ columnName: 'categories',
8762
+ fields: ['category_id'],
8763
+ bindPersistData: (value) => ({
8764
+ categories: { data: value.map((category) => ({ category_id: +category })) },
8765
+ }),
8766
+ to: (categories) => categories.map((categoryId) => +categoryId),
8767
+ from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
8768
+ },
8769
+ },
8752
8770
  {
8753
8771
  metadata: {
8754
8772
  columnName: 'metadata',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.3.0-beta.10",
3
+ "version": "5.3.0-beta.12",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -1,5 +1,6 @@
1
1
  import { BaseModel, GenericIdentifier } from '../../generic/model';
2
2
  import { Shops } from './enums';
3
+ import { Product } from './product';
3
4
  export declare class ProductReview extends BaseModel<ProductReview> {
4
5
  id: number;
5
6
  productId: string;
@@ -16,5 +17,6 @@ export declare class ProductReview extends BaseModel<ProductReview> {
16
17
  orderId?: string;
17
18
  createdAt?: Date;
18
19
  updatedAt?: Date;
20
+ product?: Product;
19
21
  static get identifiersFields(): GenericIdentifier[];
20
22
  }
@@ -15,4 +15,10 @@ export declare class Order extends Checkout {
15
15
  reshipmentOrderId?: string;
16
16
  isChange?: boolean;
17
17
  isReshipment?: boolean;
18
+ metadata?: {
19
+ ip?: string;
20
+ userAgent?: string;
21
+ plataform?: string;
22
+ origin?: string;
23
+ };
18
24
  }