diff options
| author | realtradam <[email protected]> | 2024-07-16 16:19:21 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2024-07-16 16:19:21 -0400 |
| commit | 2a43a36f448980b5f15f73dbcfab850441e69fdf (patch) | |
| tree | 8df817fe5137acd0b2e493d1d62d4b20939e73f1 /src/main/java/com/blog/web/models/Article.java | |
| parent | 55a6616445b5697547792176e6a560bf19e69ba8 (diff) | |
| download | spring-blog-2a43a36f448980b5f15f73dbcfab850441e69fdf.tar.gz spring-blog-2a43a36f448980b5f15f73dbcfab850441e69fdf.zip | |
code cleanup
Diffstat (limited to 'src/main/java/com/blog/web/models/Article.java')
| -rw-r--r-- | src/main/java/com/blog/web/models/Article.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/com/blog/web/models/Article.java b/src/main/java/com/blog/web/models/Article.java index 2682994..42d27a1 100644 --- a/src/main/java/com/blog/web/models/Article.java +++ b/src/main/java/com/blog/web/models/Article.java @@ -1,5 +1,6 @@ package com.blog.web.models; +import com.blog.web.dto.ArticleDto; import jakarta.persistence.*; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; @@ -42,6 +43,16 @@ public class Article { public Article() {}; + public Article(ArticleDto articleDto) { + this.id = articleDto.getId(); + this.title = articleDto.getTitle(); + this.photoUrl = articleDto.getPhotoUrl(); + this.content = articleDto.getContent(); + this.createdBy = articleDto.getCreatedBy(); + this.createdOn = articleDto.getCreatedOn(); + this.updatedOn = articleDto.getUpdatedOn(); + } + public Long getId() { return id; } |
