-
Notifications
You must be signed in to change notification settings - Fork 237
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
Jv rick and morty impl #194
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, but significant improvements is required
public class Application { | ||
@RequiredArgsConstructor | ||
public class Application implements CommandLineRunner { | ||
private static final String RICK_AND_MORTY_API_CHARACTER_URL = "https://rickandmortyapi.com/api/character"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter should be configurable (in application properties), not hardcoded
spring.datasource.username=root | ||
spring.datasource.password=henghfdf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don`t push credentials to github
|
||
spring.jpa.hibernate.ddl-auto=validate | ||
spring.jpa.show-sql=true | ||
spring.jpa.open-in-view=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing empty line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May you explain me why is it matter?
E:\Java_projects\jv-rick-and-morty\src\main\java\mate\academy\rickandmorty\dto\external\CharacterFullResponseDto.java | ||
E:\Java_projects\jv-rick-and-morty\src\main\java\mate\academy\rickandmorty\dto\external\CharacterResponseDto.java | ||
E:\Java_projects\jv-rick-and-morty\src\main\java\mate\academy\rickandmorty\dto\external\CharacterMetadataDto.java | ||
E:\Java_projects\jv-rick-and-morty\src\main\java\mate\academy\rickandmorty\dto\internal\CharacterSearchParametersDto.java | ||
E:\Java_projects\jv-rick-and-morty\src\main\java\mate\academy\rickandmorty\controler\CharacterController.java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that this file should be on git?
mate\academy\rickandmorty\models\Character.class | ||
mate\academy\rickandmorty\dto\internal\CharacterDto.class | ||
mate\academy\rickandmorty\external\api\service\impl\ExternalCharacterServiceImpl.class | ||
mate\academy\rickandmorty\repository\CharacterRepository.class | ||
mate\academy\rickandmorty\dto\external\CharacterResponseDto.class | ||
mate\academy\rickandmorty\external\api\service\ExternalCharacterService.class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that this file should be on git?
package mate.academy.rickandmorty.external.api.service; | ||
|
||
public interface GetClient<T> { | ||
T getDtoFromApi(String url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T getDtoFromApi(String url); | |
dto.... getDtoFromApi(String url); |
public class Application { | ||
@RequiredArgsConstructor | ||
public class Application implements CommandLineRunner { | ||
private static final String RICK_AND_MORTY_API_CHARACTER_URL = "https://rickandmortyapi.com/api/character"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this url can be moved to client class
} | ||
|
||
while (true) { | ||
fullResponseDto.getResults().forEach(externalCharacterService::saveOrUpdate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In current implementation you will make N requests to DB to save N characters
|
||
public interface CharacterRepository extends JpaRepository<Character,Long>, | ||
JpaSpecificationExecutor<Character> { | ||
List<Character> findByExternalId(String externalId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this returns list?
return; | ||
} | ||
|
||
characterMapper.updateCharacterFromResponseDto(characterResponseDto, character); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
characterMapper.updateCharacterFromResponseDto(characterResponseDto, character); | |
Character updatedCharacter = characterMapper.toCharacter(characterResponseDto); | |
updatedCharacter.setId(existingCharacter.getId) | |
No description provided.