> For the complete documentation index, see [llms.txt](https://olavo-moreira.gitbook.io/studies/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://olavo-moreira.gitbook.io/studies/workshop-mongodb/endpoints/posts/postdto.md).

# PostDTO

```java
@Getter
@Setter
@NoArgsConstructor
public class PostDTO {

    private String id;
    private Instant moment;
    private String title;
    private String body;

    private Author author;

    @Setter(AccessLevel.NONE)
    private List<Comment> comments = new ArrayList<>();

    public PostDTO(String id, Instant moment, String title, String body, Author author) {
        this.id = id;
        this.moment = moment;
        this.title = title;
        this.body = body;
        this.author = author;
    }

    public PostDTO(Post post) {
        this.id = post.getId();
        this.moment = post.getMoment();
        this.title = post.getTitle();
        this.body = post.getBody();
        this.author = post.getAuthor();

        this.comments.addAll(post.getComments());
    }
}
```
