-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
…dded mapper for Category. Created DB tables categories and books_categories.
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.
LGTM! Only few minor comments
type: bit | ||
defaultValueBoolean: false | ||
constraints: | ||
nullable: 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.
nullable: false | |
nullable: 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.
Not resolved
@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; | ||
} |
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.
@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; |
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.
agree
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.
Nice! left some comments
CategoryDto update(Long id, CategoryDto categoryDto); | ||
|
||
void delete(Long id); | ||
|
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.
@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; | ||
} |
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.
agree
|
||
@Override | ||
public void delete(Long id) { | ||
categoryRepository.deleteById(id); |
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.
make check before delete as you did in update
type: bit | ||
defaultValueBoolean: false | ||
constraints: | ||
nullable: 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.
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) { |
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.
protected ResponseEntity<Object> handleMethodRepository(DuplicateEntityException ex) { | |
protected ResponseEntity<Object> handleDuplicateEntity(DuplicateEntityException ex) { |
No description provided.