amer-sabah / bookshelf

0 stars 5 forks source link

AS a customer, I should be able to rate my purchased/borrowed books #25

Closed Leenaiman98 closed 2 years ago

Leenaiman98 commented 3 years ago

Rating(book_id , Library_id , customer_id , rate , feedback)

AsemLab commented 2 years ago

Please review your code, because when I click rate it raise an error with the message Required int parameter 'book_id' is not present

Leenaiman98 commented 2 years ago

@AsemLab I will check it know!!

NOTE: I use random ID's because the rate button place not specified yet in the UI

Leenaiman98 commented 2 years ago

@AsemLab
I just realized that I upload wrong controller. Correct one has been Uploaded GO AHEAD!!

AsemLab commented 2 years ago

@Leenaiman98 Theres 2 bugs in your code:

  1. In BookRatingPK class : customerId must be customer_id & bookId must be book_id.

  2. In BooksRatingController the rate field accept negative and zero numbers.

Please, fix these bugs and update your code

Leenaiman98 commented 2 years ago

DONE!! Thanks for good notes ...

AsemLab commented 2 years ago

@Leenaiman98 In BookRatingPK class : customerId must be customer_id

and check the book_ratings schema in MySql:

CREATE TABLE book_ratings( customer_id INT NOT NULL, book_id INT NOT NULL, rate INT DEFAULT 0, feedback VARCHAR(30) DEFAULT NULL, PRIMARY KEY(customer_id,book_id), FOREIGN KEY (customer_id) REFERENCES persons (person_id) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (book_id) REFERENCES books (book_id) ON DELETE CASCADE ON UPDATE CASCADE );

There is no person_id column

AsemLab commented 2 years ago

@Leenaiman98

Well done!

The rating feature is working successfully, I will close this issue.