Closed Nightwing52 closed 1 year ago
So for creating stations it makes sense that we would want to have it so that you must provide an ID to a valid station. For PUT statements though it doesn't unless you're updating the station it's attached to. Since we have the @NotNull on the DTO it means that when we update a POI we have to provide the station, same thing for delete, which you mention on Signal.
Why is your preference this as opposed to doing this check in the service layer or making more DTOs? Personally, I think handling the checks in the service layer makes the most sense to me.
Also just as a note here as well since I forgot. The other thing we could do is just choose not to validate certain routes, but I don't really care for that option either.
When preparing the entity for the PointOfInterest we are creating stations. Instead, in the service layer in addPointOfInterest, we should be checking the station id is in the database, and if so, setting the PointOfInterest Station to it. When checking the station id is in the database throw the appropriate exception if needed.