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

rick and morty solution #28

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ArtemMakovskyy
Copy link

No description provided.

pom.xml Outdated
Comment on lines 84 to 87
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>

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
Comment on lines 59 to 63
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.1.2</version>
</dependency>

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

Comment on lines 14 to 16
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");

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(

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

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?

Comment on lines 24 to 31
@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;

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

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";

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)

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);

Choose a reason for hiding this comment

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

Suggested change
private static final Logger logger = LogManager.getLogger(Application.class);

Comment on lines +7 to +9
public class CharacterDto {

private Long id;

Choose a reason for hiding this comment

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

Suggested change
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();

Choose a reason for hiding this comment

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

do not use printStackTrace()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants