From b2fc9c3b967ca79c0a67000dec1b32077fe142e2 Mon Sep 17 00:00:00 2001 From: jemin Date: Sun, 28 Jan 2024 12:20:26 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=ED=8C=8C=EC=9D=BC=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/OAuthSignupRequestDto.java | 10 ++++++- .../notification/NotificationController.java | 29 +++++-------------- .../notification/NotificationService.java | 7 ----- .../domain/scrap/PlaceScrapService.java | 17 +++++------ .../common/mock/MockFileService.java | 5 ++-- 5 files changed, 25 insertions(+), 43 deletions(-) diff --git a/core/core-api/src/main/java/cmc/mellyserver/auth/service/dto/request/OAuthSignupRequestDto.java b/core/core-api/src/main/java/cmc/mellyserver/auth/service/dto/request/OAuthSignupRequestDto.java index 0395c7d0..9b50d0ea 100644 --- a/core/core-api/src/main/java/cmc/mellyserver/auth/service/dto/request/OAuthSignupRequestDto.java +++ b/core/core-api/src/main/java/cmc/mellyserver/auth/service/dto/request/OAuthSignupRequestDto.java @@ -22,7 +22,15 @@ public record OAuthSignupRequestDto( ) { public User toEntity() { - return null; + return User.builder() + .email(email) + .socialId(socialId) + .provider(provider) + .nickname(nickname) + .gender(gender) + .ageGroup(ageGroup) + .fcmToken(fcmToken) + .build(); } } diff --git a/core/core-api/src/main/java/cmc/mellyserver/controller/notification/NotificationController.java b/core/core-api/src/main/java/cmc/mellyserver/controller/notification/NotificationController.java index 085cb3d9..9df19481 100644 --- a/core/core-api/src/main/java/cmc/mellyserver/controller/notification/NotificationController.java +++ b/core/core-api/src/main/java/cmc/mellyserver/controller/notification/NotificationController.java @@ -13,7 +13,6 @@ import cmc.mellyserver.auth.common.resolver.LoginUser; import cmc.mellyserver.controller.notification.dto.request.NotificationCheckRequest; import cmc.mellyserver.controller.notification.dto.response.NotificationResponse; -import cmc.mellyserver.dbcore.notification.enums.NotificationType; import cmc.mellyserver.domain.notification.NotificationService; import cmc.mellyserver.domain.notification.dto.response.NotificationOnOffResponseDto; import cmc.mellyserver.support.response.ApiResponse; @@ -27,6 +26,13 @@ public class NotificationController { private final NotificationService notificationService; + @GetMapping + public ResponseEntity>> getNotifications(@CurrentUser LoginUser loginUser) { + + List notificationList = notificationService.getNotificationList(loginUser.getId()); + return ApiResponse.success(SuccessCode.SELECT_SUCCESS, notificationList); + } + @GetMapping("/setting") public ResponseEntity> getNotificationStatus( @CurrentUser LoginUser loginUser) { @@ -35,19 +41,6 @@ public ResponseEntity> getNotification return ApiResponse.success(SuccessCode.SELECT_SUCCESS, notificationOnOff); } - @PostMapping - public ResponseEntity> saveNotification() { - notificationService.createNotification("내용", NotificationType.COMMENT_ENROLL, 1L, 1L); - return ApiResponse.success(SuccessCode.INSERT_SUCCESS); - } - - @GetMapping - public ResponseEntity>> getNotifications(@CurrentUser LoginUser loginUser) { - - List notificationList = notificationService.getNotificationList(loginUser.getId()); - return ApiResponse.success(SuccessCode.SELECT_SUCCESS, notificationList); - } - @PostMapping("/setting") public ResponseEntity> changeAppPushStatus(@CurrentUser LoginUser loginUser, Boolean status) { @@ -62,14 +55,6 @@ public ResponseEntity> changeCommentPushStatus(@CurrentUser Lo return ApiResponse.success(SuccessCode.INSERT_SUCCESS); } - @PostMapping("/setting/comment/like") - public ResponseEntity> changeCommentLikePushStatus(@CurrentUser LoginUser loginUser, - Boolean status) { - - notificationService.changeCommentLikePushStatus(loginUser.getId(), status); - return ApiResponse.success(SuccessCode.INSERT_SUCCESS); - } - @PostMapping("/check") public ResponseEntity> checkNotification( @RequestBody NotificationCheckRequest notificationCheckRequest) { diff --git a/core/core-api/src/main/java/cmc/mellyserver/domain/notification/NotificationService.java b/core/core-api/src/main/java/cmc/mellyserver/domain/notification/NotificationService.java index d71d55e3..61ea3b35 100644 --- a/core/core-api/src/main/java/cmc/mellyserver/domain/notification/NotificationService.java +++ b/core/core-api/src/main/java/cmc/mellyserver/domain/notification/NotificationService.java @@ -46,13 +46,6 @@ public void changeAppPushStatus(Long userId, boolean status) { user.changeAppPushStatus(status); } - @Transactional - public void changeCommentLikePushStatus(Long userId, boolean status) { - - User user = userReader.findById(userId); - user.changeCommentLikePushStatus(status); - } - @Transactional public void changeCommentPushStatus(Long userId, boolean status) { diff --git a/core/core-api/src/main/java/cmc/mellyserver/domain/scrap/PlaceScrapService.java b/core/core-api/src/main/java/cmc/mellyserver/domain/scrap/PlaceScrapService.java index 42b0a660..3d71f19e 100644 --- a/core/core-api/src/main/java/cmc/mellyserver/domain/scrap/PlaceScrapService.java +++ b/core/core-api/src/main/java/cmc/mellyserver/domain/scrap/PlaceScrapService.java @@ -39,24 +39,21 @@ public class PlaceScrapService { private final PlaceScrapValidator placeScrapValidator; - public ScrapedPlaceListResponse findScrapedPlace(final Long lastId, final Pageable pageable, final Long userId, - final ScrapType scrapType) { - - Slice scrapedPlaces = placeScrapReader.getUserScrapedPlaces(lastId, pageable, userId, + public ScrapedPlaceListResponse findScrapedPlace(Long lastId, Pageable pageable, Long userId, ScrapType scrapType) { + Slice places = placeScrapReader.getUserScrapedPlaces(lastId, pageable, userId, scrapType); - return ScrapedPlaceListResponse.of(scrapedPlaces.getContent(), scrapedPlaces.hasNext()); + return ScrapedPlaceListResponse.of(places.getContent(), places.hasNext()); } @Cacheable(cacheNames = CacheNames.SCRAP, key = "#userId") - public List countByPlaceScrapType(final Long userId) { - + public List countByPlaceScrapType(Long userId) { return placeScrapReader.getScrapedPlaceGrouping(userId); } - @CacheEvict(cacheNames = CacheNames.SCRAP, key = "#userId") @CheckPlaceExist + @CacheEvict(cacheNames = CacheNames.SCRAP, key = "#userId") @Transactional - public void createScrap(final Long userId, final CreatePlaceScrapRequestDto createPlaceScrapRequestDto) { + public void createScrap(Long userId, CreatePlaceScrapRequestDto createPlaceScrapRequestDto) { Place place = placeReader.read(createPlaceScrapRequestDto.getPosition()); User user = userReader.findById(userId); @@ -66,7 +63,7 @@ public void createScrap(final Long userId, final CreatePlaceScrapRequestDto crea @CacheEvict(cacheNames = CacheNames.SCRAP, key = "#userId") @Transactional - public void removeScrap(final Long userId, final Position position) { + public void removeScrap(Long userId, Position position) { Place place = placeReader.read(position); placeScrapValidator.validateExistedScrap(userId, place.getId()); diff --git a/core/core-api/src/test/java/cmc/mellyserver/common/mock/MockFileService.java b/core/core-api/src/test/java/cmc/mellyserver/common/mock/MockFileService.java index 59f578ab..4c291657 100644 --- a/core/core-api/src/test/java/cmc/mellyserver/common/mock/MockFileService.java +++ b/core/core-api/src/test/java/cmc/mellyserver/common/mock/MockFileService.java @@ -15,7 +15,7 @@ public class MockFileService implements FileService { @Override - public List saveFileList(Long userId, List multipartFiles) { + public List saveFiles(Long userId, List multipartFiles) { return null; } @@ -29,7 +29,6 @@ public void deleteFile(String fileName) { } @Override - - public void deleteFileList(List deleteFileIds) { + public void deleteFiles(List deleteFileIds) { } }