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

Added Category entity with all related dto, service, mapper and controller. #12

Merged
merged 6 commits into from
May 17, 2024

Conversation

nklimovych
Copy link
Owner

No description provided.

Copy link

@vikkushnir vikkushnir left a comment

Choose a reason for hiding this comment

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

LGTM! Only few minor comments

type: bit
defaultValueBoolean: false
constraints:
nullable: false

Choose a reason for hiding this comment

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

Suggested change
nullable: false
nullable: false

Choose a reason for hiding this comment

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

Not resolved

Comment on lines 16 to 28
@Service
public class CategoryServiceImpl implements CategoryService {
private final CategoryRepository categoryRepository;
private final CategoryMapper categoryMapper;

@Autowired
public CategoryServiceImpl(
CategoryRepository categoryRepository,
CategoryMapper categoryMapper
) {
this.categoryRepository = categoryRepository;
this.categoryMapper = categoryMapper;
}

Choose a reason for hiding this comment

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

Suggested change
@Service
public class CategoryServiceImpl implements CategoryService {
private final CategoryRepository categoryRepository;
private final CategoryMapper categoryMapper;
@Autowired
public CategoryServiceImpl(
CategoryRepository categoryRepository,
CategoryMapper categoryMapper
) {
this.categoryRepository = categoryRepository;
this.categoryMapper = categoryMapper;
}
@Service
@RequiredArgsConstructor
public class CategoryServiceImpl implements CategoryService {
private final CategoryRepository categoryRepository;
private final CategoryMapper categoryMapper;

Choose a reason for hiding this comment

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

agree

Copy link

@andrii-hoienko andrii-hoienko left a comment

Choose a reason for hiding this comment

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

Nice! left some comments

CategoryDto update(Long id, CategoryDto categoryDto);

void delete(Long id);

Choose a reason for hiding this comment

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

Suggested change

Comment on lines 16 to 28
@Service
public class CategoryServiceImpl implements CategoryService {
private final CategoryRepository categoryRepository;
private final CategoryMapper categoryMapper;

@Autowired
public CategoryServiceImpl(
CategoryRepository categoryRepository,
CategoryMapper categoryMapper
) {
this.categoryRepository = categoryRepository;
this.categoryMapper = categoryMapper;
}

Choose a reason for hiding this comment

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

agree


@Override
public void delete(Long id) {
categoryRepository.deleteById(id);

Choose a reason for hiding this comment

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

make check before delete as you did in update

type: bit
defaultValueBoolean: false
constraints:
nullable: false

Choose a reason for hiding this comment

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

Not resolved

…ed findCategoryByIdOrElseThrow() method at CategoryServiceImpl.
@@ -38,6 +38,11 @@ protected ResponseEntity<Object> handleMethodRepository(DuplicateIsbnException e
return getResponseEntity(HttpStatus.BAD_REQUEST, ex.getMessage());
}

@ExceptionHandler(DuplicateEntityException.class)
protected ResponseEntity<Object> handleMethodRepository(DuplicateEntityException ex) {

Choose a reason for hiding this comment

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

Suggested change
protected ResponseEntity<Object> handleMethodRepository(DuplicateEntityException ex) {
protected ResponseEntity<Object> handleDuplicateEntity(DuplicateEntityException ex) {

@nklimovych nklimovych merged commit a94f80f into main May 17, 2024
2 checks passed
@nklimovych nklimovych deleted the category-impl branch May 17, 2024 11:35
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