summaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/blog/web/dto/ArticleDto.java
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2024-07-16 16:19:21 -0400
committerrealtradam <[email protected]>2024-07-16 16:19:21 -0400
commit2a43a36f448980b5f15f73dbcfab850441e69fdf (patch)
tree8df817fe5137acd0b2e493d1d62d4b20939e73f1 /src/main/java/com/blog/web/dto/ArticleDto.java
parent55a6616445b5697547792176e6a560bf19e69ba8 (diff)
downloadspring-blog-2a43a36f448980b5f15f73dbcfab850441e69fdf.tar.gz
spring-blog-2a43a36f448980b5f15f73dbcfab850441e69fdf.zip
code cleanup
Diffstat (limited to 'src/main/java/com/blog/web/dto/ArticleDto.java')
-rw-r--r--src/main/java/com/blog/web/dto/ArticleDto.java11
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;
}