@infrab4a/connect 1.0.0-beta.12 → 1.0.0-beta.13
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/bundles/infrab4a-connect.umd.js +61 -3
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/generic/repository/types/repository-update-params.type.d.ts +4 -4
- package/esm2015/domain/generic/repository/types/repository-update-params.type.js +1 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +33 -2
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
- package/fesm2015/infrab4a-connect.js +32 -1
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +3 -1
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3548,10 +3548,10 @@
|
|
|
3548
3548
|
return VariantHasuraGraphQL;
|
|
3549
3549
|
}(Variant));
|
|
3550
3550
|
|
|
3551
|
-
var ProductHasuraGraphQLRepository = /** @class */ (function (
|
|
3552
|
-
__extends(ProductHasuraGraphQLRepository,
|
|
3551
|
+
var ProductHasuraGraphQLRepository = /** @class */ (function (_super_1) {
|
|
3552
|
+
__extends(ProductHasuraGraphQLRepository, _super_1);
|
|
3553
3553
|
function ProductHasuraGraphQLRepository(endpoint, authOptions) {
|
|
3554
|
-
return
|
|
3554
|
+
return _super_1.call(this, {
|
|
3555
3555
|
tableName: 'product',
|
|
3556
3556
|
model: ProductHasuraGraphQL,
|
|
3557
3557
|
endpoint: endpoint,
|
|
@@ -3665,6 +3665,64 @@
|
|
|
3665
3665
|
});
|
|
3666
3666
|
});
|
|
3667
3667
|
};
|
|
3668
|
+
ProductHasuraGraphQLRepository.prototype.update = function (params) {
|
|
3669
|
+
var _super = Object.create(null, {
|
|
3670
|
+
update: { get: function () { return _super_1.prototype.update; } }
|
|
3671
|
+
});
|
|
3672
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3673
|
+
var categories, id, data, product, _b, _c;
|
|
3674
|
+
return __generator(this, function (_d) {
|
|
3675
|
+
switch (_d.label) {
|
|
3676
|
+
case 0:
|
|
3677
|
+
categories = params.categories, id = params.id, data = __rest(params, ["categories", "id"]);
|
|
3678
|
+
return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
|
|
3679
|
+
case 1:
|
|
3680
|
+
product = _d.sent();
|
|
3681
|
+
_b = product;
|
|
3682
|
+
_c = categories;
|
|
3683
|
+
if (!_c) return [3 /*break*/, 3];
|
|
3684
|
+
return [4 /*yield*/, this.updateCategories(+id, { categories: categories })];
|
|
3685
|
+
case 2:
|
|
3686
|
+
_c = (_d.sent());
|
|
3687
|
+
_d.label = 3;
|
|
3688
|
+
case 3:
|
|
3689
|
+
_b.categories = _c;
|
|
3690
|
+
return [2 /*return*/, product];
|
|
3691
|
+
}
|
|
3692
|
+
});
|
|
3693
|
+
});
|
|
3694
|
+
};
|
|
3695
|
+
ProductHasuraGraphQLRepository.prototype.updateCategories = function (productId, _b) {
|
|
3696
|
+
var categories = _b.categories;
|
|
3697
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3698
|
+
var plainData;
|
|
3699
|
+
return __generator(this, function (_b) {
|
|
3700
|
+
switch (_b.label) {
|
|
3701
|
+
case 0:
|
|
3702
|
+
plainData = this.paramsToPlain({ categories: categories });
|
|
3703
|
+
return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
|
|
3704
|
+
where: {
|
|
3705
|
+
type: 'category_product_bool_exp',
|
|
3706
|
+
required: true,
|
|
3707
|
+
value: { product_id: { _eq: productId } },
|
|
3708
|
+
},
|
|
3709
|
+
})];
|
|
3710
|
+
case 1:
|
|
3711
|
+
_b.sent();
|
|
3712
|
+
return [4 /*yield*/, this.mutation('insert_category_product', ['affected_rows'], {
|
|
3713
|
+
objects: {
|
|
3714
|
+
type: '[category_product_insert_input!]',
|
|
3715
|
+
required: true,
|
|
3716
|
+
value: plainData.categories.map(function (categoryId) { return ({ category_id: categoryId, product_id: productId }); }),
|
|
3717
|
+
},
|
|
3718
|
+
})];
|
|
3719
|
+
case 2:
|
|
3720
|
+
_b.sent();
|
|
3721
|
+
return [2 /*return*/, plainData.categories];
|
|
3722
|
+
}
|
|
3723
|
+
});
|
|
3724
|
+
});
|
|
3725
|
+
};
|
|
3668
3726
|
return ProductHasuraGraphQLRepository;
|
|
3669
3727
|
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
3670
3728
|
|