Set up parent category mechanism.

This commit is contained in:
Florian THIERRY committed 2024-03-12 18:38:19 +01:00
1 parent a3295636b4
commit ed766d4c8c
8 files changed
+64 -15

No files matched your search

@@ -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();
}
}