diff --git a/src/main/java/org/ntlab/nemophila/models/shops/Shop.java b/src/main/java/org/ntlab/nemophila/models/shops/Shop.java index 074ad45..59368ca 100644 --- a/src/main/java/org/ntlab/nemophila/models/shops/Shop.java +++ b/src/main/java/org/ntlab/nemophila/models/shops/Shop.java @@ -1,6 +1,8 @@ package org.ntlab.nemophila.models.shops; import com.fasterxml.jackson.annotation.JsonProperty; +import org.ntlab.nemophila.models.accounts.Post; +import java.util.ArrayList; public class Shop { @JsonProperty("id") @@ -11,6 +13,8 @@ private double longitude; @JsonProperty("latitude") private double latitude; + @JsonProperty("posts") + private ArrayList posts = new ArrayList<>(); //Getter public String getId() { @@ -39,4 +43,18 @@ public void setLatitude(double latitude) { latitude = latitude; } + + //postsに関するメソッド + public void addPost(Post newPost) { + posts.add(newPost); + } + public void deletePost(Post post) { + posts.remove(post); + } + public Post getposts(int index) { + return posts.get(index); + } + public int getPostsCount() { + return posts.size(); + } }