@infrab4a/connect-angular 5.4.0-alpha.1 → 5.4.0-alpha.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/esm2020/services/order-product-review.service.mjs +21 -51
- package/esm2020/services/types/pending-product-review.type.mjs +1 -1
- package/fesm2015/infrab4a-connect-angular.mjs +20 -54
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +20 -50
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/services/order-product-review.service.d.ts +2 -5
- package/services/types/pending-product-review.type.d.ts +0 -3
|
@@ -2984,77 +2984,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2984
2984
|
}], ctorParameters: function () { return [{ type: HomeShopRepositoriesFacade }, { type: ConfigurationFacade }]; } });
|
|
2985
2985
|
|
|
2986
2986
|
class OrderProductReviewService {
|
|
2987
|
-
constructor(orderRepository, productReviewRepository
|
|
2987
|
+
constructor(orderRepository, productReviewRepository) {
|
|
2988
2988
|
this.orderRepository = orderRepository;
|
|
2989
2989
|
this.productReviewRepository = productReviewRepository;
|
|
2990
|
-
this.variantRepository = variantRepository;
|
|
2991
2990
|
}
|
|
2992
2991
|
async getPendingReviewsByEmail(email) {
|
|
2993
2992
|
const products = [];
|
|
2994
|
-
const orders = await this.getOrdersByEmail(email);
|
|
2995
|
-
if (orders.length) {
|
|
2996
|
-
for (const order of orders) {
|
|
2997
|
-
const lineItems = order.lineItems.filter((item) => !item.isGift);
|
|
2998
|
-
for (const item of lineItems) {
|
|
2999
|
-
const productReview = await this.getProductReview(order, item);
|
|
3000
|
-
if (productReview?.status != null)
|
|
3001
|
-
continue;
|
|
3002
|
-
products.push(this.buildProductReview(order, item, productReview));
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
return products;
|
|
3007
|
-
}
|
|
3008
|
-
async getOrdersByEmail(email) {
|
|
3009
2993
|
const { data: orders } = await this.orderRepository.find({
|
|
3010
2994
|
filters: {
|
|
3011
2995
|
user: {
|
|
3012
2996
|
email: email,
|
|
3013
2997
|
},
|
|
3014
2998
|
status: OrderStatus.ENTREGUE,
|
|
3015
|
-
createdAt: {
|
|
3016
|
-
operator: Where.GTE,
|
|
3017
|
-
value: new Date(2024, 0, 0, 0, 0, 0).getTime(),
|
|
3018
|
-
},
|
|
3019
2999
|
},
|
|
3020
3000
|
orderBy: {
|
|
3021
3001
|
createdAt: 'desc',
|
|
3022
3002
|
},
|
|
3023
3003
|
});
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
},
|
|
3043
|
-
})
|
|
3044
|
-
.then((res) => res.data.at(0));
|
|
3045
|
-
return productReview;
|
|
3004
|
+
if (orders.length) {
|
|
3005
|
+
for (const order of orders) {
|
|
3006
|
+
const lineItems = order.lineItems.filter((item) => !item.isGift);
|
|
3007
|
+
for (const item of lineItems) {
|
|
3008
|
+
const productReview = await this.productReviewRepository
|
|
3009
|
+
.find({
|
|
3010
|
+
filters: {
|
|
3011
|
+
orderId: order.id,
|
|
3012
|
+
productId: item.id,
|
|
3013
|
+
status: { operator: Where.ISNULL },
|
|
3014
|
+
},
|
|
3015
|
+
})
|
|
3016
|
+
.then((res) => res.data.at(0));
|
|
3017
|
+
products.push(this.buildProductReview(order, item, productReview));
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
return products;
|
|
3046
3022
|
}
|
|
3047
3023
|
buildProductReview(order, item, review) {
|
|
3048
3024
|
return {
|
|
3049
3025
|
id: item.id,
|
|
3050
|
-
orderId: order.id,
|
|
3051
|
-
orderNumber: order.orderNumber,
|
|
3052
3026
|
isEdition: false,
|
|
3053
3027
|
name: item.name,
|
|
3054
3028
|
image: item.image,
|
|
3055
3029
|
deliveryDate: order.deliveredAt || null,
|
|
3056
3030
|
evaluationInAnalysis: review ? true : false,
|
|
3057
|
-
rating: review ? review.rate : null,
|
|
3058
3031
|
shopProductSlug: item.slug,
|
|
3059
3032
|
};
|
|
3060
3033
|
}
|
|
@@ -3074,7 +3047,7 @@ class OrderProductReviewService {
|
|
|
3074
3047
|
}));
|
|
3075
3048
|
}
|
|
3076
3049
|
}
|
|
3077
|
-
OrderProductReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, deps: [{ token: 'OrderRepository' }, { token: 'ProductReviewRepository' }
|
|
3050
|
+
OrderProductReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, deps: [{ token: 'OrderRepository' }, { token: 'ProductReviewRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3078
3051
|
OrderProductReviewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService });
|
|
3079
3052
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, decorators: [{
|
|
3080
3053
|
type: Injectable
|
|
@@ -3084,9 +3057,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
3084
3057
|
}] }, { type: undefined, decorators: [{
|
|
3085
3058
|
type: Inject,
|
|
3086
3059
|
args: ['ProductReviewRepository']
|
|
3087
|
-
}] }, { type: undefined, decorators: [{
|
|
3088
|
-
type: Inject,
|
|
3089
|
-
args: ['VariantRepository']
|
|
3090
3060
|
}] }]; } });
|
|
3091
3061
|
|
|
3092
3062
|
class OrderService {
|