Set up parent category mechanism.
This commit is contained in:
1 parent
a3295636b4
commit
ed766d4c8c
8 files changed
+64
-15
No files matched your search
+12
-5
@@ -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