Closed KasperDemeyere closed 2 years ago
Within this issue we probably want to close #94. Rewriting what we have now has high prio.
This issue should also make #77 obsolete, since PATCH will be handled by data-REST.
Ok, so i locally tried some stuff and did a some research. So I definitely like the approach as it saves a lot of time.
Here are some usefull links:
The first one is just a simple entity without relations. But it's good to understand what it can do. The second one is the one that goes deeper in on relationships and how they work.
Further I came across this. It's a small page which shows what is capable. I would definitely recommend using a JpaRepository as this is an extension of a CrudRepository. The Jpa one also makes it so that pagination and sorting is done easily for you. Furthermore, it shows a small example where you can define a function in the repository and you can use the function for a search on a field of an entity, this can also be very usefull for searching students or users.
Making a field not updatable and updating it returns a status 200 code. I found a discussion that talks about this https://github.com/spring-projects/spring-data-rest/issues/905.
I will close this issue. I thank the whole team for helping out. I think we did a great thing here.
In order to make the api more RESTFULL we should switch to using Spring data REST. This will allow the api to automatically handle links in POST/PATCH/PUT requests, and to return subresources as links in GET requests. Documentation about this can be found here: https://docs.spring.io/spring-data/rest/docs/current/reference/html/#intro-chapter