-
Notifications
You must be signed in to change notification settings - Fork 240
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
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.
Good job overall!
pom.xml
Outdated
<url/> | ||
<licenses> | ||
<license/> | ||
</licenses> | ||
<developers> | ||
<developer/> | ||
</developers> | ||
<scm> | ||
<connection/> | ||
<developerConnection/> | ||
<tag/> | ||
<url/> | ||
</scm> |
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.
not sure you need it
public class CharacterController { | ||
private final CharacterService characterService; | ||
|
||
@GetMapping("/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.
@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
@SQLDelete(sql = "UPDATE books SET is_deleted = true WHERE id = ?") | ||
@SQLRestriction(value = "is_deleted=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.
@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") |
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.
@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
@Override | ||
public List<CharacterResponseDto> findAllCharacters() { | ||
HttpClient client = HttpClient.newHttpClient(); | ||
HttpRequest request = HttpRequest.newBuilder() |
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 just get the first batch of 20 characters
return characterMapper.toDtoList( | ||
characterRepository.findByNameContaining(name).stream() | ||
.toList()); | ||
} |
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.
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 |
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.
@Repository |
No description provided.