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 all needed repositories/services/controllers #323

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

Conversation

ykhmaruk
Copy link

No description provided.

Copy link

@V-Solianyk V-Solianyk left a comment

Choose a reason for hiding this comment

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

very good job!)

@Table(name = "products")
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

Choose a reason for hiding this comment

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

image
I would like an additional explanation from mentors in this situation)

Choose a reason for hiding this comment

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

I selected the wrong area for the comment, I am interested in this class of entity with the Lazy fetch type
image
image

Copy link

@sarakhmen sarakhmen left a comment

Choose a reason for hiding this comment

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

Let's improve your solution :)

}

@GetMapping("/{id}")
public CategoryResponseDto getByID(@PathVariable 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 CategoryResponseDto getByID(@PathVariable Long id) {
public CategoryResponseDto get(@PathVariable Long id) {

Comment on lines +28 to +29
Category category = service.add(mapper.mapToModel(dto));
return mapper.mapToDto(category);

Choose a reason for hiding this comment

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

let's be consistent in your code style. Either use additional variables everywhere or avoid creating it

}

@GetMapping("/{id}")
public ProductResponseDto getByID(@PathVariable 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 ProductResponseDto getByID(@PathVariable Long id) {
public ProductResponseDto get(@PathVariable Long id) {

}

@GetMapping("/categories")
public List<ProductResponseDto> getByCategorie(@RequestParam List<String> categoryNames) {

Choose a reason for hiding this comment

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

Suggested change
public List<ProductResponseDto> getByCategorie(@RequestParam List<String> categoryNames) {
public List<ProductResponseDto> getByCategory(@RequestParam List<String> categoryNames) {

import java.math.BigDecimal;
import lombok.Data;

@Data

Choose a reason for hiding this comment

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

Let's not use @Data annotation. It's better to use Getter Setter etc. Please fix the same issue in all places

+ "id=" + id
+ ", title='" + title + '\''
+ ", price=" + price
+ ", category=" + category

Choose a reason for hiding this comment

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

please pay attention to @V-Solianyk comment and remove 'category' from toString method

@sarakhmen sarakhmen self-requested a review August 31, 2023 11:39
Copy link

@sarakhmen sarakhmen left a comment

Choose a reason for hiding this comment

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

LGTM!

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