diff --git a/src/main/java/org/ntlab/nemophila/entities/AccountPost.java b/src/main/java/org/ntlab/nemophila/entities/AccountPost.java new file mode 100644 index 0000000..867d6c0 --- /dev/null +++ b/src/main/java/org/ntlab/nemophila/entities/AccountPost.java @@ -0,0 +1,104 @@ +package org.ntlab.nemophila.entities; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.ntlab.nemophila.models.accounts.Account; +import org.ntlab.nemophila.models.accounts.Post; +import org.ntlab.nemophila.models.shops.Shop; + +public class AccountPost { + @JsonProperty("id") + private String id; + @JsonProperty("genre") + private String genre; + @JsonProperty("date") + private String date; + @JsonProperty("image1") + private String image1; + @JsonProperty("image2") + private String image2; + @JsonProperty("image3") + private String image3; + @JsonProperty("rate") + private int rate; + @JsonProperty("comment") + private String comment; + @JsonProperty("owner") + private Account owner; + @JsonProperty("shopName") + private String shopName; + + public AccountPost(Post post){ + this.id = post.getId(); + this.genre = post.getGenre(); + this.date = post.getDate(); + this.image1 = post.getImage1(); + this.image2 = post.getImage2(); + this.image3 = post.getImage3(); + this.rate = post.getRate(); + this.comment = post.getComment(); + this.owner = post.getOwner(); + this.shopName = post.getShop().getName(); + } + + //Getter + public String getId() { + return id; + } + public String getGenre() { + return genre; + } + public String getDate() { + return date; + } + public String getImage1() { + return image1; + } + public String getImage2() { + return image2; + } + public String getImage3() { + return image3; + } + public int getRate() { + return rate; + } + public String getComment() { + return comment; + } + public Account getOwner() { + return owner; + } + public String getShop() { + return shopName; + } + + //Setter + public void setId(String id) { + this.id = id; + } + public void setGenre(String genre) { + this.genre = genre; + } + public void setDate(String date) { + this.date = date; + } + public void setImage1(String image1) { + this.image1 = image1; + } + public void setImage2(String image2) { + this.image2 = image2; + } + public void setImage3(String image3) { + this.image3 = image3; + } + public void setRate(int rate) { + this.rate = rate; + } + public void setComment(String comment) { + this.comment = comment; + } + public String getShopName() { + return shopName; + } +}