From 12f2b58f51b2a2a09cc30d6dae7e39220b4eef6f Mon Sep 17 00:00:00 2001 From: Hanbee Lee Date: Tue, 6 Feb 2024 16:04:22 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=83=88=ED=87=B4,=20=EC=B0=A8=EB=8B=A8?= =?UTF-8?q?=20=EC=8B=9C=20fcm=ED=86=A0=ED=81=B0=20=EC=A7=80=EC=9A=B0?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/api/auth/service/helper/WithdrawUseCase.java | 6 ++++++ .../com/example/domains/block/adaptor/BlockAdaptor.java | 3 +++ .../domains/screeningReview/adaptor/ReviewAdaptor.java | 8 +++++++- .../main/java/com/example/domains/user/enums/Genre.java | 4 ++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Api/src/main/java/com/example/api/auth/service/helper/WithdrawUseCase.java b/Api/src/main/java/com/example/api/auth/service/helper/WithdrawUseCase.java index 216d416..1c8c558 100644 --- a/Api/src/main/java/com/example/api/auth/service/helper/WithdrawUseCase.java +++ b/Api/src/main/java/com/example/api/auth/service/helper/WithdrawUseCase.java @@ -10,6 +10,7 @@ import com.example.domains.user.enums.OauthProvider; import com.example.domains.user.service.UserService; import com.example.error.exception.InvalidOauthProviderException; +import com.example.fcm.adaptor.FcmTokenAdaptor; import lombok.RequiredArgsConstructor; import org.springframework.transaction.annotation.Transactional; @@ -20,10 +21,13 @@ public class WithdrawUseCase { private final UserAdaptor userAdaptor; private final QuitDomainService quitDomainService; private final UserService userService; + private final FcmTokenAdaptor fcmTokenAdaptor; @Transactional public void execute(String appleAccessToken, String referer, Long userId, Reason reason) { User user = userAdaptor.findById(userId); quitDomainService.save(Quit.of(userId, reason)); + //Fcm쪽 탈퇴 + fcmTokenAdaptor.execute(userId); // oauth쪽 탈퇴 withdrawOauth(user.getOauthInfo().getProvider(), appleAccessToken, user, referer); // 우리쪽 탈퇴 @@ -38,6 +42,8 @@ private void withdrawService(Long userId, User user) { public void executeDev(String appleAccessToken) { Long userId = SecurityUtil.getCurrentUserId(); User user = userAdaptor.findById(userId); + //Fcm쪽 탈퇴 + fcmTokenAdaptor.execute(userId); // oauth쪽 탈퇴 withdrawOauthDev(user.getOauthInfo().getProvider(), appleAccessToken, user); // 우리쪽 탈퇴 diff --git a/Domain/src/main/java/com/example/domains/block/adaptor/BlockAdaptor.java b/Domain/src/main/java/com/example/domains/block/adaptor/BlockAdaptor.java index 2c3e455..573bbaf 100644 --- a/Domain/src/main/java/com/example/domains/block/adaptor/BlockAdaptor.java +++ b/Domain/src/main/java/com/example/domains/block/adaptor/BlockAdaptor.java @@ -4,16 +4,19 @@ import com.example.domains.block.entity.Block; import com.example.domains.block.exception.exceptions.DuplicateBlockRequest; import com.example.domains.block.repository.BlockRepository; +import com.example.fcm.adaptor.FcmTokenAdaptor; import lombok.RequiredArgsConstructor; @Adaptor @RequiredArgsConstructor public class BlockAdaptor { private final BlockRepository blockRepository; + private final FcmTokenAdaptor fcmTokenAdaptor; public void save(Long userId,Long reportedUserId, Long reviewId,Long popcornReviewId){ validateUser(userId,reviewId,popcornReviewId); final Block result = Block.of(userId,reportedUserId,reviewId,popcornReviewId); blockRepository.save(result); + fcmTokenAdaptor.execute(userId); } private void validateUser(Long userId, Long reviewId,Long popcornReviewId) { diff --git a/Domain/src/main/java/com/example/domains/screeningReview/adaptor/ReviewAdaptor.java b/Domain/src/main/java/com/example/domains/screeningReview/adaptor/ReviewAdaptor.java index fb02227..2c691bf 100644 --- a/Domain/src/main/java/com/example/domains/screeningReview/adaptor/ReviewAdaptor.java +++ b/Domain/src/main/java/com/example/domains/screeningReview/adaptor/ReviewAdaptor.java @@ -14,6 +14,7 @@ import com.example.domains.user.enums.UserState; import com.example.domains.userscreening.entity.QUserScreening; import com.example.domains.userscreening.entity.UserScreening; +import com.example.fcm.adaptor.FcmTokenAdaptor; import com.google.api.client.util.SecurityUtils; import com.querydsl.core.types.Projections; import com.querydsl.jpa.impl.JPAQueryFactory; @@ -31,6 +32,7 @@ public class ReviewAdaptor { private final ScreeningReviewRepository screeningReviewRepository; private final BlockAdaptor blockAdaptor; private final JPAQueryFactory queryFactory; + private final FcmTokenAdaptor fcmTokenAdaptor; public void save(ScreeningReview screeningReview) { screeningReviewRepository.save(screeningReview); @@ -81,18 +83,22 @@ public void postComplain(Long reviewId,Long userId) { ScreeningReview screeningReview = findById(reviewId); blockAdaptor.save(userId,screeningReview.getUserScreening().getUser().getId(),reviewId,null); - + System.out.println("testing"); int complainCount = screeningReview.getComplaintCount(); + System.out.println(complainCount); if (complainCount == 4) { incrementComplaintCount(screeningReview); // Get user from the screeningReview User user = screeningReview.getUserScreening().getUser(); deActivateUser(user); + //DeviceToken삭제 + fcmTokenAdaptor.execute(screeningReview.getUserScreening().getUser().getId()); // Delete the screeningReview changeBlindStatus(screeningReview); // Assuming there is a method to delete screeningReview } else { + System.out.println("test"); incrementComplaintCount(screeningReview); } } diff --git a/Domain/src/main/java/com/example/domains/user/enums/Genre.java b/Domain/src/main/java/com/example/domains/user/enums/Genre.java index 17e507f..b0e16cd 100644 --- a/Domain/src/main/java/com/example/domains/user/enums/Genre.java +++ b/Domain/src/main/java/com/example/domains/user/enums/Genre.java @@ -16,13 +16,13 @@ public enum Genre { ACTION("액션"), WEST("서부극"), GANG("갱스터"), - NOIRE("누아르"), + NOIRE("누와르"), SUSPENSE("미스터리"), THRILLER("스릴러"), HORROR("공포"), WAR("전쟁"), SF("SF"), - DETECTIVE("참정"), + DETECTIVE("탐정"), FANTASY("판타지"), ADVENTURE("모험");