From 8b8e44ac1c68b55003bc4e2b700be60c0dc72df7 Mon Sep 17 00:00:00 2001 From: bbbang105 <2018111366@dgu.ac.kr> Date: Wed, 2 Oct 2024 00:41:01 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[feat]=20:=20=EC=83=9D=EC=84=B1=EC=9D=BC?= =?UTF-8?q?=EC=9E=90=20=ED=98=95=ED=83=9C=EB=A5=BC=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/side/onetime/dto/EventDto.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/side/onetime/dto/EventDto.java b/src/main/java/side/onetime/dto/EventDto.java index 721a1ad..c827a3f 100644 --- a/src/main/java/side/onetime/dto/EventDto.java +++ b/src/main/java/side/onetime/dto/EventDto.java @@ -9,7 +9,6 @@ import lombok.NoArgsConstructor; import side.onetime.domain.*; import side.onetime.global.common.constant.Category; -import side.onetime.util.DateUtil; import java.time.LocalTime; import java.util.ArrayList; @@ -169,7 +168,7 @@ public static GetUserParticipatedEventsResponse of(Event event, EventParticipati return GetUserParticipatedEventsResponse.builder() .eventId(event.getEventId()) .title(event.getTitle()) - .createdDate(DateUtil.formatDateToYearMonthDay(event.getCreatedDate())) + .createdDate(String.valueOf(event.getCreatedDate())) .participantCount(participantCount) .eventStatus(String.valueOf(eventParticipation.getEventStatus())) .build(); From c5a3c1b6e1908c4978fcac289bb9ef247404dfda Mon Sep 17 00:00:00 2001 From: bbbang105 <2018111366@dgu.ac.kr> Date: Wed, 2 Oct 2024 00:42:18 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#48=20[feat]=20:=20=EC=9C=A0=EC=A0=80?= =?UTF-8?q?=EB=8A=94=20=EC=84=9C=EB=B9=84=EC=8A=A4=EB=A5=BC=20=ED=83=88?= =?UTF-8?q?=ED=87=B4=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/side/onetime/controller/UserController.java | 9 +++++++++ src/main/java/side/onetime/domain/User.java | 3 +++ .../onetime/global/common/constant/SuccessStatus.java | 1 + src/main/java/side/onetime/service/UserService.java | 7 +++++++ 4 files changed, 20 insertions(+) diff --git a/src/main/java/side/onetime/controller/UserController.java b/src/main/java/side/onetime/controller/UserController.java index 37c2d98..7af1ffe 100644 --- a/src/main/java/side/onetime/controller/UserController.java +++ b/src/main/java/side/onetime/controller/UserController.java @@ -41,4 +41,13 @@ public ResponseEntity> updateUserProfile( userService.updateUserProfile(authorizationHeader, updateUserProfileRequest); return ApiResponse.onSuccess(SuccessStatus._UPDATE_USER_PROFILE); } + + // 유저 서비스 탈퇴 API + @PostMapping("/action-withdraw") + public ResponseEntity> withdrawService( + @RequestHeader("Authorization") String authorizationHeader) { + + userService.withdrawService(authorizationHeader); + return ApiResponse.onSuccess(SuccessStatus._WITHDRAW_SERVICE); + } } \ No newline at end of file diff --git a/src/main/java/side/onetime/domain/User.java b/src/main/java/side/onetime/domain/User.java index 20f7091..6504cb1 100644 --- a/src/main/java/side/onetime/domain/User.java +++ b/src/main/java/side/onetime/domain/User.java @@ -37,6 +37,9 @@ public class User extends BaseEntity { @OneToMany(mappedBy = "user",cascade = CascadeType.ALL, fetch = FetchType.LAZY) private List selections; + @OneToMany(mappedBy = "user",cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List eventParticipations; + @Builder public User(String name, String email, String nickname, String provider, String providerId) { this.name = name; diff --git a/src/main/java/side/onetime/global/common/constant/SuccessStatus.java b/src/main/java/side/onetime/global/common/constant/SuccessStatus.java index bf60b1e..8d03d01 100644 --- a/src/main/java/side/onetime/global/common/constant/SuccessStatus.java +++ b/src/main/java/side/onetime/global/common/constant/SuccessStatus.java @@ -42,6 +42,7 @@ public enum SuccessStatus implements BaseCode { _ONBOARD_USER(HttpStatus.CREATED, "201", "유저 온보딩에 성공했습니다."), _GET_USER_PROFILE(HttpStatus.OK, "200", "유저 정보 조회에 성공했습니다."), _UPDATE_USER_PROFILE(HttpStatus.OK, "200", "유저 정보 수정에 성공했습니다."), + _WITHDRAW_SERVICE(HttpStatus.OK, "200", "유저 서비스 탈퇴에 성공했습니다."), ; private final HttpStatus httpStatus; diff --git a/src/main/java/side/onetime/service/UserService.java b/src/main/java/side/onetime/service/UserService.java index c13a207..3586cbd 100644 --- a/src/main/java/side/onetime/service/UserService.java +++ b/src/main/java/side/onetime/service/UserService.java @@ -87,4 +87,11 @@ public void updateUserProfile(String authorizationHeader, UserDto.UpdateUserProf user.updateNickName(nickname); userRepository.save(user); } + + // 유저 서비스 탈퇴 메서드 + @Transactional + public void withdrawService(String authorizationHeader) { + User user = jwtUtil.getUserFromHeader(authorizationHeader); + userRepository.delete(user); + } }