@infrab4a/connect 3.15.0-beta.1 → 3.15.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/bundles/infrab4a-connect.umd.js +706 -227
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/category-base.d.ts +30 -0
- package/domain/catalog/models/category-filter.d.ts +2 -0
- package/domain/catalog/models/category-for-product.d.ts +5 -0
- package/domain/catalog/models/category.d.ts +5 -27
- package/domain/catalog/models/index.d.ts +1 -0
- package/domain/catalog/models/kit-product.d.ts +3 -3
- package/domain/catalog/models/product-base.d.ts +40 -0
- package/domain/catalog/models/product-for-category.d.ts +7 -0
- package/domain/catalog/models/product-for-kit.d.ts +7 -0
- package/domain/catalog/models/product.d.ts +5 -40
- package/domain/catalog/models/wishlist.d.ts +6 -0
- package/domain/catalog/repositories/category-filter.repository.d.ts +1 -0
- package/domain/catalog/repositories/index.d.ts +1 -0
- package/domain/catalog/repositories/product.repository.d.ts +1 -1
- package/domain/catalog/repositories/wishlist.repository.d.ts +6 -0
- package/domain/generic/repository/find.repository.d.ts +1 -0
- package/domain/generic/repository/types/repository-find-result.type.d.ts +3 -0
- package/domain/shop-settings/enums/index.d.ts +0 -1
- package/domain/shop-settings/models/index.d.ts +0 -2
- package/domain/shop-settings/models/shop-settings.d.ts +1 -2
- package/domain/shop-settings/models/types/index.d.ts +0 -4
- package/domain/shop-settings/models/types/shop-section.type.d.ts +0 -3
- package/domain/shop-settings/repositories/index.d.ts +0 -2
- package/esm2015/domain/catalog/models/category-base.js +18 -0
- package/esm2015/domain/catalog/models/category-filter.js +6 -1
- package/esm2015/domain/catalog/models/category-for-product.js +7 -0
- package/esm2015/domain/catalog/models/category.js +6 -10
- package/esm2015/domain/catalog/models/index.js +2 -1
- package/esm2015/domain/catalog/models/kit-product.js +6 -6
- package/esm2015/domain/catalog/models/product-base.js +25 -0
- package/esm2015/domain/catalog/models/product-for-category.js +14 -0
- package/esm2015/domain/catalog/models/product-for-kit.js +14 -0
- package/esm2015/domain/catalog/models/product.js +6 -24
- package/esm2015/domain/catalog/models/wishlist.js +7 -0
- package/esm2015/domain/catalog/repositories/category-filter.repository.js +1 -1
- package/esm2015/domain/catalog/repositories/index.js +2 -1
- package/esm2015/domain/catalog/repositories/product.repository.js +1 -1
- package/esm2015/domain/catalog/repositories/wishlist.repository.js +2 -0
- package/esm2015/domain/generic/repository/find.repository.js +1 -1
- package/esm2015/domain/generic/repository/types/repository-find-result.type.js +1 -1
- package/esm2015/domain/shop-settings/enums/index.js +1 -2
- package/esm2015/domain/shop-settings/models/index.js +1 -3
- package/esm2015/domain/shop-settings/models/shop-settings.js +1 -1
- package/esm2015/domain/shop-settings/models/types/index.js +1 -5
- package/esm2015/domain/shop-settings/models/types/shop-section.type.js +1 -1
- package/esm2015/domain/shop-settings/repositories/index.js +1 -3
- package/esm2015/infra/elasticsearch/indexes/products-index.js +2 -2
- package/esm2015/infra/firebase/firestore/repositories/shop-settings/index.js +1 -3
- package/esm2015/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.js +2 -2
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +44 -14
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.js +52 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +36 -50
- package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +2 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +2 -2
- package/esm2015/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.js +252 -0
- package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +1 -1
- package/fesm2015/infrab4a-connect.js +469 -155
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +0 -2
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +3 -2
- package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +1 -0
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
- package/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +27 -0
- package/infra/hasura-graphql/types/graphql.repository.type.d.ts +4 -3
- package/package.json +1 -1
- package/domain/shop-settings/enums/shop-page-name.enum.d.ts +0 -19
- package/domain/shop-settings/models/campaign-banner.d.ts +0 -11
- package/domain/shop-settings/models/campaign.d.ts +0 -10
- package/domain/shop-settings/models/types/campaign-page.d.ts +0 -17
- package/domain/shop-settings/models/types/sections.type.d.ts +0 -17
- package/domain/shop-settings/models/types/shop-gift.type.d.ts +0 -8
- package/domain/shop-settings/models/types/shop-post.type.d.ts +0 -7
- package/domain/shop-settings/repositories/campaign-banner.repository.d.ts +0 -4
- package/domain/shop-settings/repositories/campaign.repository.d.ts +0 -4
- package/esm2015/domain/shop-settings/enums/shop-page-name.enum.js +0 -21
- package/esm2015/domain/shop-settings/models/campaign-banner.js +0 -7
- package/esm2015/domain/shop-settings/models/campaign.js +0 -7
- package/esm2015/domain/shop-settings/models/types/campaign-page.js +0 -2
- package/esm2015/domain/shop-settings/models/types/sections.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/shop-gift.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/shop-post.type.js +0 -2
- package/esm2015/domain/shop-settings/repositories/campaign-banner.repository.js +0 -2
- package/esm2015/domain/shop-settings/repositories/campaign.repository.js +0 -2
- package/esm2015/infra/firebase/firestore/repositories/shop-settings/campaign-banner-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shop-settings/campaign-firestore.repository.js +0 -12
- package/infra/firebase/firestore/repositories/shop-settings/campaign-banner-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shop-settings/campaign-firestore.repository.d.ts +0 -8
|
@@ -1823,6 +1823,142 @@
|
|
|
1823
1823
|
return Filter;
|
|
1824
1824
|
}(BaseModel));
|
|
1825
1825
|
|
|
1826
|
+
var CategoryBase = /** @class */ (function (_super) {
|
|
1827
|
+
__extends(CategoryBase, _super);
|
|
1828
|
+
function CategoryBase() {
|
|
1829
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1830
|
+
}
|
|
1831
|
+
Object.defineProperty(CategoryBase, "identifiersFields", {
|
|
1832
|
+
get: function () {
|
|
1833
|
+
return ['id'];
|
|
1834
|
+
},
|
|
1835
|
+
enumerable: false,
|
|
1836
|
+
configurable: true
|
|
1837
|
+
});
|
|
1838
|
+
return CategoryBase;
|
|
1839
|
+
}(BaseModel));
|
|
1840
|
+
__decorate([
|
|
1841
|
+
classTransformer.Type(function () { return CategoryBase; }),
|
|
1842
|
+
__metadata("design:type", CategoryBase)
|
|
1843
|
+
], CategoryBase.prototype, "parent", void 0);
|
|
1844
|
+
__decorate([
|
|
1845
|
+
classTransformer.Type(function () { return Filter; }),
|
|
1846
|
+
__metadata("design:type", Array)
|
|
1847
|
+
], CategoryBase.prototype, "filters", void 0);
|
|
1848
|
+
|
|
1849
|
+
var CategoryForProduct = /** @class */ (function (_super) {
|
|
1850
|
+
__extends(CategoryForProduct, _super);
|
|
1851
|
+
function CategoryForProduct() {
|
|
1852
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1853
|
+
}
|
|
1854
|
+
Object.defineProperty(CategoryForProduct, "identifiersFields", {
|
|
1855
|
+
get: function () {
|
|
1856
|
+
return ['id'];
|
|
1857
|
+
},
|
|
1858
|
+
enumerable: false,
|
|
1859
|
+
configurable: true
|
|
1860
|
+
});
|
|
1861
|
+
return CategoryForProduct;
|
|
1862
|
+
}(CategoryBase));
|
|
1863
|
+
|
|
1864
|
+
var ProductBase = /** @class */ (function (_super) {
|
|
1865
|
+
__extends(ProductBase, _super);
|
|
1866
|
+
function ProductBase() {
|
|
1867
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1868
|
+
}
|
|
1869
|
+
Object.defineProperty(ProductBase.prototype, "evaluation", {
|
|
1870
|
+
get: function () {
|
|
1871
|
+
return {
|
|
1872
|
+
reviews: this.reviews,
|
|
1873
|
+
count: this.reviewsTotal,
|
|
1874
|
+
rating: this.rate,
|
|
1875
|
+
};
|
|
1876
|
+
},
|
|
1877
|
+
set: function (evaluation) {
|
|
1878
|
+
if (!evaluation) {
|
|
1879
|
+
this.reviews = null;
|
|
1880
|
+
this.reviewsTotal = null;
|
|
1881
|
+
this.rate = null;
|
|
1882
|
+
return;
|
|
1883
|
+
}
|
|
1884
|
+
this.reviews = evaluation.reviews || this.reviews;
|
|
1885
|
+
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
1886
|
+
this.rate = evaluation.rating || this.rate;
|
|
1887
|
+
},
|
|
1888
|
+
enumerable: false,
|
|
1889
|
+
configurable: true
|
|
1890
|
+
});
|
|
1891
|
+
Object.defineProperty(ProductBase, "identifiersFields", {
|
|
1892
|
+
get: function () {
|
|
1893
|
+
return ['id'];
|
|
1894
|
+
},
|
|
1895
|
+
enumerable: false,
|
|
1896
|
+
configurable: true
|
|
1897
|
+
});
|
|
1898
|
+
return ProductBase;
|
|
1899
|
+
}(BaseModel));
|
|
1900
|
+
|
|
1901
|
+
var ProductForKit = /** @class */ (function (_super) {
|
|
1902
|
+
__extends(ProductForKit, _super);
|
|
1903
|
+
function ProductForKit() {
|
|
1904
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1905
|
+
}
|
|
1906
|
+
Object.defineProperty(ProductForKit, "identifiersFields", {
|
|
1907
|
+
get: function () {
|
|
1908
|
+
return ['id'];
|
|
1909
|
+
},
|
|
1910
|
+
enumerable: false,
|
|
1911
|
+
configurable: true
|
|
1912
|
+
});
|
|
1913
|
+
return ProductForKit;
|
|
1914
|
+
}(ProductBase));
|
|
1915
|
+
__decorate([
|
|
1916
|
+
classTransformer.Type(function () { return CategoryForProduct; }),
|
|
1917
|
+
__metadata("design:type", CategoryForProduct)
|
|
1918
|
+
], ProductForKit.prototype, "category", void 0);
|
|
1919
|
+
|
|
1920
|
+
var KitProduct = /** @class */ (function (_super) {
|
|
1921
|
+
__extends(KitProduct, _super);
|
|
1922
|
+
function KitProduct() {
|
|
1923
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1924
|
+
}
|
|
1925
|
+
Object.defineProperty(KitProduct, "identifiersFields", {
|
|
1926
|
+
get: function () {
|
|
1927
|
+
return ['productId', 'kitProductId'];
|
|
1928
|
+
},
|
|
1929
|
+
enumerable: false,
|
|
1930
|
+
configurable: true
|
|
1931
|
+
});
|
|
1932
|
+
return KitProduct;
|
|
1933
|
+
}(BaseModel));
|
|
1934
|
+
__decorate([
|
|
1935
|
+
classTransformer.Type(function () { return ProductForKit; }),
|
|
1936
|
+
__metadata("design:type", ProductForKit)
|
|
1937
|
+
], KitProduct.prototype, "kit", void 0);
|
|
1938
|
+
__decorate([
|
|
1939
|
+
classTransformer.Type(function () { return ProductForKit; }),
|
|
1940
|
+
__metadata("design:type", ProductForKit)
|
|
1941
|
+
], KitProduct.prototype, "product", void 0);
|
|
1942
|
+
|
|
1943
|
+
var ProductForCategory = /** @class */ (function (_super) {
|
|
1944
|
+
__extends(ProductForCategory, _super);
|
|
1945
|
+
function ProductForCategory() {
|
|
1946
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1947
|
+
}
|
|
1948
|
+
Object.defineProperty(ProductForCategory, "identifiersFields", {
|
|
1949
|
+
get: function () {
|
|
1950
|
+
return ['id'];
|
|
1951
|
+
},
|
|
1952
|
+
enumerable: false,
|
|
1953
|
+
configurable: true
|
|
1954
|
+
});
|
|
1955
|
+
return ProductForCategory;
|
|
1956
|
+
}(ProductBase));
|
|
1957
|
+
__decorate([
|
|
1958
|
+
classTransformer.Type(function () { return KitProduct; }),
|
|
1959
|
+
__metadata("design:type", Array)
|
|
1960
|
+
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
1961
|
+
|
|
1826
1962
|
var Category = /** @class */ (function (_super) {
|
|
1827
1963
|
__extends(Category, _super);
|
|
1828
1964
|
function Category() {
|
|
@@ -1836,15 +1972,11 @@
|
|
|
1836
1972
|
configurable: true
|
|
1837
1973
|
});
|
|
1838
1974
|
return Category;
|
|
1839
|
-
}(
|
|
1975
|
+
}(CategoryBase));
|
|
1840
1976
|
__decorate([
|
|
1841
|
-
classTransformer.Type(function () { return
|
|
1842
|
-
__metadata("design:type", Category)
|
|
1843
|
-
], Category.prototype, "parent", void 0);
|
|
1844
|
-
__decorate([
|
|
1845
|
-
classTransformer.Type(function () { return Filter; }),
|
|
1977
|
+
classTransformer.Type(function () { return ProductForCategory; }),
|
|
1846
1978
|
__metadata("design:type", Array)
|
|
1847
|
-
], Category.prototype, "
|
|
1979
|
+
], Category.prototype, "childrenProducts", void 0);
|
|
1848
1980
|
|
|
1849
1981
|
var CategoryCollectionChildren = /** @class */ (function (_super) {
|
|
1850
1982
|
__extends(CategoryCollectionChildren, _super);
|
|
@@ -1883,6 +2015,10 @@
|
|
|
1883
2015
|
classTransformer.Type(function () { return Filter; }),
|
|
1884
2016
|
__metadata("design:type", Filter)
|
|
1885
2017
|
], CategoryFilter.prototype, "filter", void 0);
|
|
2018
|
+
__decorate([
|
|
2019
|
+
classTransformer.Type(function () { return Category; }),
|
|
2020
|
+
__metadata("design:type", Category)
|
|
2021
|
+
], CategoryFilter.prototype, "category", void 0);
|
|
1886
2022
|
|
|
1887
2023
|
exports.GenderDestination = void 0;
|
|
1888
2024
|
(function (GenderDestination) {
|
|
@@ -1919,28 +2055,6 @@
|
|
|
1919
2055
|
function Product() {
|
|
1920
2056
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1921
2057
|
}
|
|
1922
|
-
Object.defineProperty(Product.prototype, "evaluation", {
|
|
1923
|
-
get: function () {
|
|
1924
|
-
return {
|
|
1925
|
-
reviews: this.reviews,
|
|
1926
|
-
count: this.reviewsTotal,
|
|
1927
|
-
rating: this.rate,
|
|
1928
|
-
};
|
|
1929
|
-
},
|
|
1930
|
-
set: function (evaluation) {
|
|
1931
|
-
if (!evaluation) {
|
|
1932
|
-
this.reviews = null;
|
|
1933
|
-
this.reviewsTotal = null;
|
|
1934
|
-
this.rate = null;
|
|
1935
|
-
return;
|
|
1936
|
-
}
|
|
1937
|
-
this.reviews = evaluation.reviews || this.reviews;
|
|
1938
|
-
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
1939
|
-
this.rate = evaluation.rating || this.rate;
|
|
1940
|
-
},
|
|
1941
|
-
enumerable: false,
|
|
1942
|
-
configurable: true
|
|
1943
|
-
});
|
|
1944
2058
|
Object.defineProperty(Product, "identifiersFields", {
|
|
1945
2059
|
get: function () {
|
|
1946
2060
|
return ['id'];
|
|
@@ -1949,53 +2063,45 @@
|
|
|
1949
2063
|
configurable: true
|
|
1950
2064
|
});
|
|
1951
2065
|
return Product;
|
|
1952
|
-
}(
|
|
2066
|
+
}(ProductBase));
|
|
1953
2067
|
__decorate([
|
|
1954
|
-
classTransformer.Type(function () { return
|
|
1955
|
-
__metadata("design:type",
|
|
2068
|
+
classTransformer.Type(function () { return CategoryForProduct; }),
|
|
2069
|
+
__metadata("design:type", CategoryForProduct)
|
|
1956
2070
|
], Product.prototype, "category", void 0);
|
|
1957
2071
|
__decorate([
|
|
1958
2072
|
classTransformer.Type(function () { return KitProduct; }),
|
|
1959
2073
|
__metadata("design:type", Array)
|
|
1960
2074
|
], Product.prototype, "kitProducts", void 0);
|
|
1961
2075
|
|
|
1962
|
-
var
|
|
1963
|
-
__extends(
|
|
1964
|
-
function
|
|
2076
|
+
var Variant = /** @class */ (function (_super) {
|
|
2077
|
+
__extends(Variant, _super);
|
|
2078
|
+
function Variant() {
|
|
1965
2079
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1966
2080
|
}
|
|
1967
|
-
Object.defineProperty(
|
|
2081
|
+
Object.defineProperty(Variant, "identifiersFields", {
|
|
1968
2082
|
get: function () {
|
|
1969
|
-
return ['
|
|
2083
|
+
return ['id', 'productId'];
|
|
1970
2084
|
},
|
|
1971
2085
|
enumerable: false,
|
|
1972
2086
|
configurable: true
|
|
1973
2087
|
});
|
|
1974
|
-
return
|
|
2088
|
+
return Variant;
|
|
1975
2089
|
}(BaseModel));
|
|
1976
|
-
__decorate([
|
|
1977
|
-
classTransformer.Type(function () { return Product; }),
|
|
1978
|
-
__metadata("design:type", Product)
|
|
1979
|
-
], KitProduct.prototype, "kit", void 0);
|
|
1980
|
-
__decorate([
|
|
1981
|
-
classTransformer.Type(function () { return Product; }),
|
|
1982
|
-
__metadata("design:type", Product)
|
|
1983
|
-
], KitProduct.prototype, "product", void 0);
|
|
1984
2090
|
|
|
1985
|
-
var
|
|
1986
|
-
__extends(
|
|
1987
|
-
function
|
|
2091
|
+
var Wishlist = /** @class */ (function (_super) {
|
|
2092
|
+
__extends(Wishlist, _super);
|
|
2093
|
+
function Wishlist() {
|
|
1988
2094
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
1989
2095
|
}
|
|
1990
|
-
Object.defineProperty(
|
|
2096
|
+
Object.defineProperty(Wishlist, "identifiersFields", {
|
|
1991
2097
|
get: function () {
|
|
1992
|
-
return ['id'
|
|
2098
|
+
return ['id'];
|
|
1993
2099
|
},
|
|
1994
2100
|
enumerable: false,
|
|
1995
2101
|
configurable: true
|
|
1996
2102
|
});
|
|
1997
|
-
return
|
|
1998
|
-
}(
|
|
2103
|
+
return Wishlist;
|
|
2104
|
+
}(Category));
|
|
1999
2105
|
|
|
2000
2106
|
var Buy2Win = /** @class */ (function (_super) {
|
|
2001
2107
|
__extends(Buy2Win, _super);
|
|
@@ -2222,27 +2328,6 @@
|
|
|
2222
2328
|
QuestionsFilters["PRODUCT_SPENT"] = "Qual \u00E9 o seu nivel de gasto mensal em produtos de beleza e cuidados pessoais?";
|
|
2223
2329
|
})(exports.QuestionsFilters || (exports.QuestionsFilters = {}));
|
|
2224
2330
|
|
|
2225
|
-
exports.ShopPageName = void 0;
|
|
2226
|
-
(function (ShopPageName) {
|
|
2227
|
-
ShopPageName["LP_CLUB"] = "LP_CLUBE";
|
|
2228
|
-
ShopPageName["SUBSCRIBER_PANEL"] = "SUBSCRIBER_PANEL";
|
|
2229
|
-
ShopPageName["INVITE_FRIENDS"] = "INVITE_FRIENDS";
|
|
2230
|
-
ShopPageName["INVITE_AND_WIN"] = "INVITE_AND_WIN";
|
|
2231
|
-
ShopPageName["WIN_GLAMPOINTS"] = "WIN_GLAMPOINTS";
|
|
2232
|
-
ShopPageName["POSTS"] = "POSTS";
|
|
2233
|
-
ShopPageName["GLAMPOINTS_SHOWCASE"] = "GLAMPOINTS_SHOWCASE";
|
|
2234
|
-
ShopPageName["LP_EDITIONS"] = "LP_EDITIONS";
|
|
2235
|
-
ShopPageName["LP_GLAMBOX_EDITION"] = "LP_GLAMBOX_EDITION";
|
|
2236
|
-
ShopPageName["LP_GLAMBOX_PROMOTION"] = "LP_GLAMBOX_PROMOTION";
|
|
2237
|
-
ShopPageName["LP_GLAMBAG_PROMOTION"] = "LP_GLAMBAG_PROMOTION";
|
|
2238
|
-
ShopPageName["LP_GLAMPASS_PROMOTION"] = "LP_GLAMPASS_PROMOTION";
|
|
2239
|
-
ShopPageName["LP_SUBSCRIPTION_PROMOTION"] = "LP_SUBSCRIPTION_PROMOTION";
|
|
2240
|
-
ShopPageName["LP_GLAMPARTNER_PROMOTION"] = "LP_GLAMPARTNER_PROMOTION";
|
|
2241
|
-
ShopPageName["LP_GLAMQUEENS"] = "LP_GLAMQUEENS";
|
|
2242
|
-
ShopPageName["LP_INVITE"] = "LP_INVITE";
|
|
2243
|
-
ShopPageName["LP_LIVELO"] = "LP_LIVELO";
|
|
2244
|
-
})(exports.ShopPageName || (exports.ShopPageName = {}));
|
|
2245
|
-
|
|
2246
2331
|
var BeautyQuestionsHelper = /** @class */ (function () {
|
|
2247
2332
|
function BeautyQuestionsHelper() {
|
|
2248
2333
|
}
|
|
@@ -2290,36 +2375,6 @@
|
|
|
2290
2375
|
return BeautyQuestionsHelper;
|
|
2291
2376
|
}());
|
|
2292
2377
|
|
|
2293
|
-
var Campaign = /** @class */ (function (_super) {
|
|
2294
|
-
__extends(Campaign, _super);
|
|
2295
|
-
function Campaign() {
|
|
2296
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2297
|
-
}
|
|
2298
|
-
Object.defineProperty(Campaign, "identifiersFields", {
|
|
2299
|
-
get: function () {
|
|
2300
|
-
return ['id'];
|
|
2301
|
-
},
|
|
2302
|
-
enumerable: false,
|
|
2303
|
-
configurable: true
|
|
2304
|
-
});
|
|
2305
|
-
return Campaign;
|
|
2306
|
-
}(BaseModel));
|
|
2307
|
-
|
|
2308
|
-
var CampaignBanner = /** @class */ (function (_super) {
|
|
2309
|
-
__extends(CampaignBanner, _super);
|
|
2310
|
-
function CampaignBanner() {
|
|
2311
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2312
|
-
}
|
|
2313
|
-
Object.defineProperty(CampaignBanner, "identifiersFields", {
|
|
2314
|
-
get: function () {
|
|
2315
|
-
return ['id'];
|
|
2316
|
-
},
|
|
2317
|
-
enumerable: false,
|
|
2318
|
-
configurable: true
|
|
2319
|
-
});
|
|
2320
|
-
return CampaignBanner;
|
|
2321
|
-
}(BaseModel));
|
|
2322
|
-
|
|
2323
2378
|
var Home = /** @class */ (function (_super) {
|
|
2324
2379
|
__extends(Home, _super);
|
|
2325
2380
|
function Home() {
|
|
@@ -2540,7 +2595,7 @@
|
|
|
2540
2595
|
return __generator(this, function (_a) {
|
|
2541
2596
|
switch (_a.label) {
|
|
2542
2597
|
case 0:
|
|
2543
|
-
size = total
|
|
2598
|
+
size = total || 9;
|
|
2544
2599
|
fields = [
|
|
2545
2600
|
'EAN',
|
|
2546
2601
|
'brand',
|
|
@@ -3683,30 +3738,6 @@
|
|
|
3683
3738
|
return SubscriptionPlanFirestoreRepository;
|
|
3684
3739
|
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
3685
3740
|
|
|
3686
|
-
var CampaignBannerFirestoreRepository = /** @class */ (function (_super) {
|
|
3687
|
-
__extends(CampaignBannerFirestoreRepository, _super);
|
|
3688
|
-
function CampaignBannerFirestoreRepository(firestore) {
|
|
3689
|
-
var _this = _super.call(this) || this;
|
|
3690
|
-
_this.firestore = firestore;
|
|
3691
|
-
_this.collectionName = 'banners';
|
|
3692
|
-
_this.model = CampaignBanner;
|
|
3693
|
-
return _this;
|
|
3694
|
-
}
|
|
3695
|
-
return CampaignBannerFirestoreRepository;
|
|
3696
|
-
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
3697
|
-
|
|
3698
|
-
var CampaignFirestoreRepository = /** @class */ (function (_super) {
|
|
3699
|
-
__extends(CampaignFirestoreRepository, _super);
|
|
3700
|
-
function CampaignFirestoreRepository(firestore) {
|
|
3701
|
-
var _this = _super.call(this) || this;
|
|
3702
|
-
_this.firestore = firestore;
|
|
3703
|
-
_this.collectionName = 'campaigns';
|
|
3704
|
-
_this.model = Campaign;
|
|
3705
|
-
return _this;
|
|
3706
|
-
}
|
|
3707
|
-
return CampaignFirestoreRepository;
|
|
3708
|
-
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
3709
|
-
|
|
3710
3741
|
var HomeFirestoreRepository = /** @class */ (function (_super) {
|
|
3711
3742
|
__extends(HomeFirestoreRepository, _super);
|
|
3712
3743
|
function HomeFirestoreRepository(firestore) {
|
|
@@ -4013,7 +4044,7 @@
|
|
|
4013
4044
|
var fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
|
|
4014
4045
|
var columnName = fieldOptions.columnName;
|
|
4015
4046
|
var columnFields = fieldOptions.fields;
|
|
4016
|
-
return Object.assign(Object.assign({}, variables), (_a = {}, _a[columnName] = BindFilterQueryHelper.BuildWhereSentence(key, options[key], columnFields ||
|
|
4047
|
+
return Object.assign(Object.assign({}, variables), (_a = {}, _a[columnName] = BindFilterQueryHelper.BuildWhereSentence(key, options[key], (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || columnFields || fields), _a));
|
|
4017
4048
|
}, {});
|
|
4018
4049
|
if (!Array.isArray(options) && !lodash.isNil(fieldSentenceOptions.fields))
|
|
4019
4050
|
return _a = {},
|
|
@@ -4536,9 +4567,9 @@
|
|
|
4536
4567
|
function FindHasuraGraphQLMixin() {
|
|
4537
4568
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
4538
4569
|
_this.bindOrderByAttributes = function (orderBy, fields) { return Object.keys(orderBy).reduce(function (acc, current) {
|
|
4539
|
-
var
|
|
4540
|
-
return (Object.assign(Object.assign({}, acc), (
|
|
4541
|
-
.columnName] = orderBy[current],
|
|
4570
|
+
var _j;
|
|
4571
|
+
return (Object.assign(Object.assign({}, acc), (_j = {}, _j[AttributeOptionHelper.FindByAttribute(current, fields)
|
|
4572
|
+
.columnName] = orderBy[current], _j)));
|
|
4542
4573
|
}, {}); };
|
|
4543
4574
|
_this.bindAggretageAttributes = function (aggregates, fields) {
|
|
4544
4575
|
var _a, _b;
|
|
@@ -4556,6 +4587,7 @@
|
|
|
4556
4587
|
]
|
|
4557
4588
|
: [])));
|
|
4558
4589
|
};
|
|
4590
|
+
_this.bindDistinctAttributes = function (distinct, fields) { return _this.bindAttributesToColumns(distinct, fields); };
|
|
4559
4591
|
_this.bindAttributesToColumns = function (attributes, fields) { return attributes.map(function (attr) {
|
|
4560
4592
|
var _a;
|
|
4561
4593
|
return ((_a = AttributeOptionHelper.FindByAttribute(attr.toString().split('.').pop(), fields)) === null || _a === void 0 ? void 0 : _a.columnName) || attr;
|
|
@@ -4563,16 +4595,25 @@
|
|
|
4563
4595
|
return _this;
|
|
4564
4596
|
}
|
|
4565
4597
|
FindHasuraGraphQLMixin.prototype.find = function (params) {
|
|
4566
|
-
var _a, _b, _c;
|
|
4598
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4567
4599
|
return __awaiter(this, void 0, void 0, function () {
|
|
4568
|
-
var
|
|
4600
|
+
var _j, filters, limits, orderBy, options, enableCount, variablesFilters, variablesCount, variables, aggregateFields, result, data;
|
|
4569
4601
|
var _this = this;
|
|
4570
|
-
return __generator(this, function (
|
|
4571
|
-
switch (
|
|
4602
|
+
return __generator(this, function (_k) {
|
|
4603
|
+
switch (_k.label) {
|
|
4572
4604
|
case 0:
|
|
4573
4605
|
this.logger = DebugHelper.from(this, 'find');
|
|
4574
|
-
|
|
4606
|
+
_j = params || {}, filters = _j.filters, limits = _j.limits, orderBy = _j.orderBy, options = _j.options;
|
|
4575
4607
|
enableCount = (_a = options === null || options === void 0 ? void 0 : options.enableCount) !== null && _a !== void 0 ? _a : true;
|
|
4608
|
+
variablesFilters = lodash.isNil(filters)
|
|
4609
|
+
? {}
|
|
4610
|
+
: {
|
|
4611
|
+
where: {
|
|
4612
|
+
value: BindFilterQueryHelper.MakeGraphQLWhere(filters, this.fields),
|
|
4613
|
+
type: this.tableName + "_bool_exp",
|
|
4614
|
+
required: true,
|
|
4615
|
+
},
|
|
4616
|
+
};
|
|
4576
4617
|
variablesCount = Object.assign(Object.assign({}, (lodash.isNil(orderBy)
|
|
4577
4618
|
? {}
|
|
4578
4619
|
: {
|
|
@@ -4581,18 +4622,10 @@
|
|
|
4581
4622
|
list: true,
|
|
4582
4623
|
value: this.bindOrderByAttributes(orderBy, this.fields),
|
|
4583
4624
|
},
|
|
4584
|
-
})),
|
|
4585
|
-
? {}
|
|
4586
|
-
: {
|
|
4587
|
-
where: {
|
|
4588
|
-
value: BindFilterQueryHelper.MakeGraphQLWhere(filters, this.fields),
|
|
4589
|
-
type: this.tableName + "_bool_exp",
|
|
4590
|
-
required: true,
|
|
4591
|
-
},
|
|
4592
|
-
}));
|
|
4625
|
+
})), variablesFilters);
|
|
4593
4626
|
variables = Object.assign(Object.assign({}, (lodash.isNil(limits) ? {} : limits)), variablesCount);
|
|
4594
4627
|
aggregateFields = __spreadArray(__spreadArray([], __read((enableCount ? ['count'] : []))), __read(this.bindAggretageAttributes(params.options, this.fields)));
|
|
4595
|
-
return [4 /*yield*/, this.query(__spreadArray([
|
|
4628
|
+
return [4 /*yield*/, this.query(__spreadArray(__spreadArray([
|
|
4596
4629
|
{
|
|
4597
4630
|
operation: this.tableName,
|
|
4598
4631
|
fields: params.fields
|
|
@@ -4617,25 +4650,54 @@
|
|
|
4617
4650
|
variables: variablesCount,
|
|
4618
4651
|
},
|
|
4619
4652
|
]
|
|
4620
|
-
: []))))
|
|
4653
|
+
: []))), __read(((!((_b = params.limits) === null || _b === void 0 ? void 0 : _b.offset) &&
|
|
4654
|
+
((_d = (_c = params.options) === null || _c === void 0 ? void 0 : _c.distinct) === null || _d === void 0 ? void 0 : _d.map(function (distinct) {
|
|
4655
|
+
var _j;
|
|
4656
|
+
var _a, _b;
|
|
4657
|
+
var distinctOption = (_a = _this.fields.find(function (fieldOption) { return fieldOption === distinct; })) !== null && _a !== void 0 ? _a : _this.fields.find(function (fieldOption) { return Object.keys(fieldOption).shift() === distinct; });
|
|
4658
|
+
var fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || distinct;
|
|
4659
|
+
return {
|
|
4660
|
+
operation: {
|
|
4661
|
+
name: "" + _this.tableName,
|
|
4662
|
+
alias: _this.tableName + "_" + distinct + "_distinct",
|
|
4663
|
+
},
|
|
4664
|
+
fields: [distinctOption],
|
|
4665
|
+
variables: Object.assign(Object.assign({}, variablesFilters), (_j = {}, _j[_this.tableName + "_" + fieldName + "_distinct"] = {
|
|
4666
|
+
type: _this.tableName + "_select_column!",
|
|
4667
|
+
list: true,
|
|
4668
|
+
value: fieldName,
|
|
4669
|
+
name: 'distinct_on',
|
|
4670
|
+
}, _j)),
|
|
4671
|
+
};
|
|
4672
|
+
}))) ||
|
|
4673
|
+
[]))))];
|
|
4621
4674
|
case 1:
|
|
4622
|
-
result =
|
|
4675
|
+
result = _k.sent();
|
|
4623
4676
|
data = result[this.tableName].map(function (row) { return _this.convertDataFromHasura(row); });
|
|
4624
|
-
return [2 /*return*/, Object.assign(Object.assign({ data: data, count: enableCount ? result[this.tableName + "_aggregate"].aggregate.count : Infinity }, (((
|
|
4677
|
+
return [2 /*return*/, Object.assign(Object.assign(Object.assign({ data: data, count: enableCount ? result[this.tableName + "_aggregate"].aggregate.count : Infinity }, (((_e = options === null || options === void 0 ? void 0 : options.minimal) === null || _e === void 0 ? void 0 : _e.length)
|
|
4625
4678
|
? {
|
|
4626
4679
|
minimal: options.minimal.reduce(function (minimals, current) {
|
|
4627
4680
|
var _a;
|
|
4628
4681
|
return (Object.assign(Object.assign({}, minimals), lodash.set(minimals, current, result[_this.tableName + "_aggregate"].aggregate.min[((_a = AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), _this.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || current])));
|
|
4629
4682
|
}, {}),
|
|
4630
4683
|
}
|
|
4631
|
-
: {})), (((
|
|
4684
|
+
: {})), (((_f = options === null || options === void 0 ? void 0 : options.maximum) === null || _f === void 0 ? void 0 : _f.length)
|
|
4632
4685
|
? {
|
|
4633
4686
|
maximum: options.maximum.reduce(function (maximums, current) {
|
|
4634
4687
|
var _a;
|
|
4635
4688
|
return (Object.assign(Object.assign({}, maximums), lodash.set(maximums, current, result[_this.tableName + "_aggregate"].aggregate.max[((_a = AttributeOptionHelper.FindByAttribute(current.toString().split('.').pop(), _this.fields)) === null || _a === void 0 ? void 0 : _a.columnName) || current])));
|
|
4636
4689
|
}, {}),
|
|
4637
4690
|
}
|
|
4638
|
-
: {}))
|
|
4691
|
+
: {})), (!((_g = params.limits) === null || _g === void 0 ? void 0 : _g.offset) &&
|
|
4692
|
+
((_h = options === null || options === void 0 ? void 0 : options.distinct) === null || _h === void 0 ? void 0 : _h.length) && {
|
|
4693
|
+
distinct: options === null || options === void 0 ? void 0 : options.distinct.reduce(function (distinct, current) {
|
|
4694
|
+
var _j;
|
|
4695
|
+
var _a, _b;
|
|
4696
|
+
var distinctOption = (_a = _this.fields.find(function (fieldOption) { return fieldOption === current; })) !== null && _a !== void 0 ? _a : _this.fields.find(function (fieldOption) { return Object.keys(fieldOption).shift() === current; });
|
|
4697
|
+
var fieldName = ((_b = Object.values(distinctOption).shift()) === null || _b === void 0 ? void 0 : _b.columnName) || current;
|
|
4698
|
+
return Object.assign(Object.assign({}, distinct), (_j = {}, _j[current.toString()] = result[_this.tableName + "_" + current.toString() + "_distinct"].map(function (obj) { return obj[fieldName]; }), _j));
|
|
4699
|
+
}, {}),
|
|
4700
|
+
}))];
|
|
4639
4701
|
}
|
|
4640
4702
|
});
|
|
4641
4703
|
});
|
|
@@ -4777,9 +4839,60 @@
|
|
|
4777
4839
|
],
|
|
4778
4840
|
},
|
|
4779
4841
|
},
|
|
4842
|
+
{
|
|
4843
|
+
category: {
|
|
4844
|
+
columnName: 'category',
|
|
4845
|
+
foreignKeyColumn: { id: 'categoryId' },
|
|
4846
|
+
fields: [
|
|
4847
|
+
'id',
|
|
4848
|
+
'description',
|
|
4849
|
+
{
|
|
4850
|
+
products: {
|
|
4851
|
+
columnName: 'products',
|
|
4852
|
+
fields: ['product_id'],
|
|
4853
|
+
from: function (value) { return value.map(function (product) { return product.product_id.toString(); }); },
|
|
4854
|
+
to: function (productIds) { return productIds.map(function (productId) { return ({
|
|
4855
|
+
product_id: +productId,
|
|
4856
|
+
}); }); },
|
|
4857
|
+
},
|
|
4858
|
+
},
|
|
4859
|
+
{
|
|
4860
|
+
childrenProducts: {
|
|
4861
|
+
columnName: 'children_products',
|
|
4862
|
+
foreignKeyColumn: { category_id: 'id' },
|
|
4863
|
+
fields: [
|
|
4864
|
+
'id',
|
|
4865
|
+
'name',
|
|
4866
|
+
'slug',
|
|
4867
|
+
{
|
|
4868
|
+
categories: {
|
|
4869
|
+
columnName: 'categories',
|
|
4870
|
+
fields: ['category_id'],
|
|
4871
|
+
bindPersistData: function (value) { return ({
|
|
4872
|
+
categories: { data: value.map(function (category) { return ({ category_id: +category }); }) },
|
|
4873
|
+
}); },
|
|
4874
|
+
to: function (categories) { return categories.map(function (categoryId) { return +categoryId; }); },
|
|
4875
|
+
from: function (categories) { return (categories === null || categories === void 0 ? void 0 : categories.map(function (category) { var _a; return (_a = category === null || category === void 0 ? void 0 : category.category_id) === null || _a === void 0 ? void 0 : _a.toString(); })) || []; },
|
|
4876
|
+
},
|
|
4877
|
+
},
|
|
4878
|
+
],
|
|
4879
|
+
},
|
|
4880
|
+
},
|
|
4881
|
+
],
|
|
4882
|
+
},
|
|
4883
|
+
},
|
|
4780
4884
|
],
|
|
4781
4885
|
}) || this;
|
|
4782
4886
|
}
|
|
4887
|
+
CategoryFilterHasuraGraphQLRepository.prototype.deleteByCategory = function (categoryId) {
|
|
4888
|
+
return this.mutation('delete_category_filter', ['affected_rows'], {
|
|
4889
|
+
where: {
|
|
4890
|
+
type: 'category_filter_bool_exp',
|
|
4891
|
+
required: true,
|
|
4892
|
+
value: { category_id: { _eq: categoryId } },
|
|
4893
|
+
},
|
|
4894
|
+
});
|
|
4895
|
+
};
|
|
4783
4896
|
CategoryFilterHasuraGraphQLRepository.prototype.deleteByCategoryAndFilter = function (categoryId, filterId) {
|
|
4784
4897
|
return this.mutation('delete_category_filter', ['affected_rows'], {
|
|
4785
4898
|
where: {
|
|
@@ -4864,6 +4977,7 @@
|
|
|
4864
4977
|
},
|
|
4865
4978
|
},
|
|
4866
4979
|
{ isCollection: { columnName: 'is_collection' } },
|
|
4980
|
+
{ isWishlist: { columnName: 'is_wishlist' } },
|
|
4867
4981
|
'reference',
|
|
4868
4982
|
{ parentId: { columnName: 'parent_id' } },
|
|
4869
4983
|
{
|
|
@@ -4887,7 +5001,7 @@
|
|
|
4887
5001
|
var metadata, data;
|
|
4888
5002
|
return __generator(this, function (_c) {
|
|
4889
5003
|
metadata = params.metadata, data = __rest(params, ["metadata"]);
|
|
4890
|
-
return [2 /*return*/, _super.create.call(this, Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }))];
|
|
5004
|
+
return [2 /*return*/, _super.create.call(this, Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }))];
|
|
4891
5005
|
});
|
|
4892
5006
|
});
|
|
4893
5007
|
};
|
|
@@ -4928,7 +5042,7 @@
|
|
|
4928
5042
|
return [4 /*yield*/, this.getId(plainData.id)];
|
|
4929
5043
|
case 1:
|
|
4930
5044
|
id = _j.sent();
|
|
4931
|
-
return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
|
|
5045
|
+
return [4 /*yield*/, _super.update.call(this, Object.assign(Object.assign({ id: id }, data), { isWishlist: false }))];
|
|
4932
5046
|
case 2:
|
|
4933
5047
|
category = _j.sent();
|
|
4934
5048
|
_c = category;
|
|
@@ -4976,6 +5090,7 @@
|
|
|
4976
5090
|
slug: slug,
|
|
4977
5091
|
shops: { operator: exports.Where.IN, value: [shop] },
|
|
4978
5092
|
published: { operator: exports.Where.EQUALS, value: true },
|
|
5093
|
+
isWishlist: { operator: exports.Where.EQUALS, value: false },
|
|
4979
5094
|
},
|
|
4980
5095
|
options: {
|
|
4981
5096
|
enableCount: false,
|
|
@@ -5004,6 +5119,7 @@
|
|
|
5004
5119
|
filters: {
|
|
5005
5120
|
shops: { operator: exports.Where.IN, value: [shop] },
|
|
5006
5121
|
published: { operator: exports.Where.EQUALS, value: true },
|
|
5122
|
+
isWishlist: { operator: exports.Where.EQUALS, value: false },
|
|
5007
5123
|
},
|
|
5008
5124
|
options: {
|
|
5009
5125
|
enableCount: false,
|
|
@@ -5221,104 +5337,136 @@
|
|
|
5221
5337
|
CategoryHasuraGraphQLRepository.prototype.updateFilters = function (categoryId, _c) {
|
|
5222
5338
|
var filters = _c.filters;
|
|
5223
5339
|
return __awaiter(this, void 0, void 0, function () {
|
|
5224
|
-
var i, filtersList,
|
|
5225
|
-
|
|
5226
|
-
|
|
5340
|
+
var i, filtersList, currentFilters, currentFiltersId_1, filtersUpdatedId_1, filterToBeDeleted, filterToBeInserted, _loop_1, this_1, filterToBeDeleted_1, filterToBeDeleted_1_1, filter, e_1_1, filterToBeInserted_1, filterToBeInserted_1_1, filter, newCategoryFilter, e_2_1, filtersList, i, newCategoryFilter;
|
|
5341
|
+
var e_1, _c, e_2, _d;
|
|
5342
|
+
return __generator(this, function (_e) {
|
|
5343
|
+
switch (_e.label) {
|
|
5227
5344
|
case 0:
|
|
5228
5345
|
if (!('action' in filters && filters.action === 'remove' && filters.value.length)) return [3 /*break*/, 5];
|
|
5229
5346
|
i = 0;
|
|
5230
|
-
|
|
5347
|
+
_e.label = 1;
|
|
5231
5348
|
case 1:
|
|
5232
5349
|
if (!(i < filters.value.length)) return [3 /*break*/, 4];
|
|
5233
5350
|
return [4 /*yield*/, this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id)];
|
|
5234
5351
|
case 2:
|
|
5235
|
-
|
|
5236
|
-
|
|
5352
|
+
_e.sent();
|
|
5353
|
+
_e.label = 3;
|
|
5237
5354
|
case 3:
|
|
5238
5355
|
i++;
|
|
5239
5356
|
return [3 /*break*/, 1];
|
|
5240
5357
|
case 4: return [2 /*return*/, []];
|
|
5241
5358
|
case 5:
|
|
5242
|
-
if (!('action' in filters && filters.action === 'merge' && filters.value.length)) return [3 /*break*/,
|
|
5359
|
+
if (!('action' in filters && filters.action === 'merge' && filters.value.length)) return [3 /*break*/, 22];
|
|
5243
5360
|
filtersList = [];
|
|
5244
|
-
i = 0;
|
|
5245
|
-
_c.label = 6;
|
|
5246
|
-
case 6:
|
|
5247
|
-
if (!(i < filters.value.length)) return [3 /*break*/, 14];
|
|
5248
|
-
_c.label = 7;
|
|
5249
|
-
case 7:
|
|
5250
|
-
_c.trys.push([7, 12, , 13]);
|
|
5251
5361
|
return [4 /*yield*/, this.categoryFilterRepository
|
|
5252
5362
|
.find({
|
|
5253
5363
|
filters: {
|
|
5254
5364
|
categoryId: categoryId,
|
|
5255
|
-
filterId: filters.value[i].id,
|
|
5256
5365
|
},
|
|
5257
5366
|
})
|
|
5258
|
-
.then(function (
|
|
5367
|
+
.then(function (res) { return res.data; })];
|
|
5368
|
+
case 6:
|
|
5369
|
+
currentFilters = _e.sent();
|
|
5370
|
+
currentFiltersId_1 = currentFilters.map(function (f) { return f.id; });
|
|
5371
|
+
filtersUpdatedId_1 = filters.value.map(function (f) { return f.id; });
|
|
5372
|
+
filterToBeDeleted = currentFiltersId_1.filter(function (c) { return !filtersUpdatedId_1.includes(c); });
|
|
5373
|
+
filterToBeInserted = filtersUpdatedId_1.filter(function (c) { return !currentFiltersId_1.includes(c); });
|
|
5374
|
+
_loop_1 = function (filter) {
|
|
5375
|
+
var index;
|
|
5376
|
+
return __generator(this, function (_f) {
|
|
5377
|
+
switch (_f.label) {
|
|
5378
|
+
case 0:
|
|
5379
|
+
index = currentFilters.findIndex(function (f) { return f.id == filter; });
|
|
5380
|
+
if (index != -1) {
|
|
5381
|
+
currentFilters.splice(index, 1);
|
|
5382
|
+
}
|
|
5383
|
+
return [4 /*yield*/, this_1.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter)];
|
|
5384
|
+
case 1:
|
|
5385
|
+
_f.sent();
|
|
5386
|
+
return [2 /*return*/];
|
|
5387
|
+
}
|
|
5388
|
+
});
|
|
5389
|
+
};
|
|
5390
|
+
this_1 = this;
|
|
5391
|
+
_e.label = 7;
|
|
5392
|
+
case 7:
|
|
5393
|
+
_e.trys.push([7, 12, 13, 14]);
|
|
5394
|
+
filterToBeDeleted_1 = __values(filterToBeDeleted), filterToBeDeleted_1_1 = filterToBeDeleted_1.next();
|
|
5395
|
+
_e.label = 8;
|
|
5259
5396
|
case 8:
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
categoryId: categoryId,
|
|
5267
|
-
})];
|
|
5397
|
+
if (!!filterToBeDeleted_1_1.done) return [3 /*break*/, 11];
|
|
5398
|
+
filter = filterToBeDeleted_1_1.value;
|
|
5399
|
+
return [5 /*yield**/, _loop_1(filter)];
|
|
5400
|
+
case 9:
|
|
5401
|
+
_e.sent();
|
|
5402
|
+
_e.label = 10;
|
|
5268
5403
|
case 10:
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
case 11: return [3 /*break*/, 13];
|
|
5404
|
+
filterToBeDeleted_1_1 = filterToBeDeleted_1.next();
|
|
5405
|
+
return [3 /*break*/, 8];
|
|
5406
|
+
case 11: return [3 /*break*/, 14];
|
|
5273
5407
|
case 12:
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
return [3 /*break*/,
|
|
5408
|
+
e_1_1 = _e.sent();
|
|
5409
|
+
e_1 = { error: e_1_1 };
|
|
5410
|
+
return [3 /*break*/, 14];
|
|
5277
5411
|
case 13:
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5412
|
+
try {
|
|
5413
|
+
if (filterToBeDeleted_1_1 && !filterToBeDeleted_1_1.done && (_c = filterToBeDeleted_1.return)) _c.call(filterToBeDeleted_1);
|
|
5414
|
+
}
|
|
5415
|
+
finally { if (e_1) throw e_1.error; }
|
|
5416
|
+
return [7 /*endfinally*/];
|
|
5417
|
+
case 14:
|
|
5418
|
+
_e.trys.push([14, 19, 20, 21]);
|
|
5419
|
+
filterToBeInserted_1 = __values(filterToBeInserted), filterToBeInserted_1_1 = filterToBeInserted_1.next();
|
|
5420
|
+
_e.label = 15;
|
|
5281
5421
|
case 15:
|
|
5282
|
-
if (
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5422
|
+
if (!!filterToBeInserted_1_1.done) return [3 /*break*/, 18];
|
|
5423
|
+
filter = filterToBeInserted_1_1.value;
|
|
5424
|
+
return [4 /*yield*/, this.categoryFilterRepository.create({
|
|
5425
|
+
filterId: filter,
|
|
5426
|
+
categoryId: categoryId,
|
|
5427
|
+
})];
|
|
5286
5428
|
case 16:
|
|
5287
|
-
|
|
5288
|
-
|
|
5429
|
+
newCategoryFilter = _e.sent();
|
|
5430
|
+
filtersList.push(newCategoryFilter);
|
|
5431
|
+
_e.label = 17;
|
|
5289
5432
|
case 17:
|
|
5290
|
-
|
|
5291
|
-
return [
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
},
|
|
5297
|
-
})
|
|
5298
|
-
.then(function (data) { return data.data.shift(); })];
|
|
5299
|
-
case 18:
|
|
5300
|
-
hasFilter = _c.sent();
|
|
5301
|
-
if (!hasFilter) return [3 /*break*/, 19];
|
|
5302
|
-
filtersList.push(hasFilter);
|
|
5433
|
+
filterToBeInserted_1_1 = filterToBeInserted_1.next();
|
|
5434
|
+
return [3 /*break*/, 15];
|
|
5435
|
+
case 18: return [3 /*break*/, 21];
|
|
5436
|
+
case 19:
|
|
5437
|
+
e_2_1 = _e.sent();
|
|
5438
|
+
e_2 = { error: e_2_1 };
|
|
5303
5439
|
return [3 /*break*/, 21];
|
|
5304
|
-
case 19: return [4 /*yield*/, this.categoryFilterRepository.create({
|
|
5305
|
-
filterId: filters[i].id,
|
|
5306
|
-
categoryId: categoryId,
|
|
5307
|
-
})];
|
|
5308
5440
|
case 20:
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5441
|
+
try {
|
|
5442
|
+
if (filterToBeInserted_1_1 && !filterToBeInserted_1_1.done && (_d = filterToBeInserted_1.return)) _d.call(filterToBeInserted_1);
|
|
5443
|
+
}
|
|
5444
|
+
finally { if (e_2) throw e_2.error; }
|
|
5445
|
+
return [7 /*endfinally*/];
|
|
5446
|
+
case 21: return [2 /*return*/, __spreadArray(__spreadArray([], __read(currentFilters)), __read(filtersList))];
|
|
5313
5447
|
case 22:
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
return [3 /*break*/, 23];
|
|
5448
|
+
if (!(Array.isArray(filters) && filters.length)) return [3 /*break*/, 28];
|
|
5449
|
+
return [4 /*yield*/, this.categoryFilterRepository.deleteByCategory(categoryId)];
|
|
5317
5450
|
case 23:
|
|
5451
|
+
_e.sent();
|
|
5452
|
+
filtersList = [];
|
|
5453
|
+
i = 0;
|
|
5454
|
+
_e.label = 24;
|
|
5455
|
+
case 24:
|
|
5456
|
+
if (!(i < filters.length)) return [3 /*break*/, 27];
|
|
5457
|
+
return [4 /*yield*/, this.categoryFilterRepository.create({
|
|
5458
|
+
filterId: filters[i].id,
|
|
5459
|
+
categoryId: categoryId,
|
|
5460
|
+
})];
|
|
5461
|
+
case 25:
|
|
5462
|
+
newCategoryFilter = _e.sent();
|
|
5463
|
+
filtersList.push(newCategoryFilter);
|
|
5464
|
+
_e.label = 26;
|
|
5465
|
+
case 26:
|
|
5318
5466
|
i++;
|
|
5319
|
-
return [3 /*break*/,
|
|
5320
|
-
case
|
|
5321
|
-
case
|
|
5467
|
+
return [3 /*break*/, 24];
|
|
5468
|
+
case 27: return [2 /*return*/, filtersList];
|
|
5469
|
+
case 28: return [2 /*return*/];
|
|
5322
5470
|
}
|
|
5323
5471
|
});
|
|
5324
5472
|
});
|
|
@@ -5981,7 +6129,7 @@
|
|
|
5981
6129
|
ProductHasuraGraphQLRepository.prototype.findCatalog = function (params, mainGender) {
|
|
5982
6130
|
return __awaiter(this, void 0, void 0, function () {
|
|
5983
6131
|
return __generator(this, function (_p) {
|
|
5984
|
-
return [2 /*return*/, this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true }), orderBy: Object.assign({ hasStock: 'desc', intGender: mainGender === 'female' ? 'desc' : 'asc' }, lodash.omit(params.orderBy, ['hasStock', 'intGender'])) }))];
|
|
6132
|
+
return [2 /*return*/, this.find(Object.assign(Object.assign({}, params), { filters: Object.assign(Object.assign({}, params.filters), { published: true }), orderBy: Object.assign(Object.assign({ hasStock: 'desc' }, (!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' })), lodash.omit(params.orderBy, ['hasStock', 'intGender'])) }))];
|
|
5985
6133
|
});
|
|
5986
6134
|
});
|
|
5987
6135
|
};
|
|
@@ -6440,6 +6588,339 @@
|
|
|
6440
6588
|
return VariantHasuraGraphQLRepository;
|
|
6441
6589
|
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
6442
6590
|
|
|
6591
|
+
var WishlistHasuraGraphQLRepository = /** @class */ (function (_super_1) {
|
|
6592
|
+
__extends(WishlistHasuraGraphQLRepository, _super_1);
|
|
6593
|
+
function WishlistHasuraGraphQLRepository(endpoint, authOptions, categoryFilterRepository) {
|
|
6594
|
+
var _this = _super_1.call(this, {
|
|
6595
|
+
tableName: 'category',
|
|
6596
|
+
model: Wishlist,
|
|
6597
|
+
endpoint: endpoint,
|
|
6598
|
+
authOptions: authOptions,
|
|
6599
|
+
fields: [
|
|
6600
|
+
{ id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
|
|
6601
|
+
{ firestoreId: { columnName: 'firestore_id' } },
|
|
6602
|
+
'name',
|
|
6603
|
+
'description',
|
|
6604
|
+
'image',
|
|
6605
|
+
'published',
|
|
6606
|
+
'shop',
|
|
6607
|
+
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
6608
|
+
'slug',
|
|
6609
|
+
{ brandCategory: { columnName: 'brand_category' } },
|
|
6610
|
+
{ brandCategoryBanner: { columnName: 'brand_banner' } },
|
|
6611
|
+
{ brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
|
|
6612
|
+
{ brandLogo: { columnName: 'brand_logo' } },
|
|
6613
|
+
{ brandCondition: { columnName: 'brand_condition' } },
|
|
6614
|
+
{
|
|
6615
|
+
conditions: {
|
|
6616
|
+
columnName: 'tag_condition',
|
|
6617
|
+
type: HasuraGraphQLColumnType.Jsonb,
|
|
6618
|
+
from: function (tags, row) { return ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }); },
|
|
6619
|
+
bindPersistData: function (value) {
|
|
6620
|
+
return {
|
|
6621
|
+
brand_condition: value.brand,
|
|
6622
|
+
tag_condition: (value === null || value === void 0 ? void 0 : value.tags) || [],
|
|
6623
|
+
};
|
|
6624
|
+
},
|
|
6625
|
+
bindFindFilter: function (sentence) {
|
|
6626
|
+
return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
|
|
6627
|
+
},
|
|
6628
|
+
},
|
|
6629
|
+
},
|
|
6630
|
+
{
|
|
6631
|
+
filters: {
|
|
6632
|
+
columnName: 'filters',
|
|
6633
|
+
foreignKeyColumn: { filter_id: 'id' },
|
|
6634
|
+
fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
|
|
6635
|
+
bindPersistData: function (value) { return ({
|
|
6636
|
+
filters: { data: value.map(function (filter) { return ({ filter_id: filter.id }); }) },
|
|
6637
|
+
}); },
|
|
6638
|
+
from: function (filters) { return (filters === null || filters === void 0 ? void 0 : filters.map(function (filter) { return filter === null || filter === void 0 ? void 0 : filter.filter; })) || []; },
|
|
6639
|
+
},
|
|
6640
|
+
},
|
|
6641
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
6642
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
6643
|
+
{
|
|
6644
|
+
products: {
|
|
6645
|
+
columnName: 'products',
|
|
6646
|
+
fields: ['product_id'],
|
|
6647
|
+
from: function (value) { return value.map(function (product) { return product.product_id.toString(); }); },
|
|
6648
|
+
to: function (productIds) { return productIds.map(function (productId) { return ({
|
|
6649
|
+
product_id: +productId,
|
|
6650
|
+
}); }); },
|
|
6651
|
+
},
|
|
6652
|
+
},
|
|
6653
|
+
{
|
|
6654
|
+
metadata: {
|
|
6655
|
+
columnName: 'metadata',
|
|
6656
|
+
fields: ['title', 'description'],
|
|
6657
|
+
bindPersistData: function (value) { return ({
|
|
6658
|
+
metadata: { data: value },
|
|
6659
|
+
}); },
|
|
6660
|
+
},
|
|
6661
|
+
},
|
|
6662
|
+
{ isCollection: { columnName: 'is_collection' } },
|
|
6663
|
+
{ isWishlist: { columnName: 'is_wishlist' } },
|
|
6664
|
+
'reference',
|
|
6665
|
+
{ parentId: { columnName: 'parent_id' } },
|
|
6666
|
+
{
|
|
6667
|
+
parent: {
|
|
6668
|
+
columnName: 'parent',
|
|
6669
|
+
foreignKeyColumn: { id: 'parentId' },
|
|
6670
|
+
fields: ['id', 'name', 'reference', 'slug'],
|
|
6671
|
+
},
|
|
6672
|
+
},
|
|
6673
|
+
{ personId: { columnName: 'person_id' } },
|
|
6674
|
+
],
|
|
6675
|
+
}) || this;
|
|
6676
|
+
_this.categoryFilterRepository = categoryFilterRepository;
|
|
6677
|
+
return _this;
|
|
6678
|
+
}
|
|
6679
|
+
WishlistHasuraGraphQLRepository.prototype.create = function (params) {
|
|
6680
|
+
var _super = Object.create(null, {
|
|
6681
|
+
create: { get: function () { return _super_1.prototype.create; } }
|
|
6682
|
+
});
|
|
6683
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6684
|
+
var metadata, data;
|
|
6685
|
+
return __generator(this, function (_a) {
|
|
6686
|
+
metadata = params.metadata, data = __rest(params, ["metadata"]);
|
|
6687
|
+
return [2 /*return*/, _super.create.call(this, Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }))];
|
|
6688
|
+
});
|
|
6689
|
+
});
|
|
6690
|
+
};
|
|
6691
|
+
WishlistHasuraGraphQLRepository.prototype.get = function (identifiers) {
|
|
6692
|
+
var _super = Object.create(null, {
|
|
6693
|
+
get: { get: function () { return _super_1.prototype.get; } }
|
|
6694
|
+
});
|
|
6695
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6696
|
+
var data;
|
|
6697
|
+
return __generator(this, function (_a) {
|
|
6698
|
+
switch (_a.label) {
|
|
6699
|
+
case 0: return [4 /*yield*/, _super.get.call(this, identifiers)];
|
|
6700
|
+
case 1:
|
|
6701
|
+
data = _a.sent();
|
|
6702
|
+
if (!data.isWishlist)
|
|
6703
|
+
throw new NotFoundError("Category with id " + identifiers.id + " is not a wishlist");
|
|
6704
|
+
return [2 /*return*/, data];
|
|
6705
|
+
}
|
|
6706
|
+
});
|
|
6707
|
+
});
|
|
6708
|
+
};
|
|
6709
|
+
WishlistHasuraGraphQLRepository.prototype.update = function (params) {
|
|
6710
|
+
var _super = Object.create(null, {
|
|
6711
|
+
update: { get: function () { return _super_1.prototype.update; } }
|
|
6712
|
+
});
|
|
6713
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6714
|
+
var products, checkId, metadata, filters, data, plainData, id, category, _a, _b, _c, _d;
|
|
6715
|
+
return __generator(this, function (_e) {
|
|
6716
|
+
switch (_e.label) {
|
|
6717
|
+
case 0:
|
|
6718
|
+
products = params.products, checkId = params.id, metadata = params.metadata, filters = params.filters, data = __rest(params, ["products", "id", "metadata", "filters"]);
|
|
6719
|
+
plainData = this.paramsToPlain({ id: checkId });
|
|
6720
|
+
id = plainData.id;
|
|
6721
|
+
return [4 /*yield*/, _super.update.call(this, Object.assign(Object.assign({ id: id }, data), { isWishlist: true, isCollection: true, brandCategory: false }))];
|
|
6722
|
+
case 1:
|
|
6723
|
+
category = _e.sent();
|
|
6724
|
+
_a = category;
|
|
6725
|
+
_b = products;
|
|
6726
|
+
if (!_b) return [3 /*break*/, 3];
|
|
6727
|
+
return [4 /*yield*/, this.updateProducts(+id, { products: products })];
|
|
6728
|
+
case 2:
|
|
6729
|
+
_b = (_e.sent());
|
|
6730
|
+
_e.label = 3;
|
|
6731
|
+
case 3:
|
|
6732
|
+
_a.products = _b;
|
|
6733
|
+
_c = category;
|
|
6734
|
+
_d = metadata;
|
|
6735
|
+
if (!_d) return [3 /*break*/, 5];
|
|
6736
|
+
return [4 /*yield*/, this.updateMetadata(+id, { metadata: metadata })];
|
|
6737
|
+
case 4:
|
|
6738
|
+
_d = (_e.sent());
|
|
6739
|
+
_e.label = 5;
|
|
6740
|
+
case 5:
|
|
6741
|
+
_c.metadata = _d;
|
|
6742
|
+
return [2 /*return*/, category];
|
|
6743
|
+
}
|
|
6744
|
+
});
|
|
6745
|
+
});
|
|
6746
|
+
};
|
|
6747
|
+
WishlistHasuraGraphQLRepository.prototype.getWishlistBySlug = function (slug) {
|
|
6748
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6749
|
+
var data;
|
|
6750
|
+
return __generator(this, function (_a) {
|
|
6751
|
+
switch (_a.label) {
|
|
6752
|
+
case 0:
|
|
6753
|
+
if (!slug)
|
|
6754
|
+
return [2 /*return*/];
|
|
6755
|
+
return [4 /*yield*/, this.find({
|
|
6756
|
+
filters: {
|
|
6757
|
+
slug: slug,
|
|
6758
|
+
isWishlist: { operator: exports.Where.EQUALS, value: true },
|
|
6759
|
+
},
|
|
6760
|
+
options: {
|
|
6761
|
+
enableCount: false,
|
|
6762
|
+
},
|
|
6763
|
+
})];
|
|
6764
|
+
case 1:
|
|
6765
|
+
data = (_a.sent()).data;
|
|
6766
|
+
if (!data.length)
|
|
6767
|
+
throw new NotFoundError("Wishlist with slug " + slug + " not found");
|
|
6768
|
+
if (data.length > 1)
|
|
6769
|
+
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
6770
|
+
return [2 /*return*/, data.shift()];
|
|
6771
|
+
}
|
|
6772
|
+
});
|
|
6773
|
+
});
|
|
6774
|
+
};
|
|
6775
|
+
WishlistHasuraGraphQLRepository.prototype.getWishlistByPerson = function (personId) {
|
|
6776
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6777
|
+
var data;
|
|
6778
|
+
return __generator(this, function (_a) {
|
|
6779
|
+
switch (_a.label) {
|
|
6780
|
+
case 0:
|
|
6781
|
+
if (!personId)
|
|
6782
|
+
return [2 /*return*/];
|
|
6783
|
+
return [4 /*yield*/, this.find({
|
|
6784
|
+
filters: {
|
|
6785
|
+
personId: { operator: exports.Where.EQUALS, value: personId },
|
|
6786
|
+
isWishlist: { operator: exports.Where.EQUALS, value: true },
|
|
6787
|
+
},
|
|
6788
|
+
options: {
|
|
6789
|
+
enableCount: false,
|
|
6790
|
+
},
|
|
6791
|
+
})];
|
|
6792
|
+
case 1:
|
|
6793
|
+
data = (_a.sent()).data;
|
|
6794
|
+
if (!data.length)
|
|
6795
|
+
throw new NotFoundError("Wishlists from person " + personId + " not found");
|
|
6796
|
+
return [2 /*return*/, data];
|
|
6797
|
+
}
|
|
6798
|
+
});
|
|
6799
|
+
});
|
|
6800
|
+
};
|
|
6801
|
+
WishlistHasuraGraphQLRepository.prototype.updateProducts = function (categoryId, _a) {
|
|
6802
|
+
var products = _a.products;
|
|
6803
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6804
|
+
var plainData;
|
|
6805
|
+
return __generator(this, function (_a) {
|
|
6806
|
+
switch (_a.label) {
|
|
6807
|
+
case 0:
|
|
6808
|
+
if (!('action' in products && products.action === 'remove')) return [3 /*break*/, 3];
|
|
6809
|
+
return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
|
|
6810
|
+
where: {
|
|
6811
|
+
type: 'category_product_bool_exp',
|
|
6812
|
+
required: true,
|
|
6813
|
+
value: { category_id: { _eq: categoryId } },
|
|
6814
|
+
},
|
|
6815
|
+
})];
|
|
6816
|
+
case 1:
|
|
6817
|
+
_a.sent();
|
|
6818
|
+
return [4 /*yield*/, this.categoryFilterRepository.deleteByCategory(categoryId)];
|
|
6819
|
+
case 2:
|
|
6820
|
+
_a.sent();
|
|
6821
|
+
return [2 /*return*/, []];
|
|
6822
|
+
case 3:
|
|
6823
|
+
plainData = this.paramsToPlain({ products: products });
|
|
6824
|
+
if (!plainData.products || plainData.products.length <= 0)
|
|
6825
|
+
return [2 /*return*/, []];
|
|
6826
|
+
return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
|
|
6827
|
+
where: {
|
|
6828
|
+
type: 'category_product_bool_exp',
|
|
6829
|
+
required: true,
|
|
6830
|
+
value: { category_id: { _eq: categoryId } },
|
|
6831
|
+
},
|
|
6832
|
+
})];
|
|
6833
|
+
case 4:
|
|
6834
|
+
_a.sent();
|
|
6835
|
+
return [4 /*yield*/, this.categoryFilterRepository.deleteByCategory(categoryId)];
|
|
6836
|
+
case 5:
|
|
6837
|
+
_a.sent();
|
|
6838
|
+
return [4 /*yield*/, this.mutation('insert_category_product', ['affected_rows'], {
|
|
6839
|
+
objects: {
|
|
6840
|
+
type: '[category_product_insert_input!]',
|
|
6841
|
+
required: true,
|
|
6842
|
+
value: plainData.products.map(function (productId) { return ({ category_id: categoryId, product_id: productId }); }),
|
|
6843
|
+
},
|
|
6844
|
+
})];
|
|
6845
|
+
case 6:
|
|
6846
|
+
_a.sent();
|
|
6847
|
+
return [2 /*return*/, plainData.products];
|
|
6848
|
+
}
|
|
6849
|
+
});
|
|
6850
|
+
});
|
|
6851
|
+
};
|
|
6852
|
+
WishlistHasuraGraphQLRepository.prototype.updateMetadata = function (categoryId, _a) {
|
|
6853
|
+
var metadata = _a.metadata;
|
|
6854
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6855
|
+
var plainData;
|
|
6856
|
+
return __generator(this, function (_a) {
|
|
6857
|
+
switch (_a.label) {
|
|
6858
|
+
case 0:
|
|
6859
|
+
plainData = this.paramsToPlain({ metadata: metadata });
|
|
6860
|
+
if (!plainData.metadata)
|
|
6861
|
+
return [2 /*return*/];
|
|
6862
|
+
return [4 /*yield*/, this.mutation('update_category_metadata_by_pk', ['category_id'], {
|
|
6863
|
+
pk_columns: {
|
|
6864
|
+
value: { category_id: categoryId },
|
|
6865
|
+
type: 'category_metadata_pk_columns_input',
|
|
6866
|
+
required: true,
|
|
6867
|
+
},
|
|
6868
|
+
_set: {
|
|
6869
|
+
value: lodash.omit(metadata, ['category_id']),
|
|
6870
|
+
type: 'category_metadata_set_input',
|
|
6871
|
+
required: true,
|
|
6872
|
+
},
|
|
6873
|
+
})];
|
|
6874
|
+
case 1:
|
|
6875
|
+
_a.sent();
|
|
6876
|
+
return [2 /*return*/, plainData.metadata];
|
|
6877
|
+
}
|
|
6878
|
+
});
|
|
6879
|
+
});
|
|
6880
|
+
};
|
|
6881
|
+
WishlistHasuraGraphQLRepository.prototype.getCategoryBySlug = function (slug, _shop) {
|
|
6882
|
+
return this.getWishlistBySlug(slug);
|
|
6883
|
+
};
|
|
6884
|
+
WishlistHasuraGraphQLRepository.prototype.getCategoryByShop = function (shop) {
|
|
6885
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6886
|
+
var data;
|
|
6887
|
+
return __generator(this, function (_a) {
|
|
6888
|
+
switch (_a.label) {
|
|
6889
|
+
case 0:
|
|
6890
|
+
if (!shop)
|
|
6891
|
+
return [2 /*return*/];
|
|
6892
|
+
return [4 /*yield*/, this.find({
|
|
6893
|
+
filters: {
|
|
6894
|
+
shops: { operator: exports.Where.IN, value: [shop] },
|
|
6895
|
+
published: { operator: exports.Where.EQUALS, value: true },
|
|
6896
|
+
isWishlist: { operator: exports.Where.EQUALS, value: true },
|
|
6897
|
+
},
|
|
6898
|
+
options: {
|
|
6899
|
+
enableCount: false,
|
|
6900
|
+
},
|
|
6901
|
+
})];
|
|
6902
|
+
case 1:
|
|
6903
|
+
data = (_a.sent()).data;
|
|
6904
|
+
return [2 /*return*/, data];
|
|
6905
|
+
}
|
|
6906
|
+
});
|
|
6907
|
+
});
|
|
6908
|
+
};
|
|
6909
|
+
WishlistHasuraGraphQLRepository.prototype.getCategoriesForHome = function (categoryIds, limit, gender) {
|
|
6910
|
+
return;
|
|
6911
|
+
};
|
|
6912
|
+
WishlistHasuraGraphQLRepository.prototype.mountCategory = function (category, options) {
|
|
6913
|
+
return;
|
|
6914
|
+
};
|
|
6915
|
+
WishlistHasuraGraphQLRepository.prototype.getChildren = function (parentId) {
|
|
6916
|
+
return;
|
|
6917
|
+
};
|
|
6918
|
+
WishlistHasuraGraphQLRepository.prototype.isChild = function (id, parentId) {
|
|
6919
|
+
return;
|
|
6920
|
+
};
|
|
6921
|
+
return WishlistHasuraGraphQLRepository;
|
|
6922
|
+
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
6923
|
+
|
|
6443
6924
|
/**
|
|
6444
6925
|
* Generated bundle index. Do not edit.
|
|
6445
6926
|
*/
|
|
@@ -6566,12 +7047,8 @@
|
|
|
6566
7047
|
exports.BeautyQuestionsHelper = BeautyQuestionsHelper;
|
|
6567
7048
|
exports.Buy2Win = Buy2Win;
|
|
6568
7049
|
exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
|
|
6569
|
-
exports.Campaign = Campaign;
|
|
6570
|
-
exports.CampaignBanner = CampaignBanner;
|
|
6571
|
-
exports.CampaignBannerFirestoreRepository = CampaignBannerFirestoreRepository;
|
|
6572
7050
|
exports.CampaignDashboard = CampaignDashboard;
|
|
6573
7051
|
exports.CampaignDashboardFirestoreRepository = CampaignDashboardFirestoreRepository;
|
|
6574
|
-
exports.CampaignFirestoreRepository = CampaignFirestoreRepository;
|
|
6575
7052
|
exports.CampaignHashtag = CampaignHashtag;
|
|
6576
7053
|
exports.CampaignHashtagFirestoreRepository = CampaignHashtagFirestoreRepository;
|
|
6577
7054
|
exports.Category = Category;
|
|
@@ -6654,6 +7131,8 @@
|
|
|
6654
7131
|
exports.VariantHasuraGraphQL = VariantHasuraGraphQL;
|
|
6655
7132
|
exports.VariantHasuraGraphQLRepository = VariantHasuraGraphQLRepository;
|
|
6656
7133
|
exports.WeakPasswordError = WeakPasswordError;
|
|
7134
|
+
exports.Wishlist = Wishlist;
|
|
7135
|
+
exports.WishlistHasuraGraphQLRepository = WishlistHasuraGraphQLRepository;
|
|
6657
7136
|
exports.isDebuggable = isDebuggable;
|
|
6658
7137
|
exports.isUUID = isUUID;
|
|
6659
7138
|
exports.parseDateTime = parseDateTime;
|