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

Given DELETE players/{playerID}/games includes if (!playerRepository.existsById(playerId)) on service method #126

Open
plopezgit opened this issue Feb 8, 2024 · 0 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Comments

@plopezgit
Copy link
Owner

plopezgit commented Feb 8, 2024

as creation method does!

it is like (or using simplified ternary):

@Override
public ResponseEntity<Void> deleteGamesBy(int playerId) {
   if (!playerRepository.existsById(playerId)) {
       throw new PlayerNotFoundException("The player does not exists.");
    } else {
    return restTemplate.exchange("http://game-service/games/"+ playerId +"/delete", HttpMethod.DELETE, null, Void.class);

}
}

@plopezgit plopezgit added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Feb 8, 2024
@plopezgit plopezgit self-assigned this Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Development

No branches or pull requests

1 participant