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

Implemented Rick and Morty app #172

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

Conversation

serhii-shyian
Copy link

No description provided.

Copy link

@okuzan okuzan left a comment

Choose a reason for hiding this comment

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

Good job overall!

pom.xml Outdated
Comment on lines 16 to 28
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
Copy link

Choose a reason for hiding this comment

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

not sure you need it

public class CharacterController {
private final CharacterService characterService;

@GetMapping("/search")
Copy link

Choose a reason for hiding this comment

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

Suggested change
@GetMapping("/search")
@GetMapping

that's more RESTful naming - we should focus on hierarchy of resources and avoid verbs. HTTP verbs should express the idea - GET is retrieving, searching

Comment on lines 18 to 19
@SQLDelete(sql = "UPDATE books SET is_deleted = true WHERE id = ?")
@SQLRestriction(value = "is_deleted=false")
Copy link

Choose a reason for hiding this comment

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

Suggested change
@SQLDelete(sql = "UPDATE books SET is_deleted = true WHERE id = ?")
@SQLRestriction(value = "is_deleted=false")
@SQLDelete(sql = "UPDATE books SET is_deleted = TRUE WHERE id = ?")
@SQLRestriction(value = "is_deleted = FALSE")

JpaSpecificationExecutor<Character> {
List<Character> findByNameContaining(String name);

@Query("from Character ORDER BY RAND() limit 1")
Copy link

Choose a reason for hiding this comment

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

Suggested change
@Query("from Character ORDER BY RAND() limit 1")
@Query("FROM Character ORDER BY RAND() LIMIT 1")

consistency is key, if you write some SQL keywords as uppercase - all of them should be uppercased

Comment on lines 25 to 28
@Override
public List<CharacterResponseDto> findAllCharacters() {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
Copy link

Choose a reason for hiding this comment

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

you just get the first batch of 20 characters

Comment on lines 31 to 34
return characterMapper.toDtoList(
characterRepository.findByNameContaining(name).stream()
.toList());
}
Copy link

Choose a reason for hiding this comment

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

just declare mapping list to list in the mapper, mapstruct supports this

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository

Choose a reason for hiding this comment

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

Suggested change
@Repository

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.

4 participants