@infrab4a/connect 3.4.0-beta.15 → 3.4.0-beta.2
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 +146 -335
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/category.d.ts +2 -3
- package/domain/catalog/models/filter-option.d.ts +1 -1
- package/domain/catalog/models/index.d.ts +0 -1
- package/domain/catalog/models/product.d.ts +0 -1
- package/domain/catalog/models/types/category-filter.type.d.ts +4 -0
- package/domain/catalog/models/types/index.d.ts +1 -0
- package/domain/catalog/repositories/index.d.ts +0 -1
- package/esm2015/domain/catalog/models/category.js +1 -8
- package/esm2015/domain/catalog/models/filter-option.js +1 -1
- package/esm2015/domain/catalog/models/index.js +1 -2
- package/esm2015/domain/catalog/models/product.js +1 -1
- package/esm2015/domain/catalog/models/types/category-filter.type.js +2 -0
- package/esm2015/domain/catalog/models/types/index.js +2 -1
- package/esm2015/domain/catalog/repositories/index.js +1 -2
- package/esm2015/infra/elasticsearch/indexes/products-index.js +2 -3
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +2 -2
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +4 -84
- package/esm2015/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.js +42 -75
- package/esm2015/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.js +29 -3
- package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +1 -2
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +1 -2
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
- package/esm2015/utils/index.js +6 -6
- package/fesm2015/infrab4a-connect.js +83 -208
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +1 -4
- package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +5 -6
- package/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +5 -1
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +0 -1
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +1 -1
- package/package.json +1 -1
- package/utils/index.d.ts +5 -5
- package/domain/catalog/models/category-filter.d.ts +0 -9
- package/domain/catalog/repositories/category-filter.repository.d.ts +0 -5
- package/esm2015/domain/catalog/models/category-filter.js +0 -10
- package/esm2015/domain/catalog/repositories/category-filter.repository.js +0 -2
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.js +0 -24
- package/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +0 -11
|
@@ -4,7 +4,7 @@ import { __decorate, __metadata, __awaiter, __rest } from 'tslib';
|
|
|
4
4
|
import { parseISO } from 'date-fns';
|
|
5
5
|
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
6
6
|
import { isString, isNil, isNumber, isDate, set, isObject, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
7
|
-
export { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
|
|
7
|
+
export { chunk, difference, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
|
|
8
8
|
import { CustomError } from 'ts-custom-error';
|
|
9
9
|
import axios from 'axios';
|
|
10
10
|
import firebase from 'firebase';
|
|
@@ -466,14 +466,14 @@ class Address extends BaseModel {
|
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
+
const isUUID = (value) => isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
|
|
470
|
+
|
|
469
471
|
class Base {
|
|
470
472
|
constructor(...args) {
|
|
471
473
|
Object.assign(this, ...args);
|
|
472
474
|
}
|
|
473
475
|
}
|
|
474
476
|
|
|
475
|
-
const isUUID = (value) => isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
|
|
476
|
-
|
|
477
477
|
const parseDateTime = (value) => {
|
|
478
478
|
if (!isString(value))
|
|
479
479
|
return value;
|
|
@@ -751,15 +751,6 @@ class RecoveryPassword {
|
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
753
|
|
|
754
|
-
class Filter extends BaseModel {
|
|
755
|
-
identifierFields() {
|
|
756
|
-
return ['id'];
|
|
757
|
-
}
|
|
758
|
-
static get identifiersFields() {
|
|
759
|
-
return ['id'];
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
|
|
763
754
|
class Category extends BaseModel {
|
|
764
755
|
identifierFields() {
|
|
765
756
|
return ['id'];
|
|
@@ -767,19 +758,6 @@ class Category extends BaseModel {
|
|
|
767
758
|
static get identifiersFields() {
|
|
768
759
|
return ['id'];
|
|
769
760
|
}
|
|
770
|
-
}
|
|
771
|
-
__decorate([
|
|
772
|
-
Type(() => Filter),
|
|
773
|
-
__metadata("design:type", Array)
|
|
774
|
-
], Category.prototype, "filters", void 0);
|
|
775
|
-
|
|
776
|
-
class CategoryFilter extends BaseModel {
|
|
777
|
-
// identifierFields(): NonFunctionPropertyNames<CategoryFilter>[] {
|
|
778
|
-
// return ['id']
|
|
779
|
-
// }
|
|
780
|
-
static get identifiersFields() {
|
|
781
|
-
return ['id', 'filterId', 'categoryId'];
|
|
782
|
-
}
|
|
783
761
|
}
|
|
784
762
|
|
|
785
763
|
var GenderDestination;
|
|
@@ -797,6 +775,15 @@ var Shops;
|
|
|
797
775
|
Shops["ALL"] = "ALL";
|
|
798
776
|
})(Shops || (Shops = {}));
|
|
799
777
|
|
|
778
|
+
class Filter extends BaseModel {
|
|
779
|
+
identifierFields() {
|
|
780
|
+
return ['id'];
|
|
781
|
+
}
|
|
782
|
+
static get identifiersFields() {
|
|
783
|
+
return ['id'];
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
800
787
|
class FilterOption extends BaseModel {
|
|
801
788
|
identifierFields() {
|
|
802
789
|
return ['id'];
|
|
@@ -1141,9 +1128,8 @@ class ProductsIndex {
|
|
|
1141
1128
|
'stock',
|
|
1142
1129
|
'weight',
|
|
1143
1130
|
'tags',
|
|
1144
|
-
'filters',
|
|
1145
1131
|
'hasVariants',
|
|
1146
|
-
'type'
|
|
1132
|
+
'type'
|
|
1147
1133
|
];
|
|
1148
1134
|
const { hits } = yield this.adapter.query('products/_search', Object.assign({ _source: fields, query: {
|
|
1149
1135
|
bool: {
|
|
@@ -2021,7 +2007,7 @@ class AttributeOptionHelper {
|
|
|
2021
2007
|
}
|
|
2022
2008
|
AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
|
|
2023
2009
|
if (fields.includes(attributeName))
|
|
2024
|
-
return { columnName: attributeName.toString(), attributeName
|
|
2010
|
+
return { columnName: attributeName.toString(), attributeName };
|
|
2025
2011
|
const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
|
|
2026
2012
|
const fieldOption = field === null || field === void 0 ? void 0 : field[attributeName.toString()];
|
|
2027
2013
|
if (isNil(fieldOption))
|
|
@@ -2542,29 +2528,8 @@ class VariantHasuraGraphQL extends Variant {
|
|
|
2542
2528
|
}
|
|
2543
2529
|
}
|
|
2544
2530
|
|
|
2545
|
-
class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2546
|
-
constructor(endpoint, authOptions) {
|
|
2547
|
-
super({
|
|
2548
|
-
tableName: 'category_filter',
|
|
2549
|
-
model: CategoryFilter,
|
|
2550
|
-
endpoint,
|
|
2551
|
-
authOptions,
|
|
2552
|
-
fields: ['id', { filterId: { columnName: 'filter_id' } }, { categoryId: { columnName: 'category_id' } }],
|
|
2553
|
-
});
|
|
2554
|
-
}
|
|
2555
|
-
deleteByCategoryAndFilter(categoryId, filterId) {
|
|
2556
|
-
return this.mutation('delete_category_filter', ['affected_rows'], {
|
|
2557
|
-
where: {
|
|
2558
|
-
type: 'category_filter_bool_exp',
|
|
2559
|
-
required: true,
|
|
2560
|
-
value: { category_id: { _eq: categoryId }, filter_id: { _eq: filterId } },
|
|
2561
|
-
},
|
|
2562
|
-
});
|
|
2563
|
-
}
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
2531
|
class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2567
|
-
constructor(endpoint, authOptions, productRepository
|
|
2532
|
+
constructor(endpoint, authOptions, productRepository) {
|
|
2568
2533
|
super({
|
|
2569
2534
|
tableName: 'category',
|
|
2570
2535
|
model: Category,
|
|
@@ -2600,17 +2565,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2600
2565
|
},
|
|
2601
2566
|
},
|
|
2602
2567
|
},
|
|
2603
|
-
|
|
2604
|
-
filters: {
|
|
2605
|
-
columnName: 'filters',
|
|
2606
|
-
foreignKeyColumn: { filter_id: 'id' },
|
|
2607
|
-
fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
|
|
2608
|
-
bindPersistData: (value) => ({
|
|
2609
|
-
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
2610
|
-
}),
|
|
2611
|
-
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
|
|
2612
|
-
},
|
|
2613
|
-
},
|
|
2568
|
+
'filters',
|
|
2614
2569
|
{ createdAt: { columnName: 'created_at' } },
|
|
2615
2570
|
{ updatedAt: { columnName: 'updated_at' } },
|
|
2616
2571
|
{
|
|
@@ -2635,7 +2590,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2635
2590
|
],
|
|
2636
2591
|
});
|
|
2637
2592
|
this.productRepository = productRepository;
|
|
2638
|
-
this.categoryFilterRepository = categoryFilterRepository;
|
|
2639
2593
|
}
|
|
2640
2594
|
create(params) {
|
|
2641
2595
|
const _super = Object.create(null, {
|
|
@@ -2662,13 +2616,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2662
2616
|
update: { get: () => super.update }
|
|
2663
2617
|
});
|
|
2664
2618
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2665
|
-
const { products, id: checkId, metadata
|
|
2619
|
+
const { products, id: checkId, metadata } = params, data = __rest(params, ["products", "id", "metadata"]);
|
|
2666
2620
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
2667
2621
|
const id = yield this.getId(plainData.id);
|
|
2668
2622
|
const category = yield _super.update.call(this, Object.assign({ id }, data));
|
|
2669
2623
|
category.products = products && (yield this.updateProducts(+id, { products }));
|
|
2670
2624
|
category.metadata = metadata && (yield this.updateMetadata(+id, { metadata }));
|
|
2671
|
-
category.filters = filters && (yield this.updateFilters(+id, { filters }));
|
|
2672
2625
|
return category;
|
|
2673
2626
|
});
|
|
2674
2627
|
}
|
|
@@ -2808,78 +2761,10 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2808
2761
|
return plainData.metadata;
|
|
2809
2762
|
});
|
|
2810
2763
|
}
|
|
2811
|
-
updateFilters(categoryId, { filters }) {
|
|
2812
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2813
|
-
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
2814
|
-
for (let i = 0; i < filters.value.length; i++) {
|
|
2815
|
-
yield this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id);
|
|
2816
|
-
}
|
|
2817
|
-
return [];
|
|
2818
|
-
}
|
|
2819
|
-
if ('action' in filters && filters.action === 'merge' && filters.value.length) {
|
|
2820
|
-
let filtersList = [];
|
|
2821
|
-
for (let i = 0; i < filters.value.length; i++) {
|
|
2822
|
-
try {
|
|
2823
|
-
const hasFilter = yield this.categoryFilterRepository
|
|
2824
|
-
.find({
|
|
2825
|
-
filters: {
|
|
2826
|
-
categoryId,
|
|
2827
|
-
filterId: filters.value[i].id,
|
|
2828
|
-
},
|
|
2829
|
-
})
|
|
2830
|
-
.then((data) => data.data.shift());
|
|
2831
|
-
if (hasFilter) {
|
|
2832
|
-
filtersList.push(hasFilter);
|
|
2833
|
-
}
|
|
2834
|
-
else {
|
|
2835
|
-
const newCategoryFilter = yield this.categoryFilterRepository.create({
|
|
2836
|
-
filterId: filters.value[i].id,
|
|
2837
|
-
categoryId,
|
|
2838
|
-
});
|
|
2839
|
-
filtersList.push(newCategoryFilter);
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
catch (error) {
|
|
2843
|
-
console.log('catch error: ', error);
|
|
2844
|
-
}
|
|
2845
|
-
}
|
|
2846
|
-
return filtersList;
|
|
2847
|
-
}
|
|
2848
|
-
if (Array.isArray(filters) && filters.length) {
|
|
2849
|
-
let filtersList = [];
|
|
2850
|
-
for (let i = 0; i < filters.length; i++) {
|
|
2851
|
-
try {
|
|
2852
|
-
const hasFilter = yield this.categoryFilterRepository
|
|
2853
|
-
.find({
|
|
2854
|
-
filters: {
|
|
2855
|
-
categoryId,
|
|
2856
|
-
filterId: filters[i].id,
|
|
2857
|
-
},
|
|
2858
|
-
})
|
|
2859
|
-
.then((data) => data.data.shift());
|
|
2860
|
-
if (hasFilter) {
|
|
2861
|
-
filtersList.push(hasFilter);
|
|
2862
|
-
}
|
|
2863
|
-
else {
|
|
2864
|
-
const newCategoryFilter = yield this.categoryFilterRepository.create({
|
|
2865
|
-
filterId: filters[i].id,
|
|
2866
|
-
categoryId,
|
|
2867
|
-
});
|
|
2868
|
-
filtersList.push(newCategoryFilter);
|
|
2869
|
-
}
|
|
2870
|
-
}
|
|
2871
|
-
catch (error) {
|
|
2872
|
-
console.log('catch error: ', error);
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
return filtersList;
|
|
2876
|
-
}
|
|
2877
|
-
});
|
|
2878
|
-
}
|
|
2879
2764
|
}
|
|
2880
2765
|
|
|
2881
2766
|
class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2882
|
-
constructor(endpoint, authOptions, filterOptionRepository
|
|
2767
|
+
constructor(endpoint, authOptions, filterOptionRepository) {
|
|
2883
2768
|
super({
|
|
2884
2769
|
tableName: 'filter',
|
|
2885
2770
|
model: Filter,
|
|
@@ -2888,7 +2773,6 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
2888
2773
|
fields: [
|
|
2889
2774
|
'id',
|
|
2890
2775
|
'description',
|
|
2891
|
-
'slug',
|
|
2892
2776
|
'enabled',
|
|
2893
2777
|
{ createdAt: { columnName: 'created_at' } },
|
|
2894
2778
|
{ updatedAt: { columnName: 'updated_at' } },
|
|
@@ -2896,19 +2780,41 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
2896
2780
|
options: {
|
|
2897
2781
|
columnName: 'options',
|
|
2898
2782
|
foreignKeyColumn: { filterId: 'id' },
|
|
2899
|
-
fields: [
|
|
2900
|
-
'id',
|
|
2901
|
-
{ filterId: { columnName: 'filter_id' } },
|
|
2902
|
-
'description',
|
|
2903
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
2904
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
2905
|
-
],
|
|
2783
|
+
fields: ['id', { filterId: { columnName: 'filter_id' } }, 'description', 'createdAt', 'updatedAt'],
|
|
2906
2784
|
},
|
|
2907
2785
|
},
|
|
2908
2786
|
],
|
|
2909
2787
|
});
|
|
2910
2788
|
this.filterOptionRepository = filterOptionRepository;
|
|
2911
|
-
|
|
2789
|
+
}
|
|
2790
|
+
get(identifiers) {
|
|
2791
|
+
const _super = Object.create(null, {
|
|
2792
|
+
get: { get: () => super.get }
|
|
2793
|
+
});
|
|
2794
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2795
|
+
const filter = yield _super.get.call(this, identifiers);
|
|
2796
|
+
if (!filter)
|
|
2797
|
+
throw new NotFoundError('Filter not found');
|
|
2798
|
+
return filter;
|
|
2799
|
+
});
|
|
2800
|
+
}
|
|
2801
|
+
find(options) {
|
|
2802
|
+
const _super = Object.create(null, {
|
|
2803
|
+
find: { get: () => super.find }
|
|
2804
|
+
});
|
|
2805
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2806
|
+
const filter = yield _super.find.call(this, options);
|
|
2807
|
+
return filter;
|
|
2808
|
+
});
|
|
2809
|
+
}
|
|
2810
|
+
create(params) {
|
|
2811
|
+
const _super = Object.create(null, {
|
|
2812
|
+
create: { get: () => super.create }
|
|
2813
|
+
});
|
|
2814
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2815
|
+
const filter = yield _super.create.call(this, params);
|
|
2816
|
+
return filter;
|
|
2817
|
+
});
|
|
2912
2818
|
}
|
|
2913
2819
|
update(params) {
|
|
2914
2820
|
const _super = Object.create(null, {
|
|
@@ -2925,80 +2831,25 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
2925
2831
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2926
2832
|
if (!options)
|
|
2927
2833
|
return [];
|
|
2928
|
-
if ('action' in options && options.action === 'remove'
|
|
2834
|
+
if ('action' in options && options.action === 'remove') {
|
|
2929
2835
|
for (let i = 0; i < options.value.length; i++) {
|
|
2930
2836
|
yield this.filterOptionRepository.delete({ id: options.value[i].id });
|
|
2931
2837
|
}
|
|
2932
2838
|
return [];
|
|
2933
2839
|
}
|
|
2934
|
-
if ('action' in options && options.action === '
|
|
2840
|
+
if ('action' in options && options.action === 'update') {
|
|
2935
2841
|
let filterOptions = [];
|
|
2936
2842
|
for (let i = 0; i < options.value.length; i++) {
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
filterOptions.push(hasFilter);
|
|
2941
|
-
}
|
|
2942
|
-
catch (error) {
|
|
2943
|
-
const newOption = yield this.filterOptionRepository.create(Object.assign(Object.assign({}, options.value[i]), { filterId }));
|
|
2843
|
+
const hasFilter = yield this.filterOptionRepository.get({ id: options.value[i].id });
|
|
2844
|
+
if (!hasFilter) {
|
|
2845
|
+
const newOption = yield this.filterOptionRepository.create(options.value[i]);
|
|
2944
2846
|
filterOptions.push(newOption);
|
|
2945
2847
|
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
}
|
|
2949
|
-
if (Array.isArray(options) && options.length) {
|
|
2950
|
-
let filterOptions = [];
|
|
2951
|
-
for (let i = 0; i < options.length; i++) {
|
|
2952
|
-
try {
|
|
2953
|
-
const hasFilter = yield this.filterOptionRepository.get({ id: options[i].id });
|
|
2954
|
-
if (hasFilter)
|
|
2955
|
-
filterOptions.push(hasFilter);
|
|
2956
|
-
}
|
|
2957
|
-
catch (error) {
|
|
2958
|
-
const newOption = yield this.filterOptionRepository.create(Object.assign(Object.assign({}, options[i]), { filterId }));
|
|
2959
|
-
filterOptions.push(newOption);
|
|
2848
|
+
else {
|
|
2849
|
+
filterOptions.push(hasFilter);
|
|
2960
2850
|
}
|
|
2961
2851
|
}
|
|
2962
|
-
|
|
2963
|
-
return [];
|
|
2964
|
-
});
|
|
2965
|
-
}
|
|
2966
|
-
delete(params) {
|
|
2967
|
-
const _super = Object.create(null, {
|
|
2968
|
-
delete: { get: () => super.delete }
|
|
2969
|
-
});
|
|
2970
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2971
|
-
const data = params;
|
|
2972
|
-
const categoryFilters = yield this.categoryFilterRepository
|
|
2973
|
-
.find({
|
|
2974
|
-
filters: {
|
|
2975
|
-
filterId: +data.id,
|
|
2976
|
-
},
|
|
2977
|
-
})
|
|
2978
|
-
.then((result) => result.data);
|
|
2979
|
-
if (categoryFilters.length)
|
|
2980
|
-
throw new Error('O filtro está associado a uma ou mais categoria(s)');
|
|
2981
|
-
const options = yield this.filterOptionRepository
|
|
2982
|
-
.find({
|
|
2983
|
-
filters: {
|
|
2984
|
-
filterId: +data.id,
|
|
2985
|
-
},
|
|
2986
|
-
})
|
|
2987
|
-
.then((data) => data.data);
|
|
2988
|
-
yield this.deleteOptions(options);
|
|
2989
|
-
yield _super.delete.call(this, { id: +data.id });
|
|
2990
|
-
return;
|
|
2991
|
-
});
|
|
2992
|
-
}
|
|
2993
|
-
deleteOptions(options) {
|
|
2994
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2995
|
-
for (let i = 0; i < options.length; i++) {
|
|
2996
|
-
try {
|
|
2997
|
-
yield this.filterOptionRepository.delete({ id: options[i].id });
|
|
2998
|
-
}
|
|
2999
|
-
catch (error) {
|
|
3000
|
-
console.log(error);
|
|
3001
|
-
}
|
|
2852
|
+
return filterOptions;
|
|
3002
2853
|
}
|
|
3003
2854
|
});
|
|
3004
2855
|
}
|
|
@@ -3007,7 +2858,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
3007
2858
|
class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
3008
2859
|
constructor(endpoint, authOptions) {
|
|
3009
2860
|
super({
|
|
3010
|
-
tableName: '
|
|
2861
|
+
tableName: 'filter-option',
|
|
3011
2862
|
model: FilterOption,
|
|
3012
2863
|
endpoint,
|
|
3013
2864
|
authOptions,
|
|
@@ -3020,6 +2871,31 @@ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasu
|
|
|
3020
2871
|
],
|
|
3021
2872
|
});
|
|
3022
2873
|
}
|
|
2874
|
+
create(params) {
|
|
2875
|
+
return super.create(params);
|
|
2876
|
+
}
|
|
2877
|
+
find(options) {
|
|
2878
|
+
const _super = Object.create(null, {
|
|
2879
|
+
find: { get: () => super.find }
|
|
2880
|
+
});
|
|
2881
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2882
|
+
const filterOptions = yield _super.find.call(this, options);
|
|
2883
|
+
return filterOptions;
|
|
2884
|
+
});
|
|
2885
|
+
}
|
|
2886
|
+
delete(identifiers) {
|
|
2887
|
+
return super.delete(identifiers);
|
|
2888
|
+
}
|
|
2889
|
+
findByFilter(filterId) {
|
|
2890
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2891
|
+
const options = yield this.find({
|
|
2892
|
+
filters: {
|
|
2893
|
+
filterId,
|
|
2894
|
+
},
|
|
2895
|
+
});
|
|
2896
|
+
return options;
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
3023
2899
|
}
|
|
3024
2900
|
|
|
3025
2901
|
class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -3125,7 +3001,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3125
3001
|
'weight',
|
|
3126
3002
|
'gender',
|
|
3127
3003
|
{ tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
|
|
3128
|
-
{ filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
|
|
3129
3004
|
{ isKit: { columnName: 'is_kit' } },
|
|
3130
3005
|
{ createdAt: { columnName: 'created_at' } },
|
|
3131
3006
|
{ updatedAt: { columnName: 'updated_at' } },
|
|
@@ -3591,5 +3466,5 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3591
3466
|
* Generated bundle index. Do not edit.
|
|
3592
3467
|
*/
|
|
3593
3468
|
|
|
3594
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category,
|
|
3469
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
3595
3470
|
//# sourceMappingURL=infrab4a-connect.js.map
|