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?
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
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)