feat: api wrapping
This commit is contained in:
@@ -34,12 +34,13 @@ public class AnimalCoreService
|
||||
@Transactional
|
||||
public AnimalDto.Basic create(AnimalDto.AddReq req) {
|
||||
ZooEntity zoo = null;
|
||||
if (req.getZooId() != null) {
|
||||
if (req.getZooUuid() != null) {
|
||||
zoo =
|
||||
zooRepository
|
||||
.getZooByUid(req.getZooId())
|
||||
.getZooByUuid(req.getZooUuid())
|
||||
.orElseThrow(
|
||||
() -> new EntityNotFoundException(" not found with id: " + req.getZooId()));
|
||||
() ->
|
||||
new EntityNotFoundException("Zoo not found with uuid: " + req.getZooUuid()));
|
||||
}
|
||||
AnimalEntity entity = new AnimalEntity(req.getCategory(), req.getSpecies(), req.getName(), zoo);
|
||||
AnimalEntity saved = animalRepository.save(entity);
|
||||
|
||||
Reference in New Issue
Block a user