Implementation of category creation.

This commit is contained in:
Florian THIERRY
2024-03-12 14:24:17 +01:00
parent 47876cc775
commit b0e682e82e
12 changed files with 164 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
package org.codiki.infrastructure.category;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@@ -22,4 +23,18 @@ public class CategoryJpaAdapter implements CategoryPort {
return categoryRepository.findById(categoryId)
.map(CategoryEntity::toDomain);
}
@Override
public void save(Category category) {
CategoryEntity categoryEntity = new CategoryEntity(category);
categoryRepository.save(categoryEntity);
}
@Override
public List<Category> findAllByIds(final List<UUID> subCategoryIds) {
return categoryRepository.findAllById(subCategoryIds)
.stream()
.map(CategoryEntity::toDomain)
.toList();
}
}