@infrab4a/connect 4.21.0-beta.0 → 4.21.0
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 +12 -105
- package/index.esm.js +12 -105
- package/package.json +1 -1
- package/src/domain/catalog/repositories/wishlist.repository.d.ts +2 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +0 -1
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +5 -4
package/index.cjs.js
CHANGED
|
@@ -5112,29 +5112,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5112
5112
|
});
|
|
5113
5113
|
return [];
|
|
5114
5114
|
}
|
|
5115
|
-
const plainData = this.paramsToPlain({ products });
|
|
5116
|
-
if (!plainData.products || plainData.products.length <= 0)
|
|
5117
|
-
return [];
|
|
5118
|
-
const category = await this.get({ id: categoryId.toString() });
|
|
5119
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5120
|
-
where: {
|
|
5121
|
-
type: 'category_product_bool_exp',
|
|
5122
|
-
required: true,
|
|
5123
|
-
value: {
|
|
5124
|
-
category_id: { _eq: categoryId },
|
|
5125
|
-
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
5126
|
-
},
|
|
5127
|
-
},
|
|
5128
|
-
});
|
|
5129
|
-
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5130
|
-
objects: {
|
|
5131
|
-
type: '[category_product_insert_input!]',
|
|
5132
|
-
required: true,
|
|
5133
|
-
value: plainData.products
|
|
5134
|
-
.filter((productId) => !category.products.includes(productId))
|
|
5135
|
-
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5136
|
-
},
|
|
5137
|
-
});
|
|
5138
5115
|
const productsOrder = products.map((product, index) => {
|
|
5139
5116
|
return {
|
|
5140
5117
|
id: product,
|
|
@@ -5143,7 +5120,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5143
5120
|
});
|
|
5144
5121
|
const updateQueries = productsOrder.map((product) => ({
|
|
5145
5122
|
where: {
|
|
5146
|
-
category_id: { _eq:
|
|
5123
|
+
category_id: { _eq: categoryId },
|
|
5147
5124
|
product_id: { _eq: product.id },
|
|
5148
5125
|
},
|
|
5149
5126
|
_set: {
|
|
@@ -5157,6 +5134,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5157
5134
|
required: true,
|
|
5158
5135
|
},
|
|
5159
5136
|
});
|
|
5137
|
+
const plainData = this.paramsToPlain({ products });
|
|
5160
5138
|
return plainData.products;
|
|
5161
5139
|
}
|
|
5162
5140
|
async updateMetadata(categoryId, { metadatas }) {
|
|
@@ -5296,12 +5274,11 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
|
|
|
5296
5274
|
});
|
|
5297
5275
|
}
|
|
5298
5276
|
async addProductToCategory(categoryId, productId) {
|
|
5299
|
-
await this.removeProductFromCategory(categoryId, productId);
|
|
5300
5277
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5301
5278
|
objects: {
|
|
5302
|
-
type: 'category_product_insert_input!',
|
|
5279
|
+
type: '[category_product_insert_input!]',
|
|
5303
5280
|
required: true,
|
|
5304
|
-
value: { category_id: categoryId, product_id: productId },
|
|
5281
|
+
value: [{ category_id: categoryId, product_id: productId }],
|
|
5305
5282
|
},
|
|
5306
5283
|
});
|
|
5307
5284
|
}
|
|
@@ -5719,7 +5696,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5719
5696
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
5720
5697
|
const id = await this.getId(plainData.id);
|
|
5721
5698
|
const product = await super.update(Object.assign({ id }, data));
|
|
5722
|
-
// product.categories = categories && (await this.updateCategories(+id, { categories }))
|
|
5723
5699
|
product.kitProducts = kitProducts && (await this.updateKitProducts(+id, { kitProducts }));
|
|
5724
5700
|
product.reviews = reviews && (await this.updateReviews(+id, { reviews }));
|
|
5725
5701
|
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
@@ -5783,42 +5759,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5783
5759
|
getReviewStatus(review) {
|
|
5784
5760
|
return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
|
|
5785
5761
|
}
|
|
5786
|
-
async updateCategories(productId, { categories }) {
|
|
5787
|
-
if ('action' in categories && categories.action === 'remove') {
|
|
5788
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5789
|
-
where: {
|
|
5790
|
-
type: 'category_product_bool_exp',
|
|
5791
|
-
required: true,
|
|
5792
|
-
value: { product_id: { _eq: productId } },
|
|
5793
|
-
},
|
|
5794
|
-
});
|
|
5795
|
-
return [];
|
|
5796
|
-
}
|
|
5797
|
-
const plainData = this.paramsToPlain({ categories });
|
|
5798
|
-
if (!plainData.categories || plainData.categories.length <= 0)
|
|
5799
|
-
return [];
|
|
5800
|
-
const product = await this.get({ id: productId.toString() });
|
|
5801
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5802
|
-
where: {
|
|
5803
|
-
type: 'category_product_bool_exp',
|
|
5804
|
-
required: true,
|
|
5805
|
-
value: {
|
|
5806
|
-
product_id: { _eq: productId },
|
|
5807
|
-
category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
|
|
5808
|
-
},
|
|
5809
|
-
},
|
|
5810
|
-
});
|
|
5811
|
-
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5812
|
-
objects: {
|
|
5813
|
-
type: '[category_product_insert_input!]',
|
|
5814
|
-
required: true,
|
|
5815
|
-
value: plainData.categories
|
|
5816
|
-
.filter((categoryId) => !product.categories.includes(categoryId))
|
|
5817
|
-
.map((categoryId) => ({ category_id: categoryId, product_id: productId })),
|
|
5818
|
-
},
|
|
5819
|
-
});
|
|
5820
|
-
return plainData.categories;
|
|
5821
|
-
}
|
|
5822
5762
|
async updateKitProducts(productId, { kitProducts }) {
|
|
5823
5763
|
const plainData = this.paramsToPlain({ kitProducts });
|
|
5824
5764
|
await this.mutation('delete_product_kit', ['affected_rows'], {
|
|
@@ -6220,7 +6160,7 @@ class WishlistHasuraGraphQL extends Wishlist {
|
|
|
6220
6160
|
}
|
|
6221
6161
|
|
|
6222
6162
|
class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6223
|
-
constructor({ endpoint, authOptions, interceptors, },
|
|
6163
|
+
constructor({ endpoint, authOptions, interceptors, }, categoryProductRepository) {
|
|
6224
6164
|
super({
|
|
6225
6165
|
tableName: 'category',
|
|
6226
6166
|
model: WishlistHasuraGraphQL,
|
|
@@ -6321,7 +6261,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6321
6261
|
{ mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
|
|
6322
6262
|
],
|
|
6323
6263
|
});
|
|
6324
|
-
this.
|
|
6264
|
+
this.categoryProductRepository = categoryProductRepository;
|
|
6325
6265
|
}
|
|
6326
6266
|
async create(params) {
|
|
6327
6267
|
var _a;
|
|
@@ -6357,7 +6297,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6357
6297
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6358
6298
|
const id = plainData.id;
|
|
6359
6299
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
6360
|
-
category.products = products && (await this.updateProducts(+id, { products }));
|
|
6361
6300
|
category.metadatas = metadatas && (await this.updateMetadata(+id, { metadatas }));
|
|
6362
6301
|
return category;
|
|
6363
6302
|
}
|
|
@@ -6438,44 +6377,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6438
6377
|
isChild(id, parentId) {
|
|
6439
6378
|
return;
|
|
6440
6379
|
}
|
|
6441
|
-
async updateProducts(categoryId, { products }) {
|
|
6442
|
-
if ('action' in products && products.action === 'remove') {
|
|
6443
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
6444
|
-
where: {
|
|
6445
|
-
type: 'category_product_bool_exp',
|
|
6446
|
-
required: true,
|
|
6447
|
-
value: { category_id: { _eq: categoryId } },
|
|
6448
|
-
},
|
|
6449
|
-
});
|
|
6450
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
6451
|
-
return [];
|
|
6452
|
-
}
|
|
6453
|
-
const plainData = this.paramsToPlain({ products });
|
|
6454
|
-
if (!plainData.products || plainData.products.length <= 0)
|
|
6455
|
-
return [];
|
|
6456
|
-
const category = await this.get({ id: categoryId.toString() });
|
|
6457
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
6458
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
6459
|
-
where: {
|
|
6460
|
-
type: 'category_product_bool_exp',
|
|
6461
|
-
required: true,
|
|
6462
|
-
value: {
|
|
6463
|
-
category_id: { _eq: categoryId },
|
|
6464
|
-
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
6465
|
-
},
|
|
6466
|
-
},
|
|
6467
|
-
});
|
|
6468
|
-
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
6469
|
-
objects: {
|
|
6470
|
-
type: '[category_product_insert_input!]',
|
|
6471
|
-
required: true,
|
|
6472
|
-
value: plainData.products
|
|
6473
|
-
.filter((productId) => !category.products.includes(productId))
|
|
6474
|
-
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
6475
|
-
},
|
|
6476
|
-
});
|
|
6477
|
-
return plainData.products;
|
|
6478
|
-
}
|
|
6479
6380
|
async updateMetadata(categoryId, { metadatas }) {
|
|
6480
6381
|
if (Array.isArray(metadatas) && !metadatas.length)
|
|
6481
6382
|
return [];
|
|
@@ -6511,6 +6412,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6511
6412
|
return [];
|
|
6512
6413
|
}
|
|
6513
6414
|
}
|
|
6415
|
+
async addProduct(wishlistId, productId) {
|
|
6416
|
+
return this.categoryProductRepository.addProductToCategory(wishlistId, productId);
|
|
6417
|
+
}
|
|
6418
|
+
async removeProduct(wishlistId, productId) {
|
|
6419
|
+
return this.categoryProductRepository.removeProductFromCategory(wishlistId, productId);
|
|
6420
|
+
}
|
|
6514
6421
|
}
|
|
6515
6422
|
tslib.__decorate([
|
|
6516
6423
|
Log(),
|
package/index.esm.js
CHANGED
|
@@ -5106,29 +5106,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5106
5106
|
});
|
|
5107
5107
|
return [];
|
|
5108
5108
|
}
|
|
5109
|
-
const plainData = this.paramsToPlain({ products });
|
|
5110
|
-
if (!plainData.products || plainData.products.length <= 0)
|
|
5111
|
-
return [];
|
|
5112
|
-
const category = await this.get({ id: categoryId.toString() });
|
|
5113
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5114
|
-
where: {
|
|
5115
|
-
type: 'category_product_bool_exp',
|
|
5116
|
-
required: true,
|
|
5117
|
-
value: {
|
|
5118
|
-
category_id: { _eq: categoryId },
|
|
5119
|
-
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
5120
|
-
},
|
|
5121
|
-
},
|
|
5122
|
-
});
|
|
5123
|
-
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5124
|
-
objects: {
|
|
5125
|
-
type: '[category_product_insert_input!]',
|
|
5126
|
-
required: true,
|
|
5127
|
-
value: plainData.products
|
|
5128
|
-
.filter((productId) => !category.products.includes(productId))
|
|
5129
|
-
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5130
|
-
},
|
|
5131
|
-
});
|
|
5132
5109
|
const productsOrder = products.map((product, index) => {
|
|
5133
5110
|
return {
|
|
5134
5111
|
id: product,
|
|
@@ -5137,7 +5114,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5137
5114
|
});
|
|
5138
5115
|
const updateQueries = productsOrder.map((product) => ({
|
|
5139
5116
|
where: {
|
|
5140
|
-
category_id: { _eq:
|
|
5117
|
+
category_id: { _eq: categoryId },
|
|
5141
5118
|
product_id: { _eq: product.id },
|
|
5142
5119
|
},
|
|
5143
5120
|
_set: {
|
|
@@ -5151,6 +5128,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5151
5128
|
required: true,
|
|
5152
5129
|
},
|
|
5153
5130
|
});
|
|
5131
|
+
const plainData = this.paramsToPlain({ products });
|
|
5154
5132
|
return plainData.products;
|
|
5155
5133
|
}
|
|
5156
5134
|
async updateMetadata(categoryId, { metadatas }) {
|
|
@@ -5290,12 +5268,11 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
|
|
|
5290
5268
|
});
|
|
5291
5269
|
}
|
|
5292
5270
|
async addProductToCategory(categoryId, productId) {
|
|
5293
|
-
await this.removeProductFromCategory(categoryId, productId);
|
|
5294
5271
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5295
5272
|
objects: {
|
|
5296
|
-
type: 'category_product_insert_input!',
|
|
5273
|
+
type: '[category_product_insert_input!]',
|
|
5297
5274
|
required: true,
|
|
5298
|
-
value: { category_id: categoryId, product_id: productId },
|
|
5275
|
+
value: [{ category_id: categoryId, product_id: productId }],
|
|
5299
5276
|
},
|
|
5300
5277
|
});
|
|
5301
5278
|
}
|
|
@@ -5713,7 +5690,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5713
5690
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
5714
5691
|
const id = await this.getId(plainData.id);
|
|
5715
5692
|
const product = await super.update(Object.assign({ id }, data));
|
|
5716
|
-
// product.categories = categories && (await this.updateCategories(+id, { categories }))
|
|
5717
5693
|
product.kitProducts = kitProducts && (await this.updateKitProducts(+id, { kitProducts }));
|
|
5718
5694
|
product.reviews = reviews && (await this.updateReviews(+id, { reviews }));
|
|
5719
5695
|
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
@@ -5777,42 +5753,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5777
5753
|
getReviewStatus(review) {
|
|
5778
5754
|
return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
|
|
5779
5755
|
}
|
|
5780
|
-
async updateCategories(productId, { categories }) {
|
|
5781
|
-
if ('action' in categories && categories.action === 'remove') {
|
|
5782
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5783
|
-
where: {
|
|
5784
|
-
type: 'category_product_bool_exp',
|
|
5785
|
-
required: true,
|
|
5786
|
-
value: { product_id: { _eq: productId } },
|
|
5787
|
-
},
|
|
5788
|
-
});
|
|
5789
|
-
return [];
|
|
5790
|
-
}
|
|
5791
|
-
const plainData = this.paramsToPlain({ categories });
|
|
5792
|
-
if (!plainData.categories || plainData.categories.length <= 0)
|
|
5793
|
-
return [];
|
|
5794
|
-
const product = await this.get({ id: productId.toString() });
|
|
5795
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5796
|
-
where: {
|
|
5797
|
-
type: 'category_product_bool_exp',
|
|
5798
|
-
required: true,
|
|
5799
|
-
value: {
|
|
5800
|
-
product_id: { _eq: productId },
|
|
5801
|
-
category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
|
|
5802
|
-
},
|
|
5803
|
-
},
|
|
5804
|
-
});
|
|
5805
|
-
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5806
|
-
objects: {
|
|
5807
|
-
type: '[category_product_insert_input!]',
|
|
5808
|
-
required: true,
|
|
5809
|
-
value: plainData.categories
|
|
5810
|
-
.filter((categoryId) => !product.categories.includes(categoryId))
|
|
5811
|
-
.map((categoryId) => ({ category_id: categoryId, product_id: productId })),
|
|
5812
|
-
},
|
|
5813
|
-
});
|
|
5814
|
-
return plainData.categories;
|
|
5815
|
-
}
|
|
5816
5756
|
async updateKitProducts(productId, { kitProducts }) {
|
|
5817
5757
|
const plainData = this.paramsToPlain({ kitProducts });
|
|
5818
5758
|
await this.mutation('delete_product_kit', ['affected_rows'], {
|
|
@@ -6214,7 +6154,7 @@ class WishlistHasuraGraphQL extends Wishlist {
|
|
|
6214
6154
|
}
|
|
6215
6155
|
|
|
6216
6156
|
class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
6217
|
-
constructor({ endpoint, authOptions, interceptors, },
|
|
6157
|
+
constructor({ endpoint, authOptions, interceptors, }, categoryProductRepository) {
|
|
6218
6158
|
super({
|
|
6219
6159
|
tableName: 'category',
|
|
6220
6160
|
model: WishlistHasuraGraphQL,
|
|
@@ -6315,7 +6255,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6315
6255
|
{ mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
|
|
6316
6256
|
],
|
|
6317
6257
|
});
|
|
6318
|
-
this.
|
|
6258
|
+
this.categoryProductRepository = categoryProductRepository;
|
|
6319
6259
|
}
|
|
6320
6260
|
async create(params) {
|
|
6321
6261
|
var _a;
|
|
@@ -6351,7 +6291,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6351
6291
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6352
6292
|
const id = plainData.id;
|
|
6353
6293
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
6354
|
-
category.products = products && (await this.updateProducts(+id, { products }));
|
|
6355
6294
|
category.metadatas = metadatas && (await this.updateMetadata(+id, { metadatas }));
|
|
6356
6295
|
return category;
|
|
6357
6296
|
}
|
|
@@ -6432,44 +6371,6 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6432
6371
|
isChild(id, parentId) {
|
|
6433
6372
|
return;
|
|
6434
6373
|
}
|
|
6435
|
-
async updateProducts(categoryId, { products }) {
|
|
6436
|
-
if ('action' in products && products.action === 'remove') {
|
|
6437
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
6438
|
-
where: {
|
|
6439
|
-
type: 'category_product_bool_exp',
|
|
6440
|
-
required: true,
|
|
6441
|
-
value: { category_id: { _eq: categoryId } },
|
|
6442
|
-
},
|
|
6443
|
-
});
|
|
6444
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
6445
|
-
return [];
|
|
6446
|
-
}
|
|
6447
|
-
const plainData = this.paramsToPlain({ products });
|
|
6448
|
-
if (!plainData.products || plainData.products.length <= 0)
|
|
6449
|
-
return [];
|
|
6450
|
-
const category = await this.get({ id: categoryId.toString() });
|
|
6451
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
6452
|
-
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
6453
|
-
where: {
|
|
6454
|
-
type: 'category_product_bool_exp',
|
|
6455
|
-
required: true,
|
|
6456
|
-
value: {
|
|
6457
|
-
category_id: { _eq: categoryId },
|
|
6458
|
-
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
6459
|
-
},
|
|
6460
|
-
},
|
|
6461
|
-
});
|
|
6462
|
-
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
6463
|
-
objects: {
|
|
6464
|
-
type: '[category_product_insert_input!]',
|
|
6465
|
-
required: true,
|
|
6466
|
-
value: plainData.products
|
|
6467
|
-
.filter((productId) => !category.products.includes(productId))
|
|
6468
|
-
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
6469
|
-
},
|
|
6470
|
-
});
|
|
6471
|
-
return plainData.products;
|
|
6472
|
-
}
|
|
6473
6374
|
async updateMetadata(categoryId, { metadatas }) {
|
|
6474
6375
|
if (Array.isArray(metadatas) && !metadatas.length)
|
|
6475
6376
|
return [];
|
|
@@ -6505,6 +6406,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6505
6406
|
return [];
|
|
6506
6407
|
}
|
|
6507
6408
|
}
|
|
6409
|
+
async addProduct(wishlistId, productId) {
|
|
6410
|
+
return this.categoryProductRepository.addProductToCategory(wishlistId, productId);
|
|
6411
|
+
}
|
|
6412
|
+
async removeProduct(wishlistId, productId) {
|
|
6413
|
+
return this.categoryProductRepository.removeProductFromCategory(wishlistId, productId);
|
|
6414
|
+
}
|
|
6508
6415
|
}
|
|
6509
6416
|
__decorate([
|
|
6510
6417
|
Log(),
|
package/package.json
CHANGED
|
@@ -6,4 +6,6 @@ export interface WishlistRepository extends CategoryRepository<Wishlist> {
|
|
|
6
6
|
getWishlistBySlug(slug: string): Promise<Wishlist>;
|
|
7
7
|
getWishlistByPerson(personId: string): Promise<Wishlist[]>;
|
|
8
8
|
findBfluOrGlamgirlWishlists(params: FindRepositoryParams<Wishlist>, shops: Shops[]): Promise<RepositoryFindResult<Wishlist>>;
|
|
9
|
+
addProduct(wishlistId: string, productId: string): Promise<void>;
|
|
10
|
+
removeProduct(wishlistId: string, productId: string): Promise<void>;
|
|
9
11
|
}
|
package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export declare class ProductHasuraGraphQLRepository extends ProductHasuraGraphQL
|
|
|
17
17
|
findCatalog(params: FindRepositoryParams<ProductHasuraGraphQL>, mainGender?: Extract<ProductGender, 'female' | 'male'>): Promise<RepositoryFindResult<ProductHasuraGraphQL>>;
|
|
18
18
|
cleanShoppingCountFromIds(ids: string[]): Promise<void>;
|
|
19
19
|
private getReviewStatus;
|
|
20
|
-
private updateCategories;
|
|
21
20
|
private updateKitProducts;
|
|
22
21
|
private updateReviews;
|
|
23
22
|
private updateMetadata;
|
package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Category, CreateRepositoryParams, FindRepositoryParams, GetRepositoryParams, Product, RepositoryFindResult, Shops, UpdateRepositoryParams, Wishlist, WishlistRepository } from '../../../../domain';
|
|
2
2
|
import { HasuraConstructorParams } from '../../mixins';
|
|
3
3
|
import { WishlistHasuraGraphQL } from '../../models/wishlist-hasura-graphql';
|
|
4
|
-
import {
|
|
4
|
+
import { CategoryProductHasuraGraphQLRepository } from './category-product-hasura-graphql.repository';
|
|
5
5
|
declare const WishlistHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<WishlistHasuraGraphQL> & import("../../../../domain").CrudRepository<WishlistHasuraGraphQL, import("../../../../domain").CrudParams<WishlistHasuraGraphQL>> & import("../../../../domain").UpdateRepository<WishlistHasuraGraphQL, import("../../../../domain").RepositoryUpdateParams<WishlistHasuraGraphQL>> & {
|
|
6
6
|
paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<WishlistHasuraGraphQL>): Partial<WishlistHasuraGraphQL>;
|
|
7
7
|
}, [HasuraConstructorParams<WishlistHasuraGraphQL> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
|
|
8
8
|
export declare class WishlistHasuraGraphQLRepository extends WishlistHasuraGraphQLRepository_base implements WishlistRepository {
|
|
9
|
-
private readonly
|
|
10
|
-
constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Wishlist>, 'endpoint' | 'authOptions' | 'interceptors'>,
|
|
9
|
+
private readonly categoryProductRepository;
|
|
10
|
+
constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Wishlist>, 'endpoint' | 'authOptions' | 'interceptors'>, categoryProductRepository: CategoryProductHasuraGraphQLRepository);
|
|
11
11
|
create(params: CreateRepositoryParams<WishlistHasuraGraphQL>): Promise<WishlistHasuraGraphQL>;
|
|
12
12
|
get(identifiers: GetRepositoryParams<WishlistHasuraGraphQL>): Promise<WishlistHasuraGraphQL>;
|
|
13
13
|
find(params?: FindRepositoryParams<WishlistHasuraGraphQL>): Promise<RepositoryFindResult<WishlistHasuraGraphQL>>;
|
|
@@ -24,7 +24,8 @@ export declare class WishlistHasuraGraphQLRepository extends WishlistHasuraGraph
|
|
|
24
24
|
}): Promise<Product[]>;
|
|
25
25
|
getChildren(parentId: number): Promise<Category[]>;
|
|
26
26
|
isChild(id: number, parentId: number): Promise<boolean>;
|
|
27
|
-
private updateProducts;
|
|
28
27
|
private updateMetadata;
|
|
28
|
+
addProduct(wishlistId: string, productId: string): Promise<void>;
|
|
29
|
+
removeProduct(wishlistId: string, productId: string): Promise<void>;
|
|
29
30
|
}
|
|
30
31
|
export {};
|