@infrab4a/connect 4.3.0-beta.2 → 4.3.0-beta.4
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 +399 -371
- package/index.esm.js +399 -372
- package/package.json +1 -1
- package/src/domain/general/index.d.ts +1 -0
- package/src/domain/general/storage/file-uploader.service.d.ts +3 -0
- package/src/domain/general/storage/index.d.ts +1 -0
- package/src/domain/index.d.ts +4 -3
- package/src/domain/shop-settings/models/types/brands-carousel.type.d.ts +3 -0
- package/src/domain/shop-settings/models/types/index.d.ts +3 -0
- package/src/domain/shop-settings/models/types/landing-page.d.ts +8 -0
- package/src/domain/shop-settings/models/types/promotion-page.d.ts +10 -0
- package/src/domain/shop-settings/models/types/sections.type.d.ts +6 -0
- package/src/domain/users/models/user.d.ts +1 -0
- package/src/domain/users/use-cases/update-user-image.d.ts +9 -0
- package/src/infra/firebase/index.d.ts +2 -1
- package/src/infra/firebase/storage/firebase-file-uploader.service.d.ts +8 -0
- package/src/infra/firebase/storage/index.d.ts +1 -0
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +2 -1
package/index.cjs.js
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('reflect-metadata');
|
|
6
|
-
var classTransformer = require('class-transformer');
|
|
7
6
|
var tslib_1 = require('tslib');
|
|
7
|
+
var classTransformer = require('class-transformer');
|
|
8
8
|
var dateFns = require('date-fns');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
10
|
var debug = require('debug');
|
|
11
11
|
var tsCustomError = require('ts-custom-error');
|
|
12
12
|
var axios = require('axios');
|
|
13
|
-
var firestore = require('firebase/firestore');
|
|
14
13
|
var auth = require('firebase/auth');
|
|
14
|
+
var firestore = require('firebase/firestore');
|
|
15
|
+
var storage = require('firebase/storage');
|
|
15
16
|
var gqlQueryBuilder = require('gql-query-builder');
|
|
16
17
|
|
|
17
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -60,6 +61,187 @@ class BaseModel {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
class Filter extends BaseModel {
|
|
65
|
+
static get identifiersFields() {
|
|
66
|
+
return ['id'];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
class CategoryBase extends BaseModel {
|
|
71
|
+
static get identifiersFields() {
|
|
72
|
+
return ['id'];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
tslib_1.__decorate([
|
|
76
|
+
classTransformer.Type(() => CategoryBase),
|
|
77
|
+
tslib_1.__metadata("design:type", CategoryBase)
|
|
78
|
+
], CategoryBase.prototype, "parent", void 0);
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
classTransformer.Type(() => Filter),
|
|
81
|
+
tslib_1.__metadata("design:type", Array)
|
|
82
|
+
], CategoryBase.prototype, "filters", void 0);
|
|
83
|
+
|
|
84
|
+
class CategoryForProduct extends CategoryBase {
|
|
85
|
+
static get identifiersFields() {
|
|
86
|
+
return ['id'];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class ProductBase extends BaseModel {
|
|
91
|
+
get evaluation() {
|
|
92
|
+
return {
|
|
93
|
+
reviews: this.reviews,
|
|
94
|
+
count: this.reviewsTotal,
|
|
95
|
+
rating: this.rate,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
set evaluation(evaluation) {
|
|
99
|
+
if (!evaluation) {
|
|
100
|
+
this.reviews = null;
|
|
101
|
+
this.reviewsTotal = null;
|
|
102
|
+
this.rate = null;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.reviews = evaluation.reviews || this.reviews;
|
|
106
|
+
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
107
|
+
this.rate = evaluation.rating || this.rate;
|
|
108
|
+
}
|
|
109
|
+
static get identifiersFields() {
|
|
110
|
+
return ['id'];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
class ProductForKit extends ProductBase {
|
|
115
|
+
static get identifiersFields() {
|
|
116
|
+
return ['id'];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
tslib_1.__decorate([
|
|
120
|
+
classTransformer.Type(() => CategoryForProduct),
|
|
121
|
+
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
122
|
+
], ProductForKit.prototype, "category", void 0);
|
|
123
|
+
|
|
124
|
+
class KitProduct extends BaseModel {
|
|
125
|
+
static get identifiersFields() {
|
|
126
|
+
return ['productId', 'kitProductId'];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
tslib_1.__decorate([
|
|
130
|
+
classTransformer.Type(() => ProductForKit),
|
|
131
|
+
tslib_1.__metadata("design:type", ProductForKit)
|
|
132
|
+
], KitProduct.prototype, "kit", void 0);
|
|
133
|
+
tslib_1.__decorate([
|
|
134
|
+
classTransformer.Type(() => ProductForKit),
|
|
135
|
+
tslib_1.__metadata("design:type", ProductForKit)
|
|
136
|
+
], KitProduct.prototype, "product", void 0);
|
|
137
|
+
|
|
138
|
+
class ProductForCategory extends ProductBase {
|
|
139
|
+
static get identifiersFields() {
|
|
140
|
+
return ['id'];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
tslib_1.__decorate([
|
|
144
|
+
classTransformer.Type(() => KitProduct),
|
|
145
|
+
tslib_1.__metadata("design:type", Array)
|
|
146
|
+
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
147
|
+
|
|
148
|
+
class Category extends CategoryBase {
|
|
149
|
+
static get identifiersFields() {
|
|
150
|
+
return ['id'];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
tslib_1.__decorate([
|
|
154
|
+
classTransformer.Type(() => ProductForCategory),
|
|
155
|
+
tslib_1.__metadata("design:type", Array)
|
|
156
|
+
], Category.prototype, "childrenProducts", void 0);
|
|
157
|
+
|
|
158
|
+
class CategoryCollectionChildren extends BaseModel {
|
|
159
|
+
static get identifiersFields() {
|
|
160
|
+
return ['collectionId', 'categoryId'];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
tslib_1.__decorate([
|
|
164
|
+
classTransformer.Type(() => CategoryCollectionChildren),
|
|
165
|
+
tslib_1.__metadata("design:type", CategoryCollectionChildren)
|
|
166
|
+
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
167
|
+
|
|
168
|
+
class CategoryFilter extends BaseModel {
|
|
169
|
+
static get identifiersFields() {
|
|
170
|
+
return ['id'];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
tslib_1.__decorate([
|
|
174
|
+
classTransformer.Type(() => Filter),
|
|
175
|
+
tslib_1.__metadata("design:type", Filter)
|
|
176
|
+
], CategoryFilter.prototype, "filter", void 0);
|
|
177
|
+
tslib_1.__decorate([
|
|
178
|
+
classTransformer.Type(() => Category),
|
|
179
|
+
tslib_1.__metadata("design:type", Category)
|
|
180
|
+
], CategoryFilter.prototype, "category", void 0);
|
|
181
|
+
|
|
182
|
+
exports.GenderDestination = void 0;
|
|
183
|
+
(function (GenderDestination) {
|
|
184
|
+
GenderDestination["FEMALE"] = "female";
|
|
185
|
+
GenderDestination["MALE"] = "male";
|
|
186
|
+
GenderDestination["UNISEX"] = "unisex";
|
|
187
|
+
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
188
|
+
|
|
189
|
+
exports.Shops = void 0;
|
|
190
|
+
(function (Shops) {
|
|
191
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
192
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
193
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
194
|
+
Shops["ALL"] = "ALL";
|
|
195
|
+
})(exports.Shops || (exports.Shops = {}));
|
|
196
|
+
|
|
197
|
+
class FilterOption extends BaseModel {
|
|
198
|
+
static get identifiersFields() {
|
|
199
|
+
return ['id'];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
class Product extends ProductBase {
|
|
204
|
+
static get identifiersFields() {
|
|
205
|
+
return ['id'];
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
tslib_1.__decorate([
|
|
209
|
+
classTransformer.Type(() => CategoryForProduct),
|
|
210
|
+
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
211
|
+
], Product.prototype, "category", void 0);
|
|
212
|
+
tslib_1.__decorate([
|
|
213
|
+
classTransformer.Type(() => KitProduct),
|
|
214
|
+
tslib_1.__metadata("design:type", Array)
|
|
215
|
+
], Product.prototype, "kitProducts", void 0);
|
|
216
|
+
|
|
217
|
+
class ProductReviews extends BaseModel {
|
|
218
|
+
static get identifiersFields() {
|
|
219
|
+
return ['id'];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
class Variant extends BaseModel {
|
|
224
|
+
static get identifiersFields() {
|
|
225
|
+
return ['id', 'productId'];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
class Wishlist extends Category {
|
|
230
|
+
static get identifiersFields() {
|
|
231
|
+
return ['id'];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
class Buy2Win extends BaseModel {
|
|
236
|
+
static get identifiersFields() {
|
|
237
|
+
return ['id'];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
tslib_1.__decorate([
|
|
241
|
+
classTransformer.Type(() => Category),
|
|
242
|
+
tslib_1.__metadata("design:type", Array)
|
|
243
|
+
], Buy2Win.prototype, "categories", void 0);
|
|
244
|
+
|
|
63
245
|
exports.Where = void 0;
|
|
64
246
|
(function (Where) {
|
|
65
247
|
Where["EQUALS"] = "==";
|
|
@@ -85,6 +267,18 @@ exports.UpdateOptionActions = void 0;
|
|
|
85
267
|
UpdateOptionActions["NULL"] = "null";
|
|
86
268
|
})(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
|
|
87
269
|
|
|
270
|
+
class CampaignDashboard extends BaseModel {
|
|
271
|
+
static get identifiersFields() {
|
|
272
|
+
return ['id'];
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
class CampaignHashtag extends BaseModel {
|
|
277
|
+
static get identifiersFields() {
|
|
278
|
+
return ['id'];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
88
282
|
exports.AccessoryImportances = void 0;
|
|
89
283
|
(function (AccessoryImportances) {
|
|
90
284
|
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
@@ -1840,316 +2034,43 @@ class Address extends BaseModel {
|
|
|
1840
2034
|
|
|
1841
2035
|
class UserAddress extends Address {
|
|
1842
2036
|
static get identifiersFields() {
|
|
1843
|
-
return ['id', 'userId'];
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
class Subscription extends BaseModel {
|
|
1848
|
-
static get identifiersFields() {
|
|
1849
|
-
return ['id'];
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
tslib_1.__decorate([
|
|
1853
|
-
classTransformer.Type(() => User),
|
|
1854
|
-
tslib_1.__metadata("design:type", User)
|
|
1855
|
-
], Subscription.prototype, "user", void 0);
|
|
1856
|
-
tslib_1.__decorate([
|
|
1857
|
-
classTransformer.Type(() => SubscriptionPlan),
|
|
1858
|
-
tslib_1.__metadata("design:type", SubscriptionPlan)
|
|
1859
|
-
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
1860
|
-
tslib_1.__decorate([
|
|
1861
|
-
classTransformer.Type(() => UserAddress),
|
|
1862
|
-
tslib_1.__metadata("design:type", UserAddress)
|
|
1863
|
-
], Subscription.prototype, "shippingAddress", void 0);
|
|
1864
|
-
tslib_1.__decorate([
|
|
1865
|
-
classTransformer.Type(() => UserAddress),
|
|
1866
|
-
tslib_1.__metadata("design:type", UserAddress)
|
|
1867
|
-
], Subscription.prototype, "billingAddress", void 0);
|
|
1868
|
-
tslib_1.__decorate([
|
|
1869
|
-
classTransformer.Type(() => Coupon),
|
|
1870
|
-
tslib_1.__metadata("design:type", Coupon)
|
|
1871
|
-
], Subscription.prototype, "coupon", void 0);
|
|
1872
|
-
tslib_1.__decorate([
|
|
1873
|
-
classTransformer.Type(() => Edition),
|
|
1874
|
-
tslib_1.__metadata("design:type", Array)
|
|
1875
|
-
], Subscription.prototype, "editions", void 0);
|
|
1876
|
-
tslib_1.__decorate([
|
|
1877
|
-
classTransformer.Type(() => SubscriptionPayment),
|
|
1878
|
-
tslib_1.__metadata("design:type", Array)
|
|
1879
|
-
], Subscription.prototype, "payment", void 0);
|
|
1880
|
-
|
|
1881
|
-
class Filter extends BaseModel {
|
|
1882
|
-
static get identifiersFields() {
|
|
1883
|
-
return ['id'];
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
class CategoryBase extends BaseModel {
|
|
1888
|
-
static get identifiersFields() {
|
|
1889
|
-
return ['id'];
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1892
|
-
tslib_1.__decorate([
|
|
1893
|
-
classTransformer.Type(() => CategoryBase),
|
|
1894
|
-
tslib_1.__metadata("design:type", CategoryBase)
|
|
1895
|
-
], CategoryBase.prototype, "parent", void 0);
|
|
1896
|
-
tslib_1.__decorate([
|
|
1897
|
-
classTransformer.Type(() => Filter),
|
|
1898
|
-
tslib_1.__metadata("design:type", Array)
|
|
1899
|
-
], CategoryBase.prototype, "filters", void 0);
|
|
1900
|
-
|
|
1901
|
-
class CategoryForProduct extends CategoryBase {
|
|
1902
|
-
static get identifiersFields() {
|
|
1903
|
-
return ['id'];
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
class ProductBase extends BaseModel {
|
|
1908
|
-
get evaluation() {
|
|
1909
|
-
return {
|
|
1910
|
-
reviews: this.reviews,
|
|
1911
|
-
count: this.reviewsTotal,
|
|
1912
|
-
rating: this.rate,
|
|
1913
|
-
};
|
|
1914
|
-
}
|
|
1915
|
-
set evaluation(evaluation) {
|
|
1916
|
-
if (!evaluation) {
|
|
1917
|
-
this.reviews = null;
|
|
1918
|
-
this.reviewsTotal = null;
|
|
1919
|
-
this.rate = null;
|
|
1920
|
-
return;
|
|
1921
|
-
}
|
|
1922
|
-
this.reviews = evaluation.reviews || this.reviews;
|
|
1923
|
-
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
1924
|
-
this.rate = evaluation.rating || this.rate;
|
|
1925
|
-
}
|
|
1926
|
-
static get identifiersFields() {
|
|
1927
|
-
return ['id'];
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
class ProductForKit extends ProductBase {
|
|
1932
|
-
static get identifiersFields() {
|
|
1933
|
-
return ['id'];
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
tslib_1.__decorate([
|
|
1937
|
-
classTransformer.Type(() => CategoryForProduct),
|
|
1938
|
-
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
1939
|
-
], ProductForKit.prototype, "category", void 0);
|
|
1940
|
-
|
|
1941
|
-
class KitProduct extends BaseModel {
|
|
1942
|
-
static get identifiersFields() {
|
|
1943
|
-
return ['productId', 'kitProductId'];
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
tslib_1.__decorate([
|
|
1947
|
-
classTransformer.Type(() => ProductForKit),
|
|
1948
|
-
tslib_1.__metadata("design:type", ProductForKit)
|
|
1949
|
-
], KitProduct.prototype, "kit", void 0);
|
|
1950
|
-
tslib_1.__decorate([
|
|
1951
|
-
classTransformer.Type(() => ProductForKit),
|
|
1952
|
-
tslib_1.__metadata("design:type", ProductForKit)
|
|
1953
|
-
], KitProduct.prototype, "product", void 0);
|
|
1954
|
-
|
|
1955
|
-
class ProductForCategory extends ProductBase {
|
|
1956
|
-
static get identifiersFields() {
|
|
1957
|
-
return ['id'];
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
tslib_1.__decorate([
|
|
1961
|
-
classTransformer.Type(() => KitProduct),
|
|
1962
|
-
tslib_1.__metadata("design:type", Array)
|
|
1963
|
-
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
1964
|
-
|
|
1965
|
-
class Category extends CategoryBase {
|
|
1966
|
-
static get identifiersFields() {
|
|
1967
|
-
return ['id'];
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
tslib_1.__decorate([
|
|
1971
|
-
classTransformer.Type(() => ProductForCategory),
|
|
1972
|
-
tslib_1.__metadata("design:type", Array)
|
|
1973
|
-
], Category.prototype, "childrenProducts", void 0);
|
|
1974
|
-
|
|
1975
|
-
class CategoryCollectionChildren extends BaseModel {
|
|
1976
|
-
static get identifiersFields() {
|
|
1977
|
-
return ['collectionId', 'categoryId'];
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
tslib_1.__decorate([
|
|
1981
|
-
classTransformer.Type(() => CategoryCollectionChildren),
|
|
1982
|
-
tslib_1.__metadata("design:type", CategoryCollectionChildren)
|
|
1983
|
-
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
1984
|
-
|
|
1985
|
-
class CategoryFilter extends BaseModel {
|
|
1986
|
-
static get identifiersFields() {
|
|
1987
|
-
return ['id'];
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
tslib_1.__decorate([
|
|
1991
|
-
classTransformer.Type(() => Filter),
|
|
1992
|
-
tslib_1.__metadata("design:type", Filter)
|
|
1993
|
-
], CategoryFilter.prototype, "filter", void 0);
|
|
1994
|
-
tslib_1.__decorate([
|
|
1995
|
-
classTransformer.Type(() => Category),
|
|
1996
|
-
tslib_1.__metadata("design:type", Category)
|
|
1997
|
-
], CategoryFilter.prototype, "category", void 0);
|
|
1998
|
-
|
|
1999
|
-
exports.GenderDestination = void 0;
|
|
2000
|
-
(function (GenderDestination) {
|
|
2001
|
-
GenderDestination["FEMALE"] = "female";
|
|
2002
|
-
GenderDestination["MALE"] = "male";
|
|
2003
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
2004
|
-
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
2005
|
-
|
|
2006
|
-
exports.Shops = void 0;
|
|
2007
|
-
(function (Shops) {
|
|
2008
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
2009
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
2010
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
2011
|
-
Shops["ALL"] = "ALL";
|
|
2012
|
-
})(exports.Shops || (exports.Shops = {}));
|
|
2013
|
-
|
|
2014
|
-
class FilterOption extends BaseModel {
|
|
2015
|
-
static get identifiersFields() {
|
|
2016
|
-
return ['id'];
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
class Product extends ProductBase {
|
|
2021
|
-
static get identifiersFields() {
|
|
2022
|
-
return ['id'];
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
tslib_1.__decorate([
|
|
2026
|
-
classTransformer.Type(() => CategoryForProduct),
|
|
2027
|
-
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
2028
|
-
], Product.prototype, "category", void 0);
|
|
2029
|
-
tslib_1.__decorate([
|
|
2030
|
-
classTransformer.Type(() => KitProduct),
|
|
2031
|
-
tslib_1.__metadata("design:type", Array)
|
|
2032
|
-
], Product.prototype, "kitProducts", void 0);
|
|
2033
|
-
|
|
2034
|
-
class ProductReviews extends BaseModel {
|
|
2035
|
-
static get identifiersFields() {
|
|
2036
|
-
return ['id'];
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
class Variant extends BaseModel {
|
|
2041
|
-
static get identifiersFields() {
|
|
2042
|
-
return ['id', 'productId'];
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
class Wishlist extends Category {
|
|
2047
|
-
static get identifiersFields() {
|
|
2048
|
-
return ['id'];
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
class Buy2Win extends BaseModel {
|
|
2053
|
-
static get identifiersFields() {
|
|
2054
|
-
return ['id'];
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
tslib_1.__decorate([
|
|
2058
|
-
classTransformer.Type(() => Category),
|
|
2059
|
-
tslib_1.__metadata("design:type", Array)
|
|
2060
|
-
], Buy2Win.prototype, "categories", void 0);
|
|
2061
|
-
|
|
2062
|
-
class CampaignDashboard extends BaseModel {
|
|
2063
|
-
static get identifiersFields() {
|
|
2064
|
-
return ['id'];
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
class CampaignHashtag extends BaseModel {
|
|
2069
|
-
static get identifiersFields() {
|
|
2070
|
-
return ['id'];
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
class LineItem extends Product {
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
class ShippingMethod extends BaseModel {
|
|
2078
|
-
static get identifiersFields() {
|
|
2079
|
-
return ['id'];
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
class Checkout extends BaseModel {
|
|
2084
|
-
static get identifiersFields() {
|
|
2085
|
-
return ['id'];
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
tslib_1.__decorate([
|
|
2089
|
-
classTransformer.Type(() => LineItem),
|
|
2090
|
-
tslib_1.__metadata("design:type", Array)
|
|
2091
|
-
], Checkout.prototype, "lineItems", void 0);
|
|
2092
|
-
tslib_1.__decorate([
|
|
2093
|
-
classTransformer.Type(() => User),
|
|
2094
|
-
tslib_1.__metadata("design:type", User)
|
|
2095
|
-
], Checkout.prototype, "user", void 0);
|
|
2096
|
-
tslib_1.__decorate([
|
|
2097
|
-
classTransformer.Type(() => UserAddress),
|
|
2098
|
-
tslib_1.__metadata("design:type", UserAddress)
|
|
2099
|
-
], Checkout.prototype, "shippingAddress", void 0);
|
|
2100
|
-
tslib_1.__decorate([
|
|
2101
|
-
classTransformer.Type(() => UserAddress),
|
|
2102
|
-
tslib_1.__metadata("design:type", UserAddress)
|
|
2103
|
-
], Checkout.prototype, "billingAddress", void 0);
|
|
2104
|
-
tslib_1.__decorate([
|
|
2105
|
-
classTransformer.Type(() => ShippingMethod),
|
|
2106
|
-
tslib_1.__metadata("design:type", ShippingMethod)
|
|
2107
|
-
], Checkout.prototype, "shipping", void 0);
|
|
2108
|
-
tslib_1.__decorate([
|
|
2109
|
-
classTransformer.Type(() => Coupon),
|
|
2110
|
-
tslib_1.__metadata("design:type", Coupon)
|
|
2111
|
-
], Checkout.prototype, "coupon", void 0);
|
|
2112
|
-
|
|
2113
|
-
exports.OrderStatus = void 0;
|
|
2114
|
-
(function (OrderStatus) {
|
|
2115
|
-
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
2116
|
-
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
2117
|
-
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
2118
|
-
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
2119
|
-
OrderStatus["ENVIADO"] = "Enviado";
|
|
2120
|
-
OrderStatus["ENTREGUE"] = "Entregue";
|
|
2121
|
-
OrderStatus["CANCELADO"] = "Cancelado";
|
|
2122
|
-
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
2123
|
-
})(exports.OrderStatus || (exports.OrderStatus = {}));
|
|
2124
|
-
|
|
2125
|
-
class Order extends Checkout {
|
|
2126
|
-
}
|
|
2127
|
-
tslib_1.__decorate([
|
|
2128
|
-
classTransformer.Type(() => Payment),
|
|
2129
|
-
tslib_1.__metadata("design:type", Payment)
|
|
2130
|
-
], Order.prototype, "payment", void 0);
|
|
2037
|
+
return ['id', 'userId'];
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2131
2040
|
|
|
2132
|
-
class
|
|
2041
|
+
class Subscription extends BaseModel {
|
|
2133
2042
|
static get identifiersFields() {
|
|
2134
2043
|
return ['id'];
|
|
2135
2044
|
}
|
|
2136
2045
|
}
|
|
2046
|
+
tslib_1.__decorate([
|
|
2047
|
+
classTransformer.Type(() => User),
|
|
2048
|
+
tslib_1.__metadata("design:type", User)
|
|
2049
|
+
], Subscription.prototype, "user", void 0);
|
|
2050
|
+
tslib_1.__decorate([
|
|
2051
|
+
classTransformer.Type(() => SubscriptionPlan),
|
|
2052
|
+
tslib_1.__metadata("design:type", SubscriptionPlan)
|
|
2053
|
+
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
2137
2054
|
tslib_1.__decorate([
|
|
2138
2055
|
classTransformer.Type(() => UserAddress),
|
|
2139
2056
|
tslib_1.__metadata("design:type", UserAddress)
|
|
2140
|
-
],
|
|
2057
|
+
], Subscription.prototype, "shippingAddress", void 0);
|
|
2141
2058
|
tslib_1.__decorate([
|
|
2142
2059
|
classTransformer.Type(() => UserAddress),
|
|
2143
2060
|
tslib_1.__metadata("design:type", UserAddress)
|
|
2144
|
-
],
|
|
2145
|
-
tslib_1.__decorate([
|
|
2146
|
-
classTransformer.Type(() => SubscriptionPlan),
|
|
2147
|
-
tslib_1.__metadata("design:type", SubscriptionPlan)
|
|
2148
|
-
], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
|
|
2061
|
+
], Subscription.prototype, "billingAddress", void 0);
|
|
2149
2062
|
tslib_1.__decorate([
|
|
2150
2063
|
classTransformer.Type(() => Coupon),
|
|
2151
2064
|
tslib_1.__metadata("design:type", Coupon)
|
|
2152
|
-
],
|
|
2065
|
+
], Subscription.prototype, "coupon", void 0);
|
|
2066
|
+
tslib_1.__decorate([
|
|
2067
|
+
classTransformer.Type(() => Edition),
|
|
2068
|
+
tslib_1.__metadata("design:type", Array)
|
|
2069
|
+
], Subscription.prototype, "editions", void 0);
|
|
2070
|
+
tslib_1.__decorate([
|
|
2071
|
+
classTransformer.Type(() => SubscriptionPayment),
|
|
2072
|
+
tslib_1.__metadata("design:type", Array)
|
|
2073
|
+
], Subscription.prototype, "payment", void 0);
|
|
2153
2074
|
|
|
2154
2075
|
class SubscriptionMaterialization extends BaseModel {
|
|
2155
2076
|
static get identifiersFields() {
|
|
@@ -2300,6 +2221,86 @@ class RecoveryPassword {
|
|
|
2300
2221
|
}
|
|
2301
2222
|
}
|
|
2302
2223
|
|
|
2224
|
+
class LineItem extends Product {
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
class ShippingMethod extends BaseModel {
|
|
2228
|
+
static get identifiersFields() {
|
|
2229
|
+
return ['id'];
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
class Checkout extends BaseModel {
|
|
2234
|
+
static get identifiersFields() {
|
|
2235
|
+
return ['id'];
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
tslib_1.__decorate([
|
|
2239
|
+
classTransformer.Type(() => LineItem),
|
|
2240
|
+
tslib_1.__metadata("design:type", Array)
|
|
2241
|
+
], Checkout.prototype, "lineItems", void 0);
|
|
2242
|
+
tslib_1.__decorate([
|
|
2243
|
+
classTransformer.Type(() => User),
|
|
2244
|
+
tslib_1.__metadata("design:type", User)
|
|
2245
|
+
], Checkout.prototype, "user", void 0);
|
|
2246
|
+
tslib_1.__decorate([
|
|
2247
|
+
classTransformer.Type(() => UserAddress),
|
|
2248
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2249
|
+
], Checkout.prototype, "shippingAddress", void 0);
|
|
2250
|
+
tslib_1.__decorate([
|
|
2251
|
+
classTransformer.Type(() => UserAddress),
|
|
2252
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2253
|
+
], Checkout.prototype, "billingAddress", void 0);
|
|
2254
|
+
tslib_1.__decorate([
|
|
2255
|
+
classTransformer.Type(() => ShippingMethod),
|
|
2256
|
+
tslib_1.__metadata("design:type", ShippingMethod)
|
|
2257
|
+
], Checkout.prototype, "shipping", void 0);
|
|
2258
|
+
tslib_1.__decorate([
|
|
2259
|
+
classTransformer.Type(() => Coupon),
|
|
2260
|
+
tslib_1.__metadata("design:type", Coupon)
|
|
2261
|
+
], Checkout.prototype, "coupon", void 0);
|
|
2262
|
+
|
|
2263
|
+
exports.OrderStatus = void 0;
|
|
2264
|
+
(function (OrderStatus) {
|
|
2265
|
+
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
2266
|
+
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
2267
|
+
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
2268
|
+
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
2269
|
+
OrderStatus["ENVIADO"] = "Enviado";
|
|
2270
|
+
OrderStatus["ENTREGUE"] = "Entregue";
|
|
2271
|
+
OrderStatus["CANCELADO"] = "Cancelado";
|
|
2272
|
+
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
2273
|
+
})(exports.OrderStatus || (exports.OrderStatus = {}));
|
|
2274
|
+
|
|
2275
|
+
class Order extends Checkout {
|
|
2276
|
+
}
|
|
2277
|
+
tslib_1.__decorate([
|
|
2278
|
+
classTransformer.Type(() => Payment),
|
|
2279
|
+
tslib_1.__metadata("design:type", Payment)
|
|
2280
|
+
], Order.prototype, "payment", void 0);
|
|
2281
|
+
|
|
2282
|
+
class CheckoutSubscription extends BaseModel {
|
|
2283
|
+
static get identifiersFields() {
|
|
2284
|
+
return ['id'];
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
tslib_1.__decorate([
|
|
2288
|
+
classTransformer.Type(() => UserAddress),
|
|
2289
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2290
|
+
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
2291
|
+
tslib_1.__decorate([
|
|
2292
|
+
classTransformer.Type(() => UserAddress),
|
|
2293
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2294
|
+
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
2295
|
+
tslib_1.__decorate([
|
|
2296
|
+
classTransformer.Type(() => SubscriptionPlan),
|
|
2297
|
+
tslib_1.__metadata("design:type", SubscriptionPlan)
|
|
2298
|
+
], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
|
|
2299
|
+
tslib_1.__decorate([
|
|
2300
|
+
classTransformer.Type(() => Coupon),
|
|
2301
|
+
tslib_1.__metadata("design:type", Coupon)
|
|
2302
|
+
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
2303
|
+
|
|
2303
2304
|
class RoundProductPricesHelper {
|
|
2304
2305
|
static roundProductPrices(product) {
|
|
2305
2306
|
product.price.price = Number(product.price.price.toFixed(2));
|
|
@@ -2633,6 +2634,75 @@ class ProductsIndex {
|
|
|
2633
2634
|
}
|
|
2634
2635
|
}
|
|
2635
2636
|
|
|
2637
|
+
class AuthenticationFirebaseAuthService {
|
|
2638
|
+
constructor(firebaseAuth) {
|
|
2639
|
+
this.firebaseAuth = firebaseAuth;
|
|
2640
|
+
}
|
|
2641
|
+
async signInWithEmailAndPassword(data) {
|
|
2642
|
+
const credentials = await auth.signInWithEmailAndPassword(this.firebaseAuth, data.email, data.password);
|
|
2643
|
+
const user = credentials.user;
|
|
2644
|
+
return {
|
|
2645
|
+
id: user.uid,
|
|
2646
|
+
displayName: user.displayName,
|
|
2647
|
+
email: user.email,
|
|
2648
|
+
phone: user.phoneNumber,
|
|
2649
|
+
isAnonymous: false,
|
|
2650
|
+
};
|
|
2651
|
+
}
|
|
2652
|
+
async signInWithGoogle() {
|
|
2653
|
+
const credentials = await auth.signInWithPopup(this.firebaseAuth, new auth.GoogleAuthProvider());
|
|
2654
|
+
const user = credentials.user;
|
|
2655
|
+
return {
|
|
2656
|
+
id: user.uid,
|
|
2657
|
+
displayName: user.displayName,
|
|
2658
|
+
email: user.email,
|
|
2659
|
+
phone: user.phoneNumber,
|
|
2660
|
+
isAnonymous: false,
|
|
2661
|
+
};
|
|
2662
|
+
}
|
|
2663
|
+
async signOut() {
|
|
2664
|
+
this.firebaseAuth.signOut();
|
|
2665
|
+
}
|
|
2666
|
+
async signInAnonymously() {
|
|
2667
|
+
const auth$1 = await auth.signInAnonymously(this.firebaseAuth);
|
|
2668
|
+
const user = auth$1.user;
|
|
2669
|
+
user.id = auth$1.user.uid;
|
|
2670
|
+
return user;
|
|
2671
|
+
}
|
|
2672
|
+
async sendPasswordResetEmail(email) {
|
|
2673
|
+
return auth.sendPasswordResetEmail(this.firebaseAuth, email);
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
class RegisterFirebaseAuthService {
|
|
2678
|
+
constructor(firebaseAuth) {
|
|
2679
|
+
this.firebaseAuth = firebaseAuth;
|
|
2680
|
+
}
|
|
2681
|
+
async register(params) {
|
|
2682
|
+
if (!params.email)
|
|
2683
|
+
throw new RequiredArgumentError(['email']);
|
|
2684
|
+
try {
|
|
2685
|
+
const auth$1 = await auth.createUserWithEmailAndPassword(this.firebaseAuth, params.email, params.password);
|
|
2686
|
+
const user = is(auth$1.user);
|
|
2687
|
+
if (!user)
|
|
2688
|
+
throw new Error('User not created');
|
|
2689
|
+
await auth.sendEmailVerification(user);
|
|
2690
|
+
user.id = user.uid;
|
|
2691
|
+
return user;
|
|
2692
|
+
}
|
|
2693
|
+
catch (error) {
|
|
2694
|
+
if (!(error instanceof Error))
|
|
2695
|
+
throw error;
|
|
2696
|
+
const firebaseError = error;
|
|
2697
|
+
if (firebaseError.code === 'auth/email-already-in-use')
|
|
2698
|
+
throw new UserAlreadyRegisteredError('Email already registered');
|
|
2699
|
+
if (firebaseError.code === 'auth/weak-password')
|
|
2700
|
+
throw new WeakPasswordError();
|
|
2701
|
+
throw error;
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2636
2706
|
const withFirestore = (MixinBase) => {
|
|
2637
2707
|
const isObjectsAndNoDate = (data) => data &&
|
|
2638
2708
|
!Array.isArray(data) &&
|
|
@@ -3503,72 +3573,14 @@ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
3503
3573
|
}
|
|
3504
3574
|
}
|
|
3505
3575
|
|
|
3506
|
-
class
|
|
3507
|
-
constructor(
|
|
3508
|
-
this.
|
|
3509
|
-
|
|
3510
|
-
async signInWithEmailAndPassword(data) {
|
|
3511
|
-
const credentials = await auth.signInWithEmailAndPassword(this.firebaseAuth, data.email, data.password);
|
|
3512
|
-
const user = credentials.user;
|
|
3513
|
-
return {
|
|
3514
|
-
id: user.uid,
|
|
3515
|
-
displayName: user.displayName,
|
|
3516
|
-
email: user.email,
|
|
3517
|
-
phone: user.phoneNumber,
|
|
3518
|
-
isAnonymous: false,
|
|
3519
|
-
};
|
|
3520
|
-
}
|
|
3521
|
-
async signInWithGoogle() {
|
|
3522
|
-
const credentials = await auth.signInWithPopup(this.firebaseAuth, new auth.GoogleAuthProvider());
|
|
3523
|
-
const user = credentials.user;
|
|
3524
|
-
return {
|
|
3525
|
-
id: user.uid,
|
|
3526
|
-
displayName: user.displayName,
|
|
3527
|
-
email: user.email,
|
|
3528
|
-
phone: user.phoneNumber,
|
|
3529
|
-
isAnonymous: false,
|
|
3530
|
-
};
|
|
3531
|
-
}
|
|
3532
|
-
async signOut() {
|
|
3533
|
-
this.firebaseAuth.signOut();
|
|
3534
|
-
}
|
|
3535
|
-
async signInAnonymously() {
|
|
3536
|
-
const auth$1 = await auth.signInAnonymously(this.firebaseAuth);
|
|
3537
|
-
const user = auth$1.user;
|
|
3538
|
-
user.id = auth$1.user.uid;
|
|
3539
|
-
return user;
|
|
3540
|
-
}
|
|
3541
|
-
async sendPasswordResetEmail(email) {
|
|
3542
|
-
return auth.sendPasswordResetEmail(this.firebaseAuth, email);
|
|
3543
|
-
}
|
|
3544
|
-
}
|
|
3545
|
-
|
|
3546
|
-
class RegisterFirebaseAuthService {
|
|
3547
|
-
constructor(firebaseAuth) {
|
|
3548
|
-
this.firebaseAuth = firebaseAuth;
|
|
3576
|
+
class FirebaseFileUploaderService {
|
|
3577
|
+
constructor(storage, baseUrl) {
|
|
3578
|
+
this.storage = storage;
|
|
3579
|
+
this.baseUrl = baseUrl;
|
|
3549
3580
|
}
|
|
3550
|
-
async
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
try {
|
|
3554
|
-
const auth$1 = await auth.createUserWithEmailAndPassword(this.firebaseAuth, params.email, params.password);
|
|
3555
|
-
const user = is(auth$1.user);
|
|
3556
|
-
if (!user)
|
|
3557
|
-
throw new Error('User not created');
|
|
3558
|
-
await auth.sendEmailVerification(user);
|
|
3559
|
-
user.id = user.uid;
|
|
3560
|
-
return user;
|
|
3561
|
-
}
|
|
3562
|
-
catch (error) {
|
|
3563
|
-
if (!(error instanceof Error))
|
|
3564
|
-
throw error;
|
|
3565
|
-
const firebaseError = error;
|
|
3566
|
-
if (firebaseError.code === 'auth/email-already-in-use')
|
|
3567
|
-
throw new UserAlreadyRegisteredError('Email already registered');
|
|
3568
|
-
if (firebaseError.code === 'auth/weak-password')
|
|
3569
|
-
throw new WeakPasswordError();
|
|
3570
|
-
throw error;
|
|
3571
|
-
}
|
|
3581
|
+
async upload(path, file) {
|
|
3582
|
+
const storageRef = storage.ref(this.storage, path);
|
|
3583
|
+
return storage.uploadBytes(storageRef, file).then((reference) => `${this.baseUrl}/${reference.ref.bucket}/${reference.ref.fullPath}`);
|
|
3572
3584
|
}
|
|
3573
3585
|
}
|
|
3574
3586
|
|
|
@@ -4595,18 +4607,24 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4595
4607
|
const plainData = this.paramsToPlain({ products });
|
|
4596
4608
|
if (!plainData.products || plainData.products.length <= 0)
|
|
4597
4609
|
return [];
|
|
4610
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
4598
4611
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
4599
4612
|
where: {
|
|
4600
4613
|
type: 'category_product_bool_exp',
|
|
4601
4614
|
required: true,
|
|
4602
|
-
value: {
|
|
4615
|
+
value: {
|
|
4616
|
+
category_id: { _eq: categoryId },
|
|
4617
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
4618
|
+
},
|
|
4603
4619
|
},
|
|
4604
4620
|
});
|
|
4605
4621
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
4606
4622
|
objects: {
|
|
4607
4623
|
type: '[category_product_insert_input!]',
|
|
4608
4624
|
required: true,
|
|
4609
|
-
value: plainData.products
|
|
4625
|
+
value: plainData.products
|
|
4626
|
+
.filter((productId) => !category.products.includes(productId))
|
|
4627
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4610
4628
|
},
|
|
4611
4629
|
});
|
|
4612
4630
|
return plainData.products;
|
|
@@ -4644,15 +4662,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4644
4662
|
},
|
|
4645
4663
|
})
|
|
4646
4664
|
.then((res) => res.data);
|
|
4647
|
-
const currentFiltersId = currentFilters.map((f) => f.
|
|
4665
|
+
const currentFiltersId = currentFilters.map((f) => f.filterId);
|
|
4648
4666
|
const filtersUpdatedId = filters.value.map((f) => f.id);
|
|
4649
4667
|
const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
|
|
4650
4668
|
const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
|
|
4651
4669
|
for (const filter of filterToBeDeleted) {
|
|
4652
4670
|
const index = currentFilters.findIndex((f) => f.id == filter);
|
|
4653
|
-
if (index != -1)
|
|
4671
|
+
if (index != -1)
|
|
4654
4672
|
currentFilters.splice(index, 1);
|
|
4655
|
-
}
|
|
4656
4673
|
await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
|
|
4657
4674
|
}
|
|
4658
4675
|
for (const filter of filterToBeInserted) {
|
|
@@ -5503,6 +5520,10 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5503
5520
|
throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
|
|
5504
5521
|
return data;
|
|
5505
5522
|
}
|
|
5523
|
+
async find(params) {
|
|
5524
|
+
const { filters } = params, rest = tslib_1.__rest(params, ["filters"]);
|
|
5525
|
+
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: exports.Where.EQUALS, value: true } }) }));
|
|
5526
|
+
}
|
|
5506
5527
|
async update(params) {
|
|
5507
5528
|
const { products, id: checkId, metadata, filters } = params, data = tslib_1.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
5508
5529
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
@@ -5561,19 +5582,25 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5561
5582
|
const plainData = this.paramsToPlain({ products });
|
|
5562
5583
|
if (!plainData.products || plainData.products.length <= 0)
|
|
5563
5584
|
return [];
|
|
5585
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5586
|
+
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5564
5587
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5565
5588
|
where: {
|
|
5566
5589
|
type: 'category_product_bool_exp',
|
|
5567
5590
|
required: true,
|
|
5568
|
-
value: {
|
|
5591
|
+
value: {
|
|
5592
|
+
category_id: categoryId,
|
|
5593
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
5594
|
+
},
|
|
5569
5595
|
},
|
|
5570
5596
|
});
|
|
5571
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5572
5597
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5573
5598
|
objects: {
|
|
5574
5599
|
type: '[category_product_insert_input!]',
|
|
5575
5600
|
required: true,
|
|
5576
|
-
value: plainData.products
|
|
5601
|
+
value: plainData.products
|
|
5602
|
+
.filter((productId) => !category.products.includes(productId))
|
|
5603
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5577
5604
|
},
|
|
5578
5605
|
});
|
|
5579
5606
|
return plainData.products;
|
|
@@ -5780,6 +5807,7 @@ exports.Filter = Filter;
|
|
|
5780
5807
|
exports.FilterHasuraGraphQLRepository = FilterHasuraGraphQLRepository;
|
|
5781
5808
|
exports.FilterOption = FilterOption;
|
|
5782
5809
|
exports.FilterOptionHasuraGraphQLRepository = FilterOptionHasuraGraphQLRepository;
|
|
5810
|
+
exports.FirebaseFileUploaderService = FirebaseFileUploaderService;
|
|
5783
5811
|
exports.Home = Home;
|
|
5784
5812
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
5785
5813
|
exports.InvalidArgumentError = InvalidArgumentError;
|