diff --git a/lab2/src/main/java/com/example/demo/news/api/NewController.java b/lab2/src/main/java/com/example/demo/news/api/NewController.java index dac914d..f9fc2d3 100644 --- a/lab2/src/main/java/com/example/demo/news/api/NewController.java +++ b/lab2/src/main/java/com/example/demo/news/api/NewController.java @@ -4,8 +4,6 @@ import java.util.Arrays; import java.util.List; import org.modelmapper.ModelMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -37,7 +35,10 @@ public class NewController { } private NewDto toDto(NewEntity entity) { - return modelMapper.map(entity, NewDto.class); + var tages = entity.getTage().stream().map(TageEntity::getId).toList(); + var newdto = modelMapper.map(entity, NewDto.class); + newdto.setTagesId(tages); + return newdto; } private NewEntity toEntity(NewDto dto) {