diff options
Diffstat (limited to 'src/main/java/com/blog/web/dto/ArticleDto.java')
| -rw-r--r-- | src/main/java/com/blog/web/dto/ArticleDto.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/com/blog/web/dto/ArticleDto.java b/src/main/java/com/blog/web/dto/ArticleDto.java index 7e8b51a..372b318 100644 --- a/src/main/java/com/blog/web/dto/ArticleDto.java +++ b/src/main/java/com/blog/web/dto/ArticleDto.java @@ -1,5 +1,6 @@ package com.blog.web.dto; +import com.blog.web.models.Article; import com.blog.web.models.UserEntity; import jakarta.persistence.*; import jakarta.validation.constraints.NotEmpty; @@ -48,6 +49,16 @@ public class ArticleDto { public ArticleDto() {}; + public ArticleDto(Article article) { + this.id = article.getId(); + this.title = article.getTitle(); + this.photoUrl = article.getPhotoUrl(); + this.content = article.getContent(); + this.createdBy = article.getCreatedBy(); + this.createdOn = article.getCreatedOn(); + this.updatedOn = article.getUpdatedOn(); + } + public Long getId() { return id; } |
