diff --git a/src/main/java/mate/academy/rickandmorty/controller/CharacterController.java b/src/main/java/mate/academy/rickandmorty/controller/CharacterController.java index 080a91c8..27b4d101 100644 --- a/src/main/java/mate/academy/rickandmorty/controller/CharacterController.java +++ b/src/main/java/mate/academy/rickandmorty/controller/CharacterController.java @@ -27,7 +27,7 @@ public CharacterDto getRandomCharacter() { @Operation(summary = "Get list characters", description = "Get list characters by name from db") @GetMapping() - public List getAllByName(@RequestParam String name) { - return service.getAllByName(name); + public List findAllByName(@RequestParam String name) { + return service.findAllByName(name); } } diff --git a/src/main/java/mate/academy/rickandmorty/model/CharacterModel.java b/src/main/java/mate/academy/rickandmorty/model/CharacterModel.java index 9c35f423..af581cee 100644 --- a/src/main/java/mate/academy/rickandmorty/model/CharacterModel.java +++ b/src/main/java/mate/academy/rickandmorty/model/CharacterModel.java @@ -5,9 +5,11 @@ import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.Table; -import lombok.Data; +import lombok.Getter; +import lombok.Setter; -@Data +@Getter +@Setter @Entity @Table(name = "characters") public class CharacterModel { diff --git a/src/main/java/mate/academy/rickandmorty/service/CharacterService.java b/src/main/java/mate/academy/rickandmorty/service/CharacterService.java index 00a1fd01..094a6c4d 100644 --- a/src/main/java/mate/academy/rickandmorty/service/CharacterService.java +++ b/src/main/java/mate/academy/rickandmorty/service/CharacterService.java @@ -7,7 +7,7 @@ public interface CharacterService { CharacterDto getRandomCharacter(); - List getAllByName(String name); + List findAllByName(String name); CharacterDto save(CreateCharacterRequestDto requestDto); } diff --git a/src/main/java/mate/academy/rickandmorty/service/impl/CharacterServiceImpl.java b/src/main/java/mate/academy/rickandmorty/service/impl/CharacterServiceImpl.java index a8734db6..54a45daa 100644 --- a/src/main/java/mate/academy/rickandmorty/service/impl/CharacterServiceImpl.java +++ b/src/main/java/mate/academy/rickandmorty/service/impl/CharacterServiceImpl.java @@ -22,7 +22,7 @@ public CharacterDto getRandomCharacter() { } @Override - public List getAllByName(String name) { + public List findAllByName(String name) { return repository.findAllByNameContainingIgnoreCase(name) .stream() .map(mapper::toDto) diff --git a/src/main/java/mate/academy/rickandmorty/service/impl/CharactersClient.java b/src/main/java/mate/academy/rickandmorty/service/impl/CharactersClient.java index 47aa3f57..a0be0daa 100644 --- a/src/main/java/mate/academy/rickandmorty/service/impl/CharactersClient.java +++ b/src/main/java/mate/academy/rickandmorty/service/impl/CharactersClient.java @@ -41,8 +41,7 @@ private void getListWithExternalApi() { response.body(), CharacterResponseDataDto.class); characterResponseDataDto.results() - .stream().map(createCharacterRequestDto -> - characterService.save(createCharacterRequestDto)) + .stream().map(characterService::save) .toList(); url = characterResponseDataDto.info().next(); } catch (IOException | InterruptedException e) {