From 7f7f0acb1af92a53cb9e4ea24e9be5b030b78eda Mon Sep 17 00:00:00 2001 From: Eungi Jeong Date: Wed, 7 Jun 2023 19:27:59 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"[Fix]=20=EC=83=9D=EC=84=B1=EC=B9=9C?= =?UTF-8?q?=EA=B5=AC=20request=20DTO=20=EC=88=98=EC=A0=95,=20=EA=B8=B0?= =?UTF-8?q?=EB=85=90=EC=9D=BC=20=ED=95=84=EB=93=9C=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?#36"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 34f65c115cbfdf49d2da7ad880c06f8f2ef1c246. --- .../main/java/com/favor/favor/friend/Friend.java | 8 -------- .../java/com/favor/favor/friend/FriendService.java | 1 - .../favor/friend/noAccount/FriendRequestDto.java | 6 +++++- .../friend/noAccount/FriendUpdateRequestDto.java | 13 +++++++++---- .../main/java/com/favor/favor/user/UserService.java | 1 + 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/favor/src/main/java/com/favor/favor/friend/Friend.java b/favor/src/main/java/com/favor/favor/friend/Friend.java index 6d45677..387614b 100644 --- a/favor/src/main/java/com/favor/favor/friend/Friend.java +++ b/favor/src/main/java/com/favor/favor/friend/Friend.java @@ -1,7 +1,6 @@ package com.favor.favor.friend; -import com.favor.favor.common.enums.Favor; import lombok.*; import com.favor.favor.common.TimeStamped; @@ -49,13 +48,6 @@ public void setFriendMemo(String friendMemo) { @Builder.Default @ElementCollection private List favorList = new ArrayList<>(); - public void setFavorList(List favorList){ - ArrayList favorTypeList = new ArrayList<>(); - for(Favor favor : favorList){ - favorTypeList.add(favor.getType()); - } - this.favorList = favorTypeList; - } private Boolean isUser; private Long friendUserNo; diff --git a/favor/src/main/java/com/favor/favor/friend/FriendService.java b/favor/src/main/java/com/favor/favor/friend/FriendService.java index 7fbd5e7..f8a766c 100644 --- a/favor/src/main/java/com/favor/favor/friend/FriendService.java +++ b/favor/src/main/java/com/favor/favor/friend/FriendService.java @@ -68,7 +68,6 @@ public void updateFriend(Friend friend, FriendUpdateRequestDto friendUpdateReque friend.setFriendName(friendUpdateRequestDto.getFriendName()); friend.setFriendMemo(friendUpdateRequestDto.getFriendMemo()); - friend.setFavorList(friendUpdateRequestDto.getFavorList()); save(friend); } diff --git a/favor/src/main/java/com/favor/favor/friend/noAccount/FriendRequestDto.java b/favor/src/main/java/com/favor/favor/friend/noAccount/FriendRequestDto.java index db265a1..e15ab39 100644 --- a/favor/src/main/java/com/favor/favor/friend/noAccount/FriendRequestDto.java +++ b/favor/src/main/java/com/favor/favor/friend/noAccount/FriendRequestDto.java @@ -15,12 +15,16 @@ public class FriendRequestDto { @ApiModelProperty(position = 1, required = true, value = "친구이름", example = "이름") private String friendName; + + @ApiModelProperty(position = 2, required = false, value = "친구메모", example = "메모") + private String friendMemo; + @Transactional public Friend toEntity(User user){ return Friend.builder() .isUser(false) .friendName(friendName) - .friendMemo("") + .friendMemo(friendMemo) .user(user) .build(); } diff --git a/favor/src/main/java/com/favor/favor/friend/noAccount/FriendUpdateRequestDto.java b/favor/src/main/java/com/favor/favor/friend/noAccount/FriendUpdateRequestDto.java index ed27c25..00fe760 100644 --- a/favor/src/main/java/com/favor/favor/friend/noAccount/FriendUpdateRequestDto.java +++ b/favor/src/main/java/com/favor/favor/friend/noAccount/FriendUpdateRequestDto.java @@ -1,12 +1,12 @@ package com.favor.favor.friend.noAccount; -import com.favor.favor.common.enums.Favor; +import com.favor.favor.friend.Friend; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; -import java.util.List; +import javax.transaction.Transactional; @Getter @NoArgsConstructor @@ -18,6 +18,11 @@ public class FriendUpdateRequestDto { @ApiModelProperty(position = 2, required = false, dataType = "String", value = "친구메모", example = "메모") private String friendMemo; - @ApiModelProperty(position = 3, required = false, dataType = "", value = "취향목록", example = "[\n\"심플한\",\n\"귀여운\"\n]") - private List favorList; + @Transactional + public Friend toEntity(){ + return Friend.builder() + .friendName(friendName) + .friendMemo(friendMemo) + .build(); + } } diff --git a/favor/src/main/java/com/favor/favor/user/UserService.java b/favor/src/main/java/com/favor/favor/user/UserService.java index 969fe5f..1497fcf 100644 --- a/favor/src/main/java/com/favor/favor/user/UserService.java +++ b/favor/src/main/java/com/favor/favor/user/UserService.java @@ -25,6 +25,7 @@ import java.time.LocalDate; import java.util.ArrayList; import java.util.List; +import java.util.Random; import static com.favor.favor.exception.ExceptionCode.*;