Skip to content

Commit

Permalink
feat: #6 add fields in tables
Browse files Browse the repository at this point in the history
  • Loading branch information
SunghunKim98 committed Apr 28, 2022
1 parent 89b711e commit 9874392
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
12 changes: 8 additions & 4 deletions src/main/java/jungsaesidae/capstone/domain/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ public class Post {

private String url;
private boolean isSold;
private boolean isSClass;
private boolean isMint;
private LocalDateTime uploadDate;
private String title;
private String productImage;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "location_id")
Expand All @@ -43,17 +45,19 @@ public class Post {
//== 연관관계 메소드 ==//
// 일단은 모두 양방향

public static Post createPost(Location location, Platform platform, MarketPrice markerPrice,
Item item, String url, boolean isSold, boolean isSClass, LocalDateTime uploadDate) {
public static Post createPost(Location location, Platform platform, MarketPrice markerPrice, Item item,
String url, boolean isSold, boolean isMint, LocalDateTime uploadDate, String title, String productImage) {
Post post = new Post();
post.setLocation(location);
post.setPlatform(platform);
post.setMarketPrice(markerPrice);
post.setItem(item);
post.setUrl(url);
post.setSold(isSold);
post.setSClass(isSClass);
post.setMint(isMint);
post.setUploadDate(uploadDate);
post.setTitle(title);
post.setProductImage(productImage);

return post;
}
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/jungsaesidae/capstone/initDb.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,30 +87,30 @@ public void dbInit() {
em.persist(marketPrice5);
em.persist(marketPrice6);

Post post1 = Post.createPost(location1, platform1, marketPrice1, item5, "www.naver.com", false, false, LocalDateTime.now().minusDays(2));
Post post2 = Post.createPost(location2, platform2, marketPrice2, item1, "www.google.com", false, false, LocalDateTime.now());
Post post3 = Post.createPost(location3, platform4, marketPrice4, item6, "www.yahoo.com", true, true, LocalDateTime.now().minusDays(33));
Post post4 = Post.createPost(location1, platform3, marketPrice3, item3, "www.yahhqa.com", false, false, LocalDateTime.now().minusDays(11));
Post post5 = Post.createPost(location4, platform2, marketPrice3, item2, "www.hololoo.com", false, false, LocalDateTime.now().minusDays(5));
Post post6 = Post.createPost(location5, platform1, marketPrice3, item1, "www.yho.com", true, true, LocalDateTime.now().minusDays(90));
Post post7 = Post.createPost(location3, platform1, marketPrice4, item4, "www.qwe.com", false, true, LocalDateTime.now().minusDays(22));
Post post8 = Post.createPost(location6, platform2, marketPrice2, item1, "www.sfs.com", false, false, LocalDateTime.now().minusDays(50));
Post post11 = Post.createPost(location1, platform1, marketPrice3, item5, "www.naver.com", false, false, LocalDateTime.now().minusDays(2));
Post post21 = Post.createPost(location2, platform2, marketPrice1, item1, "www.1google.com", false, false, LocalDateTime.now());
Post post31 = Post.createPost(location3, platform4, marketPrice3, item6, "www.1yahoo.com", true, true, LocalDateTime.now().minusDays(33));
Post post41 = Post.createPost(location1, platform3, marketPrice5, item3, "www.1yahhqa.com", false, false, LocalDateTime.now().minusDays(11));
Post post51 = Post.createPost(location4, platform2, marketPrice6, item2, "www.1hololoo.com", false, false, LocalDateTime.now().minusDays(5));
Post post61 = Post.createPost(location5, platform1, marketPrice5, item1, "www.1yho.com", true, true, LocalDateTime.now().minusDays(90));
Post post71 = Post.createPost(location3, platform1, marketPrice2, item4, "www.1qwe.com", false, true, LocalDateTime.now().minusDays(22));
Post post81 = Post.createPost(location6, platform2, marketPrice1, item1, "www.1sfs.com", false, false, LocalDateTime.now().minusDays(50));
Post post12 = Post.createPost(location1, platform1, marketPrice5, item5, "www.1naver.com", false, false, LocalDateTime.now().minusDays(2));
Post post22 = Post.createPost(location2, platform2, marketPrice1, item1, "www.2google.com", false, false, LocalDateTime.now());
Post post32 = Post.createPost(location3, platform4, marketPrice2, item6, "www.2yahoo.com", true, true, LocalDateTime.now().minusDays(33));
Post post42 = Post.createPost(location1, platform3, marketPrice1, item3, "www.2yahhqa.com", false, false, LocalDateTime.now().minusDays(11));
Post post52 = Post.createPost(location4, platform2, marketPrice1, item2, "www.2hololoo.com", false, false, LocalDateTime.now().minusDays(5));
Post post62 = Post.createPost(location5, platform1, marketPrice2, item1, "www.2yho.com", true, true, LocalDateTime.now().minusDays(90));
Post post72 = Post.createPost(location3, platform1, marketPrice2, item4, "www.2qwe.com", false, true, LocalDateTime.now().minusDays(22));
Post post82 = Post.createPost(location6, platform2, marketPrice1, item1, "www.2sfs.com", false, false, LocalDateTime.now().minusDays(50));
Post post1 = Post.createPost(location1, platform1, marketPrice1, item5, "www.naver.com", false, false, LocalDateTime.now().minusDays(2), "a", "image1");
Post post2 = Post.createPost(location2, platform2, marketPrice2, item1, "www.google.com", false, false, LocalDateTime.now(),"b", "image1");
Post post3 = Post.createPost(location3, platform4, marketPrice4, item6, "www.yahoo.com", true, true, LocalDateTime.now().minusDays(33),"c", "image1");
Post post4 = Post.createPost(location1, platform3, marketPrice3, item3, "www.yahhqa.com", false, false, LocalDateTime.now().minusDays(11),"d", "image1");
Post post5 = Post.createPost(location4, platform2, marketPrice3, item2, "www.hololoo.com", false, false, LocalDateTime.now().minusDays(5),"e", "image1");
Post post6 = Post.createPost(location5, platform1, marketPrice3, item1, "www.yho.com", true, true, LocalDateTime.now().minusDays(90),"f", "image1");
Post post7 = Post.createPost(location3, platform1, marketPrice4, item4, "www.qwe.com", false, true, LocalDateTime.now().minusDays(22),"g", "image1");
Post post8 = Post.createPost(location6, platform2, marketPrice2, item1, "www.sfs.com", false, false, LocalDateTime.now().minusDays(50),"h", "image1");
Post post11 = Post.createPost(location1, platform1, marketPrice3, item5, "www.naver.com", false, false, LocalDateTime.now().minusDays(2),"i", "image1");
Post post21 = Post.createPost(location2, platform2, marketPrice1, item1, "www.1google.com", false, false, LocalDateTime.now(),"j", "image1");
Post post31 = Post.createPost(location3, platform4, marketPrice3, item6, "www.1yahoo.com", true, true, LocalDateTime.now().minusDays(33),"k", "image1");
Post post41 = Post.createPost(location1, platform3, marketPrice5, item3, "www.1yahhqa.com", false, false, LocalDateTime.now().minusDays(11),"l", "image1");
Post post51 = Post.createPost(location4, platform2, marketPrice6, item2, "www.1hololoo.com", false, false, LocalDateTime.now().minusDays(5),"m", "image1");
Post post61 = Post.createPost(location5, platform1, marketPrice5, item1, "www.1yho.com", true, true, LocalDateTime.now().minusDays(90),"n", "image1");
Post post71 = Post.createPost(location3, platform1, marketPrice2, item4, "www.1qwe.com", false, true, LocalDateTime.now().minusDays(22),"o", "image1");
Post post81 = Post.createPost(location6, platform2, marketPrice1, item1, "www.1sfs.com", false, false, LocalDateTime.now().minusDays(50),"p", "image1");
Post post12 = Post.createPost(location1, platform1, marketPrice5, item5, "www.1naver.com", false, false, LocalDateTime.now().minusDays(2),"q", "image1");
Post post22 = Post.createPost(location2, platform2, marketPrice1, item1, "www.2google.com", false, false, LocalDateTime.now(),"r", "image1");
Post post32 = Post.createPost(location3, platform4, marketPrice2, item6, "www.2yahoo.com", true, true, LocalDateTime.now().minusDays(33),"s", "image1");
Post post42 = Post.createPost(location1, platform3, marketPrice1, item3, "www.2yahhqa.com", false, false, LocalDateTime.now().minusDays(11),"t", "image1");
Post post52 = Post.createPost(location4, platform2, marketPrice1, item2, "www.2hololoo.com", false, false, LocalDateTime.now().minusDays(5),"u", "image1");
Post post62 = Post.createPost(location5, platform1, marketPrice2, item1, "www.2yho.com", true, true, LocalDateTime.now().minusDays(90),"v", "image1");
Post post72 = Post.createPost(location3, platform1, marketPrice2, item4, "www.2qwe.com", false, true, LocalDateTime.now().minusDays(22),"w", "image1");
Post post82 = Post.createPost(location6, platform2, marketPrice1, item1, "www.2sfs.com", false, false, LocalDateTime.now().minusDays(50),"x", "image1");

em.persist(post1);
em.persist(post2);
Expand Down

0 comments on commit 9874392

Please sign in to comment.