Struggling to implement the following requirements:
As part of the backend process that updates a restaurant’s set of scores, I want to fetch the set of all approved dining reviews belonging to this restaurant.
As an application experience, I want to fetch restaurants that match a given zip code and that also have at least one user-submitted score for a given allergy. I want to see them sorted in descending order.
Essentially I can’t work out how to store/update the restaurant entity when a new review is added?
Hi guys,
I’ve finished my Portfolio project. I’m still in the middle of the final task which is updating the scores of restaurants after the admin approves it. But anyway, it’s still decent in general.
Here is my Github link for the project: GitHub - Peonat2804/codecademy-dining at master
I would highly appreciate any feedback from you guys.
Have a good day.
Hi guys. I need a bit of help with one seemingly easy problem. I am having trouble using Lombok in my project.
The issue is that the necessary annotations provided by Lombok (@Getter, @Setter etc.) aren’t working for me. As a result, I can’t use my getter (or setter) methods in any of the services (example, the registerUser() method in UserService.java) despite using the appropriate Lombok annotations in the User entity. Most, if not all solutions on the Internet suggest to reload the project, but it did not work for me (I am using VSCode as my IDE). You can check out my (unfinished) code in my repo for your convenience. Any kind of feedback/help is appreciated.
Also, thank you @brettjames2525 and @peonat for sharing your repos - they were really helpful in debugging some of the issues I was having.
Alright I know this is really stupid but I cannot seem to figure out how to get the IDE to recognize and run the Spring Initializr directory.
I have installed IntelliJ IDE and downloaded a JDK from the link provided here.
I have also generated a Spring directory according to the instructions–including dependencies: Spring Web, Spring Data JPA, H2 Database, and Lombok.
At this point it is not exactly clear to me how to connect the Spring directory to the IDE. I open the IDE, then what? I have tried: File>Open>Spring Directory. Is this correct? If so, what do I need to do next? I navigated to src>main>java>com>sample>sampleAPI and tried to run the sampleAPIapplication.java file, but to no avail.
Bit late for a reply but might help someone, I was struggling with this as well using the eclipse. Found out I had to download a lombok jar file from Download and add it to my project, that enabled me to get these annotations working correctly
I completed the Dining Review API portfolio project which was fun to do. It took me weeks to complete as I was not coding regularly and I think it’s a great project to finish off the course.
Here’s a link to my project for anyone who would like to review it and give me feedback:
You could use a findById repository method to get all the reviews for a particular restaurant and then use stream and filter got only those that have been approved into a List.
For this I had to annotate the repository method with @Query and within that annotation typed in the SQL query to accomplish the desired results.
One way to do this is to first add the new review, then calculate the averages for each (egg, peanut, dairy) and then update the restaurant’s scores.
(Talking through this just made me realise that I have to make a quick change to my code)
So it seems to me that I am able to do a @post request through my Dining User Controller. Although, there is some good news. I was able to make a query
Hibernate: select d1_0.id,d1_0.city,d1_0.display_name,d1_0.interested_in_dairy_allergies,d1_0.interested_in_egg_allergies,d1_0.interested_in_peanut_allergies,d1_0.state,d1_0.zipcode from dining_users d1_0 where d1_0.display_name=?
I am getting a 404 error. I have added the attachment. What do you think could bt the issue. I possibly have my doubts on the following:
Maybe the application.properties is not set up correctly ?
I maybe missing a particular annotation?
I am using a mySQL database instead of a H2.
I am not using any html pages (using thyme leaf) since the goal is just to get a JSON object in response.
Here is the code snippet that I am using in my command line.