We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c489529 commit 6cd360aCopy full SHA for 6cd360a
src/main/java/ru/skypro/homework/mapper/CommentMapper.java
@@ -10,6 +10,8 @@
10
import ru.skypro.homework.entity.Image;
11
import ru.skypro.homework.entity.User;
12
13
+import java.util.Objects;
14
+
15
@Mapper(componentModel = "spring", injectionStrategy = InjectionStrategy.CONSTRUCTOR)
16
public interface CommentMapper {
17
@@ -27,9 +29,10 @@ default CommentDto toDto(Comment comment) {
27
29
28
30
CommentDto commentDto = new CommentDto();
31
commentDto.setPk(comment.getCommentId());
- commentDto.setCreatedAt(comment.getCreatedAt());
32
commentDto.setText(comment.getText());
33
34
+ commentDto.setCreatedAt(Objects.requireNonNullElse(comment.getCreatedAt(), 0L));
35
36
User author = comment.getAuthor();
37
if (author != null) {
38
0 commit comments