Skip to content

Commit

Permalink
feat: 수요조사폼 리팩
Browse files Browse the repository at this point in the history
  • Loading branch information
yj-leez committed Dec 28, 2023
1 parent 07a31fc commit 899cd73
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 25 deletions.
3 changes: 3 additions & 0 deletions src/main/java/wowmarket/wow_server/domain/DemandItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class DemandItem extends BaseEntity{
@ColumnDefault("0")
private int goal;

@ColumnDefault("0")
private int limit;

public void setDemandProject(DemandProject demandProject){
this.demandProject=demandProject;
}
Expand Down
27 changes: 11 additions & 16 deletions src/main/java/wowmarket/wow_server/domain/DemandProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.*;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@AllArgsConstructor
Expand All @@ -21,7 +22,12 @@ public class DemandProject extends BaseEntity{
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "seller_id", referencedColumnName = "user_id")
private User user;
private String nickname;

/* 등록 */
private String sellerName; // 판매자명
private String phoneNumber; // 전화번호
private String email; // 이메일
private String sellerEtc; // 기타 연락 수단

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id", referencedColumnName = "category_id")
Expand All @@ -32,10 +38,11 @@ public class DemandProject extends BaseEntity{
private String image2;
private String image3;

private String name;
private String projectName;
private String description;
private LocalDate startDate;
private LocalDate endDate;

private LocalDateTime startDate;
private LocalDateTime endDate;

private int participant_number;
private Long final_achievement_rate;
Expand All @@ -53,16 +60,4 @@ public void setCategory(Category category){
this.category = category;
}

public void setImage(List<String> uploaded){
switch (uploaded.size()){
case 4:
image3 = uploaded.get(3);
case 3:
image2 = uploaded.get(2);
case 2:
image1 = uploaded.get(1);
case 1:
thumbnail = uploaded.get(0);
}
}
}
3 changes: 3 additions & 0 deletions src/main/java/wowmarket/wow_server/domain/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class Item {
@ColumnDefault("0")
private int goal;

@ColumnDefault("0")
private int limit; // 구매제한

public void setProject(Project project){
this.project = project;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import wowmarket.wow_server.domain.DemandProject;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Getter
Expand All @@ -16,39 +17,53 @@
@Builder
public class RegisterDemandProjectDto {
@NotNull
private String project_name;
private String projectName;
@NotNull
private String description;
@NotNull
private Long category_id;
@NotNull
private String sellerName; // 판매자명

private String phoneNumber; // 전화번호
private String email; // 이메일
private String sellerEtc; // 기타 연락 수단

@NotNull
private String thumbnail;
@NotNull
private String image1;
private String image2;
private String image3;

@NotNull
private List<RegisterItemDto> item;
@NotNull
private LocalDate start_date;
@NotNull
private LocalDate end_date;
private LocalDateTime startDate;
@NotNull
private String nickname;
private LocalDateTime endDate;



@Builder
public DemandProject toEntity(){
return DemandProject.builder()
.name(project_name)
.projectName(projectName)
.description(description)
.sellerName(sellerName)
.phoneNumber(phoneNumber)
.email(email)
.sellerEtc(sellerEtc)
.thumbnail(thumbnail)
.image1(image1)
.image2(image2)
.image3(image3)
.startDate(start_date)
.endDate(end_date)
.nickname(nickname)
.startDate(startDate)
.endDate(endDate)
.participant_number(0)
.final_achievement_rate(0L)
.isEnd(Boolean.FALSE)
.view(0)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ public class RegisterItemDto {
private String item_name;
private Long price;
private int goal;
private int limit;

@Builder
public Item toItemEntity(){
return Item.builder()
.name(item_name)
.price(price)
.goal(goal)
.limit(limit)
.build();
}

Expand All @@ -31,6 +33,7 @@ public DemandItem toDemandItemEntity(){
.name(item_name)
.price(price)
.goal(goal)
.limit(limit)
.build();
}
}

0 comments on commit 899cd73

Please sign in to comment.