Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.0.1 #150

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -109,7 +110,11 @@ public ResponseEntity<BusinessErrorCode> handleNoPageFoundException(HttpRequestM
.body(BusinessErrorCode.METHOD_NOT_ALLOWED);
}

@ExceptionHandler(value = {HandlerMethodValidationException.class, MethodArgumentNotValidException.class})
@ExceptionHandler(value = {
HandlerMethodValidationException.class,
MethodArgumentNotValidException.class,
HttpMessageNotReadableException.class
})
public ResponseEntity<BusinessErrorCode> handleValidationException(Exception e) {
log.warn("GlobalExceptionHandler catch MethodArgumentNotValidException : {}", e.getMessage());
return ResponseEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Member> findByUserId(Long userId);

@Query("""
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/kkumulkkum/server/service/auth/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 데이터 삭제
Expand All @@ -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()));
}
}
Loading