Added helper method isOrderDone(). This method uses a query to see if an order between reviewer(buyer) and seller exists. It returns the value of field isSold in the found Order object. The returned boolean value is used in createReview() to create a new review if true. If false an exception will be thrown and notify user that they are not eligible for reviewing the target user.
How to test:
First you need to have an order.
Then you can use the buyer(ratingUserId) and seller(ratedUserId) to create a review.
If you try an order that doesn't exist or where the Order.isSold field is false, you get this response:
Added helper method isOrderDone(). This method uses a query to see if an order between reviewer(buyer) and seller exists. It returns the value of field isSold in the found Order object. The returned boolean value is used in createReview() to create a new review if true. If false an exception will be thrown and notify user that they are not eligible for reviewing the target user.
How to test: First you need to have an order.
Then you can use the buyer(ratingUserId) and seller(ratedUserId) to create a review.![createreview](https://github.com/gholamimohsen/StilGalleriet/assets/144737796/cb015004-4369-4880-bea2-93cc505fc10b)
If you try an order that doesn't exist or where the Order.isSold field is false, you get this response:![createreviewfail](https://github.com/gholamimohsen/StilGalleriet/assets/144737796/1fd042d6-847d-40b6-a634-69a8dee8763c)