@infrab4a/connect 4.0.0-beta.40 → 4.0.0-beta.41
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/domain/catalog/models/category-filter.d.ts +2 -0
- package/domain/catalog/models/category.d.ts +2 -0
- package/esm2020/domain/catalog/models/category-filter.mjs +6 -1
- package/esm2020/domain/catalog/models/category.mjs +6 -1
- package/esm2020/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.mjs +2 -2
- package/esm2020/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.mjs +43 -1
- package/fesm2015/infrab4a-connect.mjs +97 -47
- package/fesm2015/infrab4a-connect.mjs.map +1 -1
- package/fesm2020/infrab4a-connect.mjs +97 -47
- package/fesm2020/infrab4a-connect.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1202,6 +1202,52 @@ class Filter extends BaseModel {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
1205
|
+
class KitProduct extends BaseModel {
|
|
1206
|
+
static get identifiersFields() {
|
|
1207
|
+
return ['productId', 'kitProductId'];
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
__decorate([
|
|
1211
|
+
Type(() => Product),
|
|
1212
|
+
__metadata("design:type", Product)
|
|
1213
|
+
], KitProduct.prototype, "kit", void 0);
|
|
1214
|
+
__decorate([
|
|
1215
|
+
Type(() => Product),
|
|
1216
|
+
__metadata("design:type", Product)
|
|
1217
|
+
], KitProduct.prototype, "product", void 0);
|
|
1218
|
+
|
|
1219
|
+
class Product extends BaseModel {
|
|
1220
|
+
get evaluation() {
|
|
1221
|
+
return {
|
|
1222
|
+
reviews: this.reviews,
|
|
1223
|
+
count: this.reviewsTotal,
|
|
1224
|
+
rating: this.rate,
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
set evaluation(evaluation) {
|
|
1228
|
+
if (!evaluation) {
|
|
1229
|
+
this.reviews = null;
|
|
1230
|
+
this.reviewsTotal = null;
|
|
1231
|
+
this.rate = null;
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
this.reviews = evaluation.reviews || this.reviews;
|
|
1235
|
+
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
1236
|
+
this.rate = evaluation.rating || this.rate;
|
|
1237
|
+
}
|
|
1238
|
+
static get identifiersFields() {
|
|
1239
|
+
return ['id'];
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
__decorate([
|
|
1243
|
+
Type(() => Category),
|
|
1244
|
+
__metadata("design:type", Category)
|
|
1245
|
+
], Product.prototype, "category", void 0);
|
|
1246
|
+
__decorate([
|
|
1247
|
+
Type(() => KitProduct),
|
|
1248
|
+
__metadata("design:type", Array)
|
|
1249
|
+
], Product.prototype, "kitProducts", void 0);
|
|
1250
|
+
|
|
1205
1251
|
class Category extends BaseModel {
|
|
1206
1252
|
static get identifiersFields() {
|
|
1207
1253
|
return ['id'];
|
|
@@ -1215,6 +1261,10 @@ __decorate([
|
|
|
1215
1261
|
Type(() => Filter),
|
|
1216
1262
|
__metadata("design:type", Array)
|
|
1217
1263
|
], Category.prototype, "filters", void 0);
|
|
1264
|
+
__decorate([
|
|
1265
|
+
Type(() => Product),
|
|
1266
|
+
__metadata("design:type", Array)
|
|
1267
|
+
], Category.prototype, "childrenProducts", void 0);
|
|
1218
1268
|
|
|
1219
1269
|
class CategoryCollectionChildren extends BaseModel {
|
|
1220
1270
|
static get identifiersFields() {
|
|
@@ -1235,6 +1285,10 @@ __decorate([
|
|
|
1235
1285
|
Type(() => Filter),
|
|
1236
1286
|
__metadata("design:type", Filter)
|
|
1237
1287
|
], CategoryFilter.prototype, "filter", void 0);
|
|
1288
|
+
__decorate([
|
|
1289
|
+
Type(() => Category),
|
|
1290
|
+
__metadata("design:type", Category)
|
|
1291
|
+
], CategoryFilter.prototype, "category", void 0);
|
|
1238
1292
|
|
|
1239
1293
|
var GenderDestination;
|
|
1240
1294
|
(function (GenderDestination) {
|
|
@@ -1257,52 +1311,6 @@ class FilterOption extends BaseModel {
|
|
|
1257
1311
|
}
|
|
1258
1312
|
}
|
|
1259
1313
|
|
|
1260
|
-
class Product extends BaseModel {
|
|
1261
|
-
get evaluation() {
|
|
1262
|
-
return {
|
|
1263
|
-
reviews: this.reviews,
|
|
1264
|
-
count: this.reviewsTotal,
|
|
1265
|
-
rating: this.rate,
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
|
-
set evaluation(evaluation) {
|
|
1269
|
-
if (!evaluation) {
|
|
1270
|
-
this.reviews = null;
|
|
1271
|
-
this.reviewsTotal = null;
|
|
1272
|
-
this.rate = null;
|
|
1273
|
-
return;
|
|
1274
|
-
}
|
|
1275
|
-
this.reviews = evaluation.reviews || this.reviews;
|
|
1276
|
-
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
1277
|
-
this.rate = evaluation.rating || this.rate;
|
|
1278
|
-
}
|
|
1279
|
-
static get identifiersFields() {
|
|
1280
|
-
return ['id'];
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
__decorate([
|
|
1284
|
-
Type(() => Category),
|
|
1285
|
-
__metadata("design:type", Category)
|
|
1286
|
-
], Product.prototype, "category", void 0);
|
|
1287
|
-
__decorate([
|
|
1288
|
-
Type(() => KitProduct),
|
|
1289
|
-
__metadata("design:type", Array)
|
|
1290
|
-
], Product.prototype, "kitProducts", void 0);
|
|
1291
|
-
|
|
1292
|
-
class KitProduct extends BaseModel {
|
|
1293
|
-
static get identifiersFields() {
|
|
1294
|
-
return ['productId', 'kitProductId'];
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
__decorate([
|
|
1298
|
-
Type(() => Product),
|
|
1299
|
-
__metadata("design:type", Product)
|
|
1300
|
-
], KitProduct.prototype, "kit", void 0);
|
|
1301
|
-
__decorate([
|
|
1302
|
-
Type(() => Product),
|
|
1303
|
-
__metadata("design:type", Product)
|
|
1304
|
-
], KitProduct.prototype, "product", void 0);
|
|
1305
|
-
|
|
1306
1314
|
class Variant extends BaseModel {
|
|
1307
1315
|
static get identifiersFields() {
|
|
1308
1316
|
return ['id', 'productId'];
|
|
@@ -2752,7 +2760,7 @@ BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
|
|
|
2752
2760
|
const columnFields = fieldOptions.fields;
|
|
2753
2761
|
return {
|
|
2754
2762
|
...variables,
|
|
2755
|
-
[columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), columnFields ||
|
|
2763
|
+
[columnName]: BindFilterQueryHelper.BuildWhereSentence(key, is(is(options)[key]), fieldSentenceOptions?.fields || columnFields || fields),
|
|
2756
2764
|
};
|
|
2757
2765
|
}, {});
|
|
2758
2766
|
if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
|
|
@@ -3389,6 +3397,48 @@ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
3389
3397
|
],
|
|
3390
3398
|
},
|
|
3391
3399
|
},
|
|
3400
|
+
{
|
|
3401
|
+
category: {
|
|
3402
|
+
columnName: 'category',
|
|
3403
|
+
foreignKeyColumn: { id: 'categoryId' },
|
|
3404
|
+
fields: [
|
|
3405
|
+
'id',
|
|
3406
|
+
'description',
|
|
3407
|
+
{
|
|
3408
|
+
products: {
|
|
3409
|
+
columnName: 'products',
|
|
3410
|
+
fields: ['product_id'],
|
|
3411
|
+
from: (value) => value.map((product) => product.product_id.toString()),
|
|
3412
|
+
to: (productIds) => productIds.map((productId) => ({
|
|
3413
|
+
product_id: +productId,
|
|
3414
|
+
})),
|
|
3415
|
+
},
|
|
3416
|
+
},
|
|
3417
|
+
{
|
|
3418
|
+
childrenProducts: {
|
|
3419
|
+
columnName: 'children_products',
|
|
3420
|
+
foreignKeyColumn: { category_id: 'id' },
|
|
3421
|
+
fields: [
|
|
3422
|
+
'id',
|
|
3423
|
+
'name',
|
|
3424
|
+
'slug',
|
|
3425
|
+
{
|
|
3426
|
+
categories: {
|
|
3427
|
+
columnName: 'categories',
|
|
3428
|
+
fields: ['category_id'],
|
|
3429
|
+
bindPersistData: (value) => ({
|
|
3430
|
+
categories: { data: value.map((category) => ({ category_id: +category })) },
|
|
3431
|
+
}),
|
|
3432
|
+
to: (categories) => categories.map((categoryId) => +categoryId),
|
|
3433
|
+
from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
|
|
3434
|
+
},
|
|
3435
|
+
},
|
|
3436
|
+
],
|
|
3437
|
+
},
|
|
3438
|
+
},
|
|
3439
|
+
],
|
|
3440
|
+
},
|
|
3441
|
+
},
|
|
3392
3442
|
],
|
|
3393
3443
|
});
|
|
3394
3444
|
}
|