Sunagatov / Iced-Latte

a online Marketplace for coffee retail (Backend)
https://iced-latte.uk
MIT License
587 stars 95 forks source link

Mismatch the data between id product and id user in response body. #314

Open TetianaPerinha opened 3 weeks ago

TetianaPerinha commented 3 weeks ago

Describe the bug When sending a second POST review request from the same user, a message in the response body contains mismatched data in ID product and ID user.

Precondition: The user is registered, the Bearer token is obtained, and the user has already posted a review on a product.

To Reproduce Send the POST request as below, and use a valid Bearer token. curl --location 'https://iced-latte.uk/backend/api/v1/products/3ea8e601-24c9-49b1-8c65-8db8b3a5c7a3/reviews' \ --header 'Content-Type: application/json' \ --header 'Authorization: {token}' \ --data '{ "text":"hjjkkll;;;;;;;", "rating": "5" }'

Expected behavior The system should reject request with 400 HTTP Status code and return the appropriate error message = " Creation of the product's review for the user with userId = '99999999-9999-9999-9999-999999999999' and the product with productId = '3ea8e601-24c9-49b1-8c65-8db8b3a5c7a3' is denied. Delete the previous product's review '00c106c9-fe66-4d4c-ac76-013eec3bcc29' first."

Actual result The system rejects the request with 400 HTTP Status code and error message = "Creation of the product's review for the user with userId = '3ea8e601-24c9-49b1-8c65-8db8b3a5c7a3' and the product with productId = '99999999-9999-9999-9999-999999999999' is denied. Delete the previous product's review '00c106c9-fe66-4d4c-ac76-013eec3bcc29' first."

Comment In the error message instead, userId displayed productId and instead, productId displayed userId.

mismatch id user and id product