-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kirill Mokevnin <[email protected]>
- Loading branch information
Showing
4 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.hexlet.blog.dto; | ||
|
||
import java.util.Date; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Setter | ||
@Getter | ||
public class PostCommentDTO { | ||
private Long id; | ||
private Long authorId; | ||
private Long postId; | ||
private String body; | ||
private Date createdAt; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/io/hexlet/blog/mapper/PostCommentMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.hexlet.blog.mapper; | ||
|
||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.MappingConstants; | ||
import org.mapstruct.NullValuePropertyMappingStrategy; | ||
import org.mapstruct.ReportingPolicy; | ||
|
||
import io.hexlet.blog.dto.PostCommentDTO; | ||
import io.hexlet.blog.model.PostComment; | ||
|
||
@Mapper( | ||
// uses = { JsonNullableMapper.class, ReferenceMapper.class }, | ||
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE, | ||
componentModel = MappingConstants.ComponentModel.SPRING, | ||
unmappedTargetPolicy = ReportingPolicy.IGNORE | ||
) | ||
public abstract class PostCommentMapper { | ||
@Mapping(source = "author.id", target = "authorId") | ||
@Mapping(source = "post.id", target = "postId") | ||
public abstract PostCommentDTO map(PostComment model); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters