From 6090ce692ca801b2b564c297443853859a62d0fc Mon Sep 17 00:00:00 2001 From: Sangjune park <74230343+tkdwns414@users.noreply.github.com> Date: Tue, 10 Sep 2024 02:54:47 +0900 Subject: [PATCH 1/3] [fix] #144 handle HttpMessageNotReadableException in GlobalExceptionHandler (#145) --- .../kkumulkkum/server/advice/GlobalExceptionHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kkumulkkum/server/advice/GlobalExceptionHandler.java b/src/main/java/org/kkumulkkum/server/advice/GlobalExceptionHandler.java index 7bcbbcc..15329b2 100644 --- a/src/main/java/org/kkumulkkum/server/advice/GlobalExceptionHandler.java +++ b/src/main/java/org/kkumulkkum/server/advice/GlobalExceptionHandler.java @@ -4,6 +4,7 @@ import org.kkumulkkum.server.exception.*; import org.kkumulkkum.server.exception.code.*; import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MissingRequestHeaderException; @@ -109,7 +110,11 @@ public ResponseEntity handleNoPageFoundException(HttpRequestM .body(BusinessErrorCode.METHOD_NOT_ALLOWED); } - @ExceptionHandler(value = {HandlerMethodValidationException.class, MethodArgumentNotValidException.class}) + @ExceptionHandler(value = { + HandlerMethodValidationException.class, + MethodArgumentNotValidException.class, + HttpMessageNotReadableException.class + }) public ResponseEntity handleValidationException(Exception e) { log.warn("GlobalExceptionHandler catch MethodArgumentNotValidException : {}", e.getMessage()); return ResponseEntity From a32823c0187c230b6297133045708951b4e8287e Mon Sep 17 00:00:00 2001 From: Chaewon Kim <113420297+chaewonni@users.noreply.github.com> Date: Wed, 11 Sep 2024 04:59:42 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[fix]=20FCM=20deprecated=20method=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#147)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [fix] #146 update firebase version in build.gradle * [fix] #146 replace method due to method deprecated --- build.gradle | 2 +- src/main/java/org/kkumulkkum/server/external/FcmService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 6e4c051..34f6bc4 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ dependencies { implementation("software.amazon.awssdk:s3:2.21.0") // Firebase - implementation 'com.google.firebase:firebase-admin:9.2.0' + implementation 'com.google.firebase:firebase-admin:9.3.0' // Logback Discord Appender implementation('com.github.napstr:logback-discord-appender:1.0.0') diff --git a/src/main/java/org/kkumulkkum/server/external/FcmService.java b/src/main/java/org/kkumulkkum/server/external/FcmService.java index 5589273..2582b2d 100644 --- a/src/main/java/org/kkumulkkum/server/external/FcmService.java +++ b/src/main/java/org/kkumulkkum/server/external/FcmService.java @@ -26,7 +26,7 @@ public void sendBulk( ){ MulticastMessage message = createBulkMessage(fcmTokens, fcmMessageDto); try { - FirebaseMessaging.getInstance().sendMulticast(message); + FirebaseMessaging.getInstance().sendEachForMulticast(message); } catch (FirebaseMessagingException e){ throw new FirebaseException(FirebaseErrorCode.FCM_ERROR); } From fbad854eb57601869ba88fbfd0ab7d92e525c83c Mon Sep 17 00:00:00 2001 From: Chaewon Kim <113420297+chaewonni@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:41:04 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[fix]=20=ED=9A=8C=EC=9B=90=ED=83=88?= =?UTF-8?q?=ED=87=B4=20=EC=8B=9C=20=ED=98=BC=EC=9E=90=20=EB=A7=8C=EB=93=A0?= =?UTF-8?q?=20=EC=95=BD=EC=86=8D=20=EC=82=AD=EC=A0=9C=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20(#149)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [fix] #148 modify to delete promises made alone when withdrawal * [fix] #148 change to uppercase --- .../server/repository/MemberRepository.java | 5 +++++ .../kkumulkkum/server/service/auth/AuthService.java | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/org/kkumulkkum/server/repository/MemberRepository.java b/src/main/java/org/kkumulkkum/server/repository/MemberRepository.java index d0e8447..a38a5b5 100644 --- a/src/main/java/org/kkumulkkum/server/repository/MemberRepository.java +++ b/src/main/java/org/kkumulkkum/server/repository/MemberRepository.java @@ -35,6 +35,11 @@ SELECT CASE WHEN EXISTS ( Member findByMeetingIdAndUserId(Long meetingId, Long userId); + @Query(""" + SELECT m from Member m + JOIN FETCH m.meeting + WHERE m.user.id = :userId + """) List findByUserId(Long userId); @Query(""" diff --git a/src/main/java/org/kkumulkkum/server/service/auth/AuthService.java b/src/main/java/org/kkumulkkum/server/service/auth/AuthService.java index f0664f7..685b62d 100644 --- a/src/main/java/org/kkumulkkum/server/service/auth/AuthService.java +++ b/src/main/java/org/kkumulkkum/server/service/auth/AuthService.java @@ -19,6 +19,9 @@ import org.kkumulkkum.server.service.member.MemberRemover; import org.kkumulkkum.server.service.member.MemberRetreiver; import org.kkumulkkum.server.service.participant.ParticipantRemover; +import org.kkumulkkum.server.service.participant.ParticipantRetriever; +import org.kkumulkkum.server.service.promise.PromiseRemover; +import org.kkumulkkum.server.service.promise.PromiseRetriever; import org.kkumulkkum.server.service.user.UserRemover; import org.kkumulkkum.server.service.user.UserRetriever; import org.kkumulkkum.server.service.user.UserSaver; @@ -45,6 +48,9 @@ public class AuthService { private final TokenRemover tokenRemover; private final UserInfoRetriever userInfoRetriever; private final MemberRetreiver memberRetreiver; + private final PromiseRetriever promiseRetriever; + private final ParticipantRetriever participantRetriever; + private final PromiseRemover promiseRemover; private final ParticipantRemover participantRemover; private final MemberRemover memberRemover; private final UserInfoRemover userInfoRemover; @@ -148,6 +154,7 @@ private void deleteUser(final User user) { // 각 Member에 대한 Participant 삭제 for(Member member : members) { participantRemover.deleteByMemberId(member.getId()); + removeEmptyPromises(member.getMeeting().getId()); } // Member 데이터 삭제 @@ -158,4 +165,10 @@ private void deleteUser(final User user) { // User 삭제 userRemover.delete(user); } + + private void removeEmptyPromises(final Long meetingId) { + promiseRetriever.findAllByMeetingId(meetingId).stream() + .filter(promise -> participantRetriever.findAllByPromiseId(promise.getId()).isEmpty()) + .forEach(promise -> promiseRemover.deleteById(promise.getId())); + } }