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

done #312

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

done #312

wants to merge 4 commits into from

Conversation

kateryna-mykh
Copy link

No description provided.

Copy link

@olekskov olekskov 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, approved
Please check comments regarding naming for further

public interface ProductRepository extends JpaRepository<Product, Long> {
List<Product> findAllByPriceBetween(BigDecimal from, BigDecimal to);

List<Product> findAllByCategoryId(Long categories);

Choose a reason for hiding this comment

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

Plurals are used for Collections, Long with plural naming looks confusing

Suggested change
List<Product> findAllByCategoryId(Long categories);
List<Product> findAllByCategoryId(Long categoryId);

Copy link
Author

Choose a reason for hiding this comment

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

Yes, in the first version I wanted to use List there


List<Product> getAllWherePriceBetween(BigDecimal priceMin, BigDecimal priceMax);

List<Product> getAllInCategories(Long categoryId);

Choose a reason for hiding this comment

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

Naming with "in" is usually used when we have List as argument to indicate we check all values in list. So such naming here is slightly confusing

Suggested change
List<Product> getAllInCategories(Long categoryId);
List<Product> getAllByCategory(Long categoryId);

Copy link
Author

Choose a reason for hiding this comment

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

fixed

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.

2 participants