Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #145 bad request on GET /api/owners/{id}/pets/{petId} #150

Merged
merged 4 commits into from
Sep 21, 2024

Conversation

arey
Copy link
Member

@arey arey commented Sep 14, 2024

No description provided.

}
Optional<Pet> pet = owner.getPets().stream().filter(p -> p.getId().equals(petId)).findFirst();
Copy link

@firasrg firasrg Sep 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it's better to let logic goes in Service class, so controllers are focused on endpoint input/output. So i suggest to do :

Optional<Pet> target = this.clinicService.findPetByOwner(owner, petId);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better place is the Owner class ;)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright

@arey arey merged commit 072f200 into spring-petclinic:master Sep 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants