-
Notifications
You must be signed in to change notification settings - Fork 250
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
rick and morty solution #28
base: main
Are you sure you want to change the base?
Conversation
pom.xml
Outdated
<dependency> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.11.0</version> |
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.
If it plugin maybe better add to plugins block?
pom.xml
Outdated
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>3.1.2</version> | ||
</dependency> |
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.
The same as maven-compiler
logger.info("API Documentation Overview link: http://localhost:8080/api/swagger-ui/index.html#/"); | ||
logger.info("Get random personality link: " + "http://localhost:8080/api/personalities/random"); | ||
logger.info("Search link: " + "http://localhost:8080/api/personalities/search?name=Alien&name=Baby"); |
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.
For what this logs?
@Operation(summary = "Search characters.", | ||
description = "Search characters by params") | ||
@GetMapping("/search") | ||
public List<PersonalityDto> search( |
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.
Better call this method serchBy...
Female, | ||
Male, | ||
Genderless, | ||
unknown |
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 what case need to write enums?
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
private Long externalId; | ||
private String name; | ||
private Status status; | ||
private Gender gender; | ||
@Column(name = "is_deleted", nullable = false) | ||
private boolean isDeleted = 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.
What about validation
public class PersonalitySpecificationBuilderImpl implements SpecificationBuilder<Personality> { | ||
private static final String NAME_KEY = "name"; | ||
|
||
@Autowired |
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 annotation is redundant
|
||
@Component | ||
public class NameSpecificationProvider implements SpecificationProvider<Personality> { | ||
private static final String NAME_KEY = "name"; |
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.
You already have this constant
) { | ||
final Specification<Personality> personalitySpecification | ||
= personalitySpecificationBuilder.build(params); | ||
return personalityRepository.findAll(personalitySpecification,pageable) |
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.
(personalitySpecification,pageable) - Use Ctrl + Alt+ L before you commit code
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Application { | ||
private static final Logger logger = LogManager.getLogger(Application.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.
private static final Logger logger = LogManager.getLogger(Application.class); |
public class CharacterDto { | ||
|
||
private Long id; |
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.
public class CharacterDto { | |
private Long id; | |
public class CharacterDto { | |
private Long id; |
characterDtos.addAll(rickAndMortyResponseDto.getResults()); | ||
amountPages = rickAndMortyResponseDto.getInfo().getPages(); | ||
} catch (IOException | InterruptedException e) { | ||
e.printStackTrace(); |
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.
do not use printStackTrace()
No description provided.