Skip to content

Commit

Permalink
[FIX] #40 내 식물 등록 구조 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
OliviaYJH committed Nov 21, 2022
1 parent 4fecdb3 commit f9be951
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public ResponseEntity<MyPlantSaveResponse> save(
@RequestPart(value = "plantName") String plantName,
@RequestPart(value = "plantNickName") String plantNickName,
@RequestPart(value = "plantAdaptTime") String plantAdaptTime,
@RequestPart(value = "plantType") String plantType,
@PathVariable Long userId) throws IOException {
try{
// cntntsNo로 해당 식물의 관수 설명도 함께 myPlant에 저장
Expand All @@ -87,7 +86,7 @@ public ResponseEntity<MyPlantSaveResponse> save(

Users users1 = new Users(usersRepository.findByUserId(userId));

MyPlant myPlant = new MyPlant(plantName,plantNickName, plantAdaptTime,plantType, amazonS3.getUrl(bucket, filePath).toString(), watercycleSprngCodeNm, users1);
MyPlant myPlant = new MyPlant(plantName,plantNickName, plantAdaptTime,amazonS3.getUrl(bucket, filePath).toString(), watercycleSprngCodeNm, users1);

//myPlantService.save(myPlantSaveRequestDto);
myPlantRepository.save(myPlant);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public class MyPlant extends BaseTimeEntity {
@OneToMany(mappedBy = "myPlant")
private List<PlantLog> plantLog = new ArrayList<PlantLog>();

private String plantName; //식물이름
private String plantType; //식물타입
private String plantName; //식물 타입
private String filePath;
private String plantNickName; // 식물 별명
private String watercycleSprngCodeNm; // 관수코드
Expand All @@ -46,9 +45,8 @@ public class MyPlant extends BaseTimeEntity {
private String plantAdaptTime; //식물입양날짜

@Builder
public MyPlant(String plantName, String plantNickName, String plantAdaptTime, String plantType, String filePath, String watercycleSprngCodeNm, Users users) {
public MyPlant(String plantName, String plantNickName, String plantAdaptTime, String filePath, String watercycleSprngCodeNm, Users users) {
this.plantName = plantName;
this.plantType = plantType;
this.filePath = filePath;
this.plantAdaptTime = plantAdaptTime;
this.plantNickName = plantNickName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
public class MyPlantSaveRequestDto {

private String plantName; //식물이름
private String plantType; //타입
private String plantNickName; //식물 별명
private String filePath;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private String plantAdaptTime; //입양날짜

@Builder
public MyPlantSaveRequestDto(String plantName, String plantType, String filePath, String plantAdaptTime) {
public MyPlantSaveRequestDto(String plantName, String plantNickName, String filePath, String plantAdaptTime) {

//식물이름, 타입, 이미지, 입양날짜
this.plantName = plantName; //식물이름
this.plantType = plantType; //타입
this.plantNickName = plantNickName; //타입
this.filePath = filePath; //이미지
this.plantAdaptTime = plantAdaptTime; //입양날짜
}

public MyPlant toEntity() {
return MyPlant.builder()
.plantName(plantName)
.plantType(plantType)
.plantNickName(plantNickName)
.filePath(filePath)
.plantAdaptTime(plantAdaptTime)
.build();
Expand Down

0 comments on commit f9be951

Please sign in to comment.