@infrab4a/connect 3.2.0-beta.2 → 3.2.1

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.
@@ -4543,13 +4543,13 @@
4543
4543
  if (review.id)
4544
4544
  return [2 /*return*/, review];
4545
4545
  if (!review.personId) return [3 /*break*/, 2];
4546
- return [4 /*yield*/, this.getReviewByPersonId(review.personId, productId)];
4546
+ return [4 /*yield*/, this.getReviewByPersonId(review.personId, productId, review.orderId)];
4547
4547
  case 1:
4548
4548
  loadedReview = _c.sent();
4549
4549
  _c.label = 2;
4550
4550
  case 2:
4551
4551
  if (!(!loadedReview && review.author && review.email)) return [3 /*break*/, 4];
4552
- return [4 /*yield*/, this.getReviewByAuthorAndEmail(review.author, review.email, productId)];
4552
+ return [4 /*yield*/, this.getReviewByAuthorAndEmail(review.author, review.email, productId, review.orderId)];
4553
4553
  case 3:
4554
4554
  loadedReview = _c.sent();
4555
4555
  _c.label = 4;
@@ -4558,17 +4558,14 @@
4558
4558
  });
4559
4559
  });
4560
4560
  };
4561
- ProductHasuraGraphQLRepository.prototype.getReviewByPersonId = function (personId, productId) {
4561
+ ProductHasuraGraphQLRepository.prototype.getReviewByPersonId = function (personId, productId, orderId) {
4562
4562
  return __awaiter(this, void 0, void 0, function () {
4563
4563
  var data;
4564
4564
  return __generator(this, function (_c) {
4565
4565
  switch (_c.label) {
4566
4566
  case 0: return [4 /*yield*/, this.query('product_review', this.reviewsFields, {
4567
4567
  where: {
4568
- value: {
4569
- product_id: { _eq: productId },
4570
- person_id: { _eq: personId },
4571
- },
4568
+ value: Object.assign({ product_id: { _eq: productId }, person_id: { _eq: personId } }, (orderId && { order_id: { _eq: orderId } })),
4572
4569
  type: "product_review_bool_exp",
4573
4570
  required: true,
4574
4571
  },
@@ -4580,18 +4577,14 @@
4580
4577
  });
4581
4578
  });
4582
4579
  };
4583
- ProductHasuraGraphQLRepository.prototype.getReviewByAuthorAndEmail = function (author, email, productId) {
4580
+ ProductHasuraGraphQLRepository.prototype.getReviewByAuthorAndEmail = function (author, email, productId, orderId) {
4584
4581
  return __awaiter(this, void 0, void 0, function () {
4585
4582
  var data;
4586
4583
  return __generator(this, function (_c) {
4587
4584
  switch (_c.label) {
4588
4585
  case 0: return [4 /*yield*/, this.query('product_review', this.reviewsFields, {
4589
4586
  where: {
4590
- value: {
4591
- product_id: { _eq: productId },
4592
- author: { _eq: author },
4593
- email: { _eq: email },
4594
- },
4587
+ value: Object.assign({ product_id: { _eq: productId }, author: { _eq: author }, email: { _eq: email } }, (orderId && { order_id: { _eq: orderId } })),
4595
4588
  type: "product_review_bool_exp",
4596
4589
  required: true,
4597
4590
  },