Set up parent category mechanism.
This commit is contained in:
@@ -68,11 +68,14 @@ public class CategoryUseCases {
|
||||
}
|
||||
|
||||
if (!isNull(subCategoryIds)) {
|
||||
List<Category> subCategories;
|
||||
try {
|
||||
subCategories = categoryPort.findAllByIds(subCategoryIds);
|
||||
} catch (CategoryNotFoundException exception) {
|
||||
throw new CategoryEditionException(exception);
|
||||
List<Category> subCategories = emptyList();
|
||||
|
||||
if (!subCategoryIds.isEmpty()) {
|
||||
try {
|
||||
subCategories = categoryPort.findAllByIds(subCategoryIds);
|
||||
} catch (CategoryNotFoundException exception) {
|
||||
throw new CategoryEditionException(exception);
|
||||
}
|
||||
}
|
||||
categoryBuilder.withSubCategories(subCategories);
|
||||
}
|
||||
@@ -93,4 +96,8 @@ public class CategoryUseCases {
|
||||
|
||||
categoryPort.deleteById(categoryId);
|
||||
}
|
||||
|
||||
public List<Category> getAll() {
|
||||
return categoryPort.findAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user