summaryrefslogtreecommitdiff
path: root/app/queries
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-04-04 19:53:27 -0600
committerHombreLaser <sebastian-440@live.com>2023-04-04 19:53:27 -0600
commit72ccdfdf9bbea6269bc1a28199373abd5e8ce302 (patch)
treedf69179a101d71e9fe8ae22753c3bb7a95f8e5e7 /app/queries
parentdb9b4b712271a67e60e6c0bf58c9ce510f177682 (diff)
Añade specs de ReviewsController
Diffstat (limited to 'app/queries')
-rw-r--r--app/queries/reviews/has_user_already_posted_review_query.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/queries/reviews/has_user_already_posted_review_query.rb b/app/queries/reviews/has_user_already_posted_review_query.rb
new file mode 100644
index 0000000..182f12e
--- /dev/null
+++ b/app/queries/reviews/has_user_already_posted_review_query.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal
+
+module Reviews
+ # HasUserAlreadyPostedReviewQuery
+ class HasUserAlreadyPostedReviewQuery
+ def initialize(product)
+ @product = product
+ end
+
+ def review_posted?(user_account_id)
+ ProductReview.find_by(user_account_id:, product_id: @product.id).present?
+ end
+ end
+end