From 3924f6098b0392ed123b66971ca1229ba00c14d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=B0=EC=A4=80=ED=98=B8?= <114082026+BaeJunH0@users.noreply.github.com> Date: Wed, 13 Nov 2024 20:33:23 +0900 Subject: [PATCH 01/49] =?UTF-8?q?[docs]=20=EB=A6=AC=ED=8F=AC=EC=A7=80?= =?UTF-8?q?=ED=86=A0=EB=A6=AC=20=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index e514998e..e4c57d7c 100644 --- a/README.md +++ b/README.md @@ -46,5 +46,15 @@ ![JMeter](https://img.shields.io/badge/JMeter-D22128?style=flat-square&logo=apachejmeter&logoColor=white) ![JUnit](https://img.shields.io/badge/JUnit-25A162?style=flat-square&logo=junit5&logoColor=white) +## Repo 정보 +![GitHub language count](https://img.shields.io/github/languages/count/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub top language](https://img.shields.io/github/languages/top/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub repo size](https://img.shields.io/github/repo-size/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub open issues](https://img.shields.io/github/issues/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub closed issues](https://img.shields.io/github/issues-closed/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub commit activity](https://img.shields.io/github/commit-activity/w/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub last commit](https://img.shields.io/github/last-commit/kakao-tech-campus-2nd-step3/Team7_BE) + ## 사용 예시 > 나중에 시연 영상 첨부하기 From 83c9f69604a669eccc5688983238b46d684de853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=B0=EC=A4=80=ED=98=B8?= <114082026+BaeJunH0@users.noreply.github.com> Date: Wed, 13 Nov 2024 21:09:13 +0900 Subject: [PATCH 02/49] =?UTF-8?q?[docs]=20=EB=B0=B0=ED=8F=AC=EB=A7=81?= =?UTF-8?q?=ED=81=AC,=20ERD=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e4c57d7c..9f2d3b5a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,25 @@ # Project : Inplace ( Team7_BE ) +## 배포 링크 +> [**BackEnd**](https://api.inplace.my) : _api.inplace.my_ +> +> [**FrontEnd**](https://inplace.my) : _inplace.my_ + +## 개발 Repository 정보 +![GitHub language count](https://img.shields.io/github/languages/count/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub top language](https://img.shields.io/github/languages/top/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub repo size](https://img.shields.io/github/repo-size/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub open issues](https://img.shields.io/github/issues/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub closed issues](https://img.shields.io/github/issues-closed/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub commit activity](https://img.shields.io/github/commit-activity/w/kakao-tech-campus-2nd-step3/Team7_BE) +![GitHub last commit](https://img.shields.io/github/last-commit/kakao-tech-campus-2nd-step3/Team7_BE) + ## 기획 의도 > **데이트 코스의 단조로움** 이라는 생각에서 시작한 저희의 아이디어는 인스타, 유튜브 등의 SNS 플랫폼의 성장과 함께 등장한 '인플루언서' 라는 개념에 집중하여, **인플루언서가 방문한 주변 장소에 대한 정보를 서비스 해보자!** 라는 생각으로 이어졌고, 이를 개인별 맞춤 장소 추천, 방문시 정보 발송 및 알림, 리뷰와 같은 기능으로 풀어내어 **Inplace** 라는 저희만의 웹 어플리케이션으로 구현해보았습니다. -> + +## 주요 기능 + ## 참여자 [![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-) @@ -21,6 +38,13 @@ +## 프로그램 구조 +- **ERD** + + ERD + +- + ## 주요 종속성 버전 - Spring Boots 3.3.3 - Java 17 LTS @@ -46,15 +70,9 @@ ![JMeter](https://img.shields.io/badge/JMeter-D22128?style=flat-square&logo=apachejmeter&logoColor=white) ![JUnit](https://img.shields.io/badge/JUnit-25A162?style=flat-square&logo=junit5&logoColor=white) -## Repo 정보 -![GitHub language count](https://img.shields.io/github/languages/count/kakao-tech-campus-2nd-step3/Team7_BE) -![GitHub top language](https://img.shields.io/github/languages/top/kakao-tech-campus-2nd-step3/Team7_BE) -![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/kakao-tech-campus-2nd-step3/Team7_BE) -![GitHub repo size](https://img.shields.io/github/repo-size/kakao-tech-campus-2nd-step3/Team7_BE) -![GitHub open issues](https://img.shields.io/github/issues/kakao-tech-campus-2nd-step3/Team7_BE) -![GitHub closed issues](https://img.shields.io/github/issues-closed/kakao-tech-campus-2nd-step3/Team7_BE) -![GitHub commit activity](https://img.shields.io/github/commit-activity/w/kakao-tech-campus-2nd-step3/Team7_BE) -![GitHub last commit](https://img.shields.io/github/last-commit/kakao-tech-campus-2nd-step3/Team7_BE) +![Git](https://img.shields.io/badge/Git-F05032?style=flat-square&logo=git&logoColor=white) +![GitHub](https://img.shields.io/badge/GitHub-181717?style=flat-square&logo=github&logoColor=white) +![GitHub Actions](https://img.shields.io/badge/GitHub%20Actions-2088FF?style=flat-square&logo=githubactions&logoColor=white) ## 사용 예시 > 나중에 시연 영상 첨부하기 From f9d939f0ae361eeb0493ca08c854e096488e62d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=B0=EC=A4=80=ED=98=B8?= <114082026+BaeJunH0@users.noreply.github.com> Date: Wed, 13 Nov 2024 21:49:33 +0900 Subject: [PATCH 03/49] =?UTF-8?q?[docs]=20=EB=AC=B8=EB=8B=A8=20=EC=88=9C?= =?UTF-8?q?=EC=84=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9f2d3b5a..cd09f66e 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,6 @@ ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/kakao-tech-campus-2nd-step3/Team7_BE) ![GitHub last commit](https://img.shields.io/github/last-commit/kakao-tech-campus-2nd-step3/Team7_BE) -## 기획 의도 -> **데이트 코스의 단조로움** 이라는 생각에서 시작한 저희의 아이디어는 인스타, 유튜브 등의 SNS 플랫폼의 성장과 함께 등장한 '인플루언서' 라는 개념에 집중하여, **인플루언서가 방문한 주변 장소에 대한 정보를 서비스 해보자!** 라는 생각으로 이어졌고, 이를 개인별 맞춤 장소 추천, 방문시 정보 발송 및 알림, 리뷰와 같은 기능으로 풀어내어 **Inplace** 라는 저희만의 웹 어플리케이션으로 구현해보았습니다. - -## 주요 기능 - ## 참여자 [![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-) @@ -38,6 +33,11 @@ +## 기획 의도 +> **데이트 코스의 단조로움** 이라는 생각에서 시작한 저희의 아이디어는 인스타, 유튜브 등의 SNS 플랫폼의 성장과 함께 등장한 '인플루언서' 라는 개념에 집중하여, **인플루언서가 방문한 주변 장소에 대한 정보를 서비스 해보자!** 라는 생각으로 이어졌고, 이를 개인별 맞춤 장소 추천, 방문시 정보 발송 및 알림, 리뷰와 같은 기능으로 풀어내어 **Inplace** 라는 저희만의 웹 어플리케이션으로 구현해보았습니다. + +## 주요 기능 + ## 프로그램 구조 - **ERD** From aa48bf92832fd3bd517c7eda97d82c8725dcefec Mon Sep 17 00:00:00 2001 From: BaeJunho Date: Wed, 13 Nov 2024 21:55:56 +0900 Subject: [PATCH 04/49] =?UTF-8?q?[refactor]=20=EA=B5=AC=ED=98=84=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=EC=9D=98=20=EC=BD=94=EB=93=9C=20=EC=84=9C?= =?UTF-8?q?=EC=8B=9D=20=EB=B0=8F=20=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20import=20=EB=AC=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team7/inplace/InplaceApplication.java | 10 +- .../inplace/admin/AdminPageController.java | 3 +- .../inplace/admin/ErrorLogController.java | 2 +- .../crawling/application/AddressUtil.java | 7 +- .../application/VideoCrawlingService.java | 3 +- .../application/YoutubeCrawlingService.java | 5 +- .../application/dto/CrawlingInfo.java | 5 +- .../crawling/client/KakaoMapClient.java | 3 +- .../crawling/client/YoutubeClient.java | 7 +- .../crawling/domain/YoutubeChannel.java | 10 +- .../persistence/YoutubeChannelRepository.java | 3 +- .../FavoriteInfluencerService.java | 11 +- .../dto/FavoriteInfluencerCommand.java | 4 +- .../dto/FavoriteInfluencerListCommand.java | 4 +- .../domain/FavoriteInfluencer.java | 13 +- .../FavoriteInfluencerRepository.java | 7 +- .../FavoriteInfluencerController.java | 2 +- .../dto/InfluencerLikeRequest.java | 4 +- .../dto/InfluencerListLikeRequest.java | 7 +- .../inplace/global/annotation/Facade.java | 7 +- .../inplace/global/exception/ErrorLog.java | 6 +- .../global/exception/ErrorLogRepository.java | 3 +- .../exception/InplaceExceptionHandler.java | 3 +- .../global/exception/code/VideoErrorCode.java | 2 +- .../kakao/config/KakaoApiProperties.java | 6 +- .../inplace/global/rest/WebClientConfig.java | 13 +- .../scheduler/ScheduledExecutorConfig.java | 5 +- .../application/InfluencerService.java | 23 +-- .../application/dto/InfluencerCommand.java | 12 +- .../application/dto/InfluencerInfo.java | 20 +-- .../inplace/influencer/domain/Influencer.java | 10 +- .../persistence/InfluencerRepository.java | 3 +- .../presentation/InfluencerController.java | 30 ++-- .../InfluencerControllerApiSpec.java | 5 +- .../dto/InfluencerNameResponse.java | 4 +- .../presentation/dto/InfluencerRequest.java | 12 +- .../presentation/dto/InfluencerResponse.java | 20 +-- .../inplace/likedPlace/domain/LikedPlace.java | 14 +- .../persistence/LikedPlaceRepository.java | 3 +- .../application/OauthTokenService.java | 16 +- .../command/OauthTokenCommand.java | 6 +- .../inplace/oauthToken/domain/OauthToken.java | 15 +- .../persistence/OauthTokenRepository.java | 3 +- .../place/application/CategoryService.java | 7 +- .../place/application/PlaceService.java | 153 +++++++++--------- .../application/command/PlaceLikeCommand.java | 4 +- .../application/command/PlacesCommand.java | 7 +- .../place/application/dto/LikedPlaceInfo.java | 20 +-- .../application/dto/PlaceDetailInfo.java | 99 ++++++------ .../place/application/dto/PlaceInfo.java | 48 +++--- .../team7/inplace/place/domain/Address.java | 7 +- .../inplace/place/domain/Coordinate.java | 4 +- .../team7/inplace/place/domain/Place.java | 15 +- .../persistence/PlaceCustomRepository.java | 27 ++-- .../PlaceCustomRepositoryImpl.java | 107 ++++++------ .../place/presentation/PlaceController.java | 74 ++++----- .../presentation/PlaceControllerApiSpec.java | 49 +++--- .../presentation/dto/CategoriesResponse.java | 3 +- .../presentation/dto/PlaceDetailResponse.java | 52 +++--- .../presentation/dto/PlaceLikeRequest.java | 4 +- .../place/presentation/dto/ReviewRequest.java | 4 +- .../presentation/dto/ReviewResponse.java | 27 ++-- .../application/KakaoMessageService.java | 39 ++--- .../application/PlaceMessageFacade.java | 9 +- .../command/PlaceMessageCommand.java | 26 +-- .../PlaceMessageControllerApiSpec.java | 4 +- .../inplace/placeMessage/util/Button.java | 4 +- .../inplace/placeMessage/util/Content.java | 26 +-- .../placeMessage/util/FeedTemplate.java | 17 +- .../placeMessage/util/KakaoMessageMaker.java | 8 +- .../team7/inplace/placeMessage/util/Link.java | 8 +- .../placeMessage/util/LocationTemplate.java | 23 +-- .../review/application/ReviewService.java | 7 +- .../review/application/dto/MyReviewInfo.java | 35 ++-- .../review/application/dto/ReviewCommand.java | 12 +- .../review/application/dto/ReviewInfo.java | 27 ++-- .../team7/inplace/review/domain/Review.java | 19 +-- .../application/CurrentUserProvider.java | 2 +- .../application/CustomOAuth2UserService.java | 29 ++-- .../application/dto/CustomOAuth2User.java | 19 +-- .../application/dto/KakaoOAuthResponse.java | 2 +- .../security/config/JwtProperties.java | 6 +- .../inplace/security/config/RedisConfig.java | 68 ++++---- .../security/config/SecurityConfig.java | 82 +++++----- .../config/SecurityHandlerConfig.java | 4 +- .../config/SecurityServiceConfig.java | 8 +- .../LoginAuthenticationEntryPoint.java | 5 +- .../security/filter/AuthorizationFilter.java | 47 +++--- .../filter/ExceptionHandlingFilter.java | 15 +- .../handler/CustomAccessDeniedHandler.java | 5 +- .../handler/CustomFailureHandler.java | 15 +- .../handler/CustomSuccessHandler.java | 35 ++-- .../inplace/security/util/CookieUtil.java | 12 +- .../team7/inplace/security/util/JwtUtil.java | 31 ++-- .../token/application/RefreshTokenFacade.java | 6 +- .../application/RefreshTokenService.java | 4 +- .../token/application/dto/TokenCommand.java | 4 +- .../presentation/RefreshTokenController.java | 12 +- .../RefreshTokenControllerApiSpec.java | 10 +- .../inplace/user/application/UserService.java | 11 +- .../user/application/dto/UserCommand.java | 16 +- .../user/application/dto/UserInfo.java | 4 +- .../java/team7/inplace/user/domain/User.java | 9 +- .../user/persistence/UserRepository.java | 3 +- .../user/presentation/UserController.java | 20 +-- .../presentation/UserControllerApiSepc.java | 12 +- .../dto/LikedInfluencerResponse.java | 20 +-- .../presentation/dto/LikedPlaceResponse.java | 20 +-- .../presentation/dto/MyReviewResponse.java | 23 +-- .../presentation/dto/UserInfoResponse.java | 4 +- .../video/application/VideoFacade.java | 6 +- .../team7/inplace/video/domain/Video.java | 13 +- .../video/presentation/VideoController.java | 7 +- .../presentation/VideoControllerApiSpec.java | 1 - .../presentation/dto/VideoSearchParams.java | 2 +- src/main/resources/application-db.yaml | 2 +- 116 files changed, 937 insertions(+), 983 deletions(-) diff --git a/src/main/java/team7/inplace/InplaceApplication.java b/src/main/java/team7/inplace/InplaceApplication.java index 887c1415..143ddd36 100644 --- a/src/main/java/team7/inplace/InplaceApplication.java +++ b/src/main/java/team7/inplace/InplaceApplication.java @@ -11,11 +11,11 @@ @SpringBootApplication @ConfigurationPropertiesScan @EnableJpaRepositories( - basePackages = "team7.inplace", - excludeFilters = @ComponentScan.Filter( - type = FilterType.ASSIGNABLE_TYPE, - classes = {RefreshTokenRepository.class} - ) + basePackages = "team7.inplace", + excludeFilters = @ComponentScan.Filter( + type = FilterType.ASSIGNABLE_TYPE, + classes = {RefreshTokenRepository.class} + ) ) public class InplaceApplication { diff --git a/src/main/java/team7/inplace/admin/AdminPageController.java b/src/main/java/team7/inplace/admin/AdminPageController.java index bee75868..2ef41504 100644 --- a/src/main/java/team7/inplace/admin/AdminPageController.java +++ b/src/main/java/team7/inplace/admin/AdminPageController.java @@ -1,6 +1,5 @@ package team7.inplace.admin; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -15,6 +14,8 @@ import team7.inplace.video.domain.Video; import team7.inplace.video.persistence.VideoRepository; +import java.util.List; + @Controller @RequiredArgsConstructor @RequestMapping("/admin") diff --git a/src/main/java/team7/inplace/admin/ErrorLogController.java b/src/main/java/team7/inplace/admin/ErrorLogController.java index e73bdfb3..91ca7943 100644 --- a/src/main/java/team7/inplace/admin/ErrorLogController.java +++ b/src/main/java/team7/inplace/admin/ErrorLogController.java @@ -20,7 +20,7 @@ public ResponseEntity resolveErrorLog(@PathVariable Long id) { errorLog.resolve(); errorLogRepository.save(errorLog); }); - + return ResponseEntity.ok().build(); } } diff --git a/src/main/java/team7/inplace/crawling/application/AddressUtil.java b/src/main/java/team7/inplace/crawling/application/AddressUtil.java index cfe07276..0f38256e 100644 --- a/src/main/java/team7/inplace/crawling/application/AddressUtil.java +++ b/src/main/java/team7/inplace/crawling/application/AddressUtil.java @@ -1,11 +1,12 @@ package team7.inplace.crawling.application; -import static lombok.AccessLevel.PRIVATE; - import com.fasterxml.jackson.databind.JsonNode; +import lombok.NoArgsConstructor; + import java.util.regex.Matcher; import java.util.regex.Pattern; -import lombok.NoArgsConstructor; + +import static lombok.AccessLevel.PRIVATE; @NoArgsConstructor(access = PRIVATE) public final class AddressUtil { diff --git a/src/main/java/team7/inplace/crawling/application/VideoCrawlingService.java b/src/main/java/team7/inplace/crawling/application/VideoCrawlingService.java index 45b0eb85..cd7bb06d 100644 --- a/src/main/java/team7/inplace/crawling/application/VideoCrawlingService.java +++ b/src/main/java/team7/inplace/crawling/application/VideoCrawlingService.java @@ -1,6 +1,5 @@ package team7.inplace.crawling.application; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -8,6 +7,8 @@ import team7.inplace.crawling.client.YoutubeClient; import team7.inplace.video.persistence.VideoRepository; +import java.util.List; + @Service @RequiredArgsConstructor public class VideoCrawlingService { diff --git a/src/main/java/team7/inplace/crawling/application/YoutubeCrawlingService.java b/src/main/java/team7/inplace/crawling/application/YoutubeCrawlingService.java index 1e47107f..93a579d2 100644 --- a/src/main/java/team7/inplace/crawling/application/YoutubeCrawlingService.java +++ b/src/main/java/team7/inplace/crawling/application/YoutubeCrawlingService.java @@ -1,7 +1,5 @@ package team7.inplace.crawling.application; -import java.util.List; -import java.util.Objects; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -13,6 +11,9 @@ import team7.inplace.global.exception.InplaceException; import team7.inplace.global.exception.code.ChannelErrorCode; +import java.util.List; +import java.util.Objects; + @Slf4j @Service @RequiredArgsConstructor diff --git a/src/main/java/team7/inplace/crawling/application/dto/CrawlingInfo.java b/src/main/java/team7/inplace/crawling/application/dto/CrawlingInfo.java index 190a5a9b..62b900a4 100644 --- a/src/main/java/team7/inplace/crawling/application/dto/CrawlingInfo.java +++ b/src/main/java/team7/inplace/crawling/application/dto/CrawlingInfo.java @@ -1,12 +1,13 @@ package team7.inplace.crawling.application.dto; import com.fasterxml.jackson.databind.JsonNode; -import java.util.List; -import java.util.Objects; import team7.inplace.crawling.client.dto.PlaceNode; import team7.inplace.place.application.command.PlacesCommand; import team7.inplace.video.application.command.VideoCommand; +import java.util.List; +import java.util.Objects; + public class CrawlingInfo { public record VideoPlaceInfo( Long influencerId, diff --git a/src/main/java/team7/inplace/crawling/client/KakaoMapClient.java b/src/main/java/team7/inplace/crawling/client/KakaoMapClient.java index e5e2284d..4f9ace3c 100644 --- a/src/main/java/team7/inplace/crawling/client/KakaoMapClient.java +++ b/src/main/java/team7/inplace/crawling/client/KakaoMapClient.java @@ -1,7 +1,6 @@ package team7.inplace.crawling.client; import com.fasterxml.jackson.databind.JsonNode; -import java.util.Objects; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpEntity; @@ -15,6 +14,8 @@ import team7.inplace.global.exception.code.PlaceErrorCode; import team7.inplace.global.kakao.config.KakaoApiProperties; +import java.util.Objects; + @Slf4j @Component @RequiredArgsConstructor diff --git a/src/main/java/team7/inplace/crawling/client/YoutubeClient.java b/src/main/java/team7/inplace/crawling/client/YoutubeClient.java index 71784077..ea5ffbe0 100644 --- a/src/main/java/team7/inplace/crawling/client/YoutubeClient.java +++ b/src/main/java/team7/inplace/crawling/client/YoutubeClient.java @@ -1,14 +1,15 @@ package team7.inplace.crawling.client; import com.fasterxml.jackson.databind.JsonNode; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + @Slf4j @Component public class YoutubeClient { diff --git a/src/main/java/team7/inplace/crawling/domain/YoutubeChannel.java b/src/main/java/team7/inplace/crawling/domain/YoutubeChannel.java index 1fadeab8..100a896d 100644 --- a/src/main/java/team7/inplace/crawling/domain/YoutubeChannel.java +++ b/src/main/java/team7/inplace/crawling/domain/YoutubeChannel.java @@ -1,16 +1,12 @@ package team7.inplace.crawling.domain; -import static jakarta.persistence.EnumType.STRING; - -import jakarta.persistence.Entity; -import jakarta.persistence.Enumerated; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; +import static jakarta.persistence.EnumType.STRING; + @Getter @Entity(name = "youtube_channel") @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/src/main/java/team7/inplace/crawling/persistence/YoutubeChannelRepository.java b/src/main/java/team7/inplace/crawling/persistence/YoutubeChannelRepository.java index 3c5146fa..0197810e 100644 --- a/src/main/java/team7/inplace/crawling/persistence/YoutubeChannelRepository.java +++ b/src/main/java/team7/inplace/crawling/persistence/YoutubeChannelRepository.java @@ -1,9 +1,10 @@ package team7.inplace.crawling.persistence; -import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import team7.inplace.crawling.domain.YoutubeChannel; +import java.util.Optional; + public interface YoutubeChannelRepository extends JpaRepository { Optional findYoutubeChannelByPlayListUUID(String playListUUID); } diff --git a/src/main/java/team7/inplace/favoriteInfluencer/application/FavoriteInfluencerService.java b/src/main/java/team7/inplace/favoriteInfluencer/application/FavoriteInfluencerService.java index b54bb2ad..0b37fb99 100644 --- a/src/main/java/team7/inplace/favoriteInfluencer/application/FavoriteInfluencerService.java +++ b/src/main/java/team7/inplace/favoriteInfluencer/application/FavoriteInfluencerService.java @@ -1,6 +1,5 @@ package team7.inplace.favoriteInfluencer.application; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -19,6 +18,8 @@ import team7.inplace.security.util.AuthorizationUtil; import team7.inplace.user.domain.User; +import java.util.List; + @RequiredArgsConstructor @Service public class FavoriteInfluencerService { @@ -55,8 +56,8 @@ public void likeToManyInfluencer(FavoriteInfluencerListCommand command) { private void processFavoriteInfluencer(User user, Influencer influencer, Boolean likes) { FavoriteInfluencer favorite = favoriteRepository - .findByUserIdAndInfluencerId(user.getId(), influencer.getId()) - .orElseGet(() -> new FavoriteInfluencer(user, influencer)); // 존재하지 않으면 새로 생성 + .findByUserIdAndInfluencerId(user.getId(), influencer.getId()) + .orElseGet(() -> new FavoriteInfluencer(user, influencer)); // 존재하지 않으면 새로 생성 favorite.updateLike(likes); if (favorite.getId() == null) { @@ -67,10 +68,10 @@ private void processFavoriteInfluencer(User user, Influencer influencer, Boolean @Transactional(readOnly = true) public Page getFavoriteInfluencers(Long userId, Pageable pageable) { Page influencerPage = favoriteRepository.findByUserIdAndIsLikedTrue( - userId, pageable); + userId, pageable); return influencerPage.map( - favorite -> InfluencerInfo.from(favorite.getInfluencer(), favorite.isLiked())); + favorite -> InfluencerInfo.from(favorite.getInfluencer(), favorite.isLiked())); } } diff --git a/src/main/java/team7/inplace/favoriteInfluencer/application/dto/FavoriteInfluencerCommand.java b/src/main/java/team7/inplace/favoriteInfluencer/application/dto/FavoriteInfluencerCommand.java index e9f4bc8f..f2f318c0 100644 --- a/src/main/java/team7/inplace/favoriteInfluencer/application/dto/FavoriteInfluencerCommand.java +++ b/src/main/java/team7/inplace/favoriteInfluencer/application/dto/FavoriteInfluencerCommand.java @@ -1,8 +1,8 @@ package team7.inplace.favoriteInfluencer.application.dto; public record FavoriteInfluencerCommand( - Long influencerId, - Boolean likes + Long influencerId, + Boolean likes ) { } diff --git a/src/main/java/team7/inplace/favoriteInfluencer/application/dto/FavoriteInfluencerListCommand.java b/src/main/java/team7/inplace/favoriteInfluencer/application/dto/FavoriteInfluencerListCommand.java index ebf7dd67..3a167412 100644 --- a/src/main/java/team7/inplace/favoriteInfluencer/application/dto/FavoriteInfluencerListCommand.java +++ b/src/main/java/team7/inplace/favoriteInfluencer/application/dto/FavoriteInfluencerListCommand.java @@ -3,8 +3,8 @@ import java.util.List; public record FavoriteInfluencerListCommand( - List influencerIds, - Boolean likes + List influencerIds, + Boolean likes ) { } diff --git a/src/main/java/team7/inplace/favoriteInfluencer/domain/FavoriteInfluencer.java b/src/main/java/team7/inplace/favoriteInfluencer/domain/FavoriteInfluencer.java index 5d0fa4f2..0b8612f9 100644 --- a/src/main/java/team7/inplace/favoriteInfluencer/domain/FavoriteInfluencer.java +++ b/src/main/java/team7/inplace/favoriteInfluencer/domain/FavoriteInfluencer.java @@ -1,14 +1,6 @@ package team7.inplace.favoriteInfluencer.domain; -import static jakarta.persistence.GenerationType.IDENTITY; -import static lombok.AccessLevel.PROTECTED; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; +import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; @@ -16,6 +8,9 @@ import team7.inplace.influencer.domain.Influencer; import team7.inplace.user.domain.User; +import static jakarta.persistence.GenerationType.IDENTITY; +import static lombok.AccessLevel.PROTECTED; + @Getter @RequiredArgsConstructor @NoArgsConstructor(access = PROTECTED) diff --git a/src/main/java/team7/inplace/favoriteInfluencer/persistent/FavoriteInfluencerRepository.java b/src/main/java/team7/inplace/favoriteInfluencer/persistent/FavoriteInfluencerRepository.java index c8e8f5ee..ead22138 100644 --- a/src/main/java/team7/inplace/favoriteInfluencer/persistent/FavoriteInfluencerRepository.java +++ b/src/main/java/team7/inplace/favoriteInfluencer/persistent/FavoriteInfluencerRepository.java @@ -1,8 +1,5 @@ package team7.inplace.favoriteInfluencer.persistent; -import java.util.List; -import java.util.Optional; -import java.util.Set; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; @@ -10,6 +7,10 @@ import org.springframework.data.repository.query.Param; import team7.inplace.favoriteInfluencer.domain.FavoriteInfluencer; +import java.util.List; +import java.util.Optional; +import java.util.Set; + public interface FavoriteInfluencerRepository extends JpaRepository { List findByUserId(Long userId); diff --git a/src/main/java/team7/inplace/favoriteInfluencer/presentation/FavoriteInfluencerController.java b/src/main/java/team7/inplace/favoriteInfluencer/presentation/FavoriteInfluencerController.java index f60c8576..72baebb8 100644 --- a/src/main/java/team7/inplace/favoriteInfluencer/presentation/FavoriteInfluencerController.java +++ b/src/main/java/team7/inplace/favoriteInfluencer/presentation/FavoriteInfluencerController.java @@ -29,7 +29,7 @@ public ResponseEntity likeToInfluencer(@RequestBody InfluencerLikeRequest @PostMapping("/multiple/likes") public ResponseEntity likeToManyInfluencer( - @RequestBody InfluencerListLikeRequest request) { + @RequestBody InfluencerListLikeRequest request) { FavoriteInfluencerListCommand command = request.toCommand(); favoriteInfluencerService.likeToManyInfluencer(command); return new ResponseEntity<>(HttpStatus.OK); diff --git a/src/main/java/team7/inplace/favoriteInfluencer/presentation/dto/InfluencerLikeRequest.java b/src/main/java/team7/inplace/favoriteInfluencer/presentation/dto/InfluencerLikeRequest.java index 0ee70a78..5c2f9fc1 100644 --- a/src/main/java/team7/inplace/favoriteInfluencer/presentation/dto/InfluencerLikeRequest.java +++ b/src/main/java/team7/inplace/favoriteInfluencer/presentation/dto/InfluencerLikeRequest.java @@ -3,8 +3,8 @@ import team7.inplace.favoriteInfluencer.application.dto.FavoriteInfluencerCommand; public record InfluencerLikeRequest( - Long influencerId, - Boolean likes + Long influencerId, + Boolean likes ) { public FavoriteInfluencerCommand toCommand() { diff --git a/src/main/java/team7/inplace/favoriteInfluencer/presentation/dto/InfluencerListLikeRequest.java b/src/main/java/team7/inplace/favoriteInfluencer/presentation/dto/InfluencerListLikeRequest.java index 6f5fa80a..ec4406f2 100644 --- a/src/main/java/team7/inplace/favoriteInfluencer/presentation/dto/InfluencerListLikeRequest.java +++ b/src/main/java/team7/inplace/favoriteInfluencer/presentation/dto/InfluencerListLikeRequest.java @@ -1,11 +1,12 @@ package team7.inplace.favoriteInfluencer.presentation.dto; -import java.util.List; import team7.inplace.favoriteInfluencer.application.dto.FavoriteInfluencerListCommand; +import java.util.List; + public record InfluencerListLikeRequest( - List influencerIds, - Boolean likes + List influencerIds, + Boolean likes ) { public FavoriteInfluencerListCommand toCommand() { diff --git a/src/main/java/team7/inplace/global/annotation/Facade.java b/src/main/java/team7/inplace/global/annotation/Facade.java index 1b0f2071..70fe10e2 100644 --- a/src/main/java/team7/inplace/global/annotation/Facade.java +++ b/src/main/java/team7/inplace/global/annotation/Facade.java @@ -1,13 +1,10 @@ package team7.inplace.global.annotation; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; import org.springframework.core.annotation.AliasFor; import org.springframework.stereotype.Component; +import java.lang.annotation.*; + @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented diff --git a/src/main/java/team7/inplace/global/exception/ErrorLog.java b/src/main/java/team7/inplace/global/exception/ErrorLog.java index 4c909807..d385192b 100644 --- a/src/main/java/team7/inplace/global/exception/ErrorLog.java +++ b/src/main/java/team7/inplace/global/exception/ErrorLog.java @@ -1,10 +1,6 @@ package team7.inplace.global.exception; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/team7/inplace/global/exception/ErrorLogRepository.java b/src/main/java/team7/inplace/global/exception/ErrorLogRepository.java index c25d0820..31d06bc6 100644 --- a/src/main/java/team7/inplace/global/exception/ErrorLogRepository.java +++ b/src/main/java/team7/inplace/global/exception/ErrorLogRepository.java @@ -1,8 +1,9 @@ package team7.inplace.global.exception; -import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface ErrorLogRepository extends JpaRepository { List findByIsResolvedFalse(); } diff --git a/src/main/java/team7/inplace/global/exception/InplaceExceptionHandler.java b/src/main/java/team7/inplace/global/exception/InplaceExceptionHandler.java index dd7426a6..66b30c8c 100644 --- a/src/main/java/team7/inplace/global/exception/InplaceExceptionHandler.java +++ b/src/main/java/team7/inplace/global/exception/InplaceExceptionHandler.java @@ -1,7 +1,6 @@ package team7.inplace.global.exception; import jakarta.servlet.http.HttpServletRequest; -import java.net.URI; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; @@ -10,6 +9,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +import java.net.URI; + @Slf4j @RestControllerAdvice @RequiredArgsConstructor diff --git a/src/main/java/team7/inplace/global/exception/code/VideoErrorCode.java b/src/main/java/team7/inplace/global/exception/code/VideoErrorCode.java index a1c6ea37..855ff964 100644 --- a/src/main/java/team7/inplace/global/exception/code/VideoErrorCode.java +++ b/src/main/java/team7/inplace/global/exception/code/VideoErrorCode.java @@ -6,7 +6,7 @@ @AllArgsConstructor @Getter -public enum VideoErrorCode implements ErrorCode{ +public enum VideoErrorCode implements ErrorCode { NOT_FOUND(HttpStatus.NOT_FOUND, "V001", "Can't find such video info"); private final HttpStatus httpStatus; diff --git a/src/main/java/team7/inplace/global/kakao/config/KakaoApiProperties.java b/src/main/java/team7/inplace/global/kakao/config/KakaoApiProperties.java index 13778fb7..32285510 100644 --- a/src/main/java/team7/inplace/global/kakao/config/KakaoApiProperties.java +++ b/src/main/java/team7/inplace/global/kakao/config/KakaoApiProperties.java @@ -4,9 +4,9 @@ @ConfigurationProperties(prefix = "kakao.api") public record KakaoApiProperties( - String key, - String jsKey, - String sendMessageToMeUrl + String key, + String jsKey, + String sendMessageToMeUrl ) { public String getAuthorization() { diff --git a/src/main/java/team7/inplace/global/rest/WebClientConfig.java b/src/main/java/team7/inplace/global/rest/WebClientConfig.java index b8a62531..b968aaa5 100644 --- a/src/main/java/team7/inplace/global/rest/WebClientConfig.java +++ b/src/main/java/team7/inplace/global/rest/WebClientConfig.java @@ -1,22 +1,23 @@ package team7.inplace.global.rest; -import java.time.Duration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.web.reactive.function.client.WebClient; import reactor.netty.http.client.HttpClient; +import java.time.Duration; + @Configuration public class WebClientConfig { @Bean public WebClient webClient() { return WebClient.builder() - .clientConnector(new ReactorClientHttpConnector( - HttpClient.create().responseTimeout(Duration.ofMillis(60000)) - )) - .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2 * 1024 * 1024)) - .build(); + .clientConnector(new ReactorClientHttpConnector( + HttpClient.create().responseTimeout(Duration.ofMillis(60000)) + )) + .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2 * 1024 * 1024)) + .build(); } } diff --git a/src/main/java/team7/inplace/global/scheduler/ScheduledExecutorConfig.java b/src/main/java/team7/inplace/global/scheduler/ScheduledExecutorConfig.java index afcc36c0..097a65ca 100644 --- a/src/main/java/team7/inplace/global/scheduler/ScheduledExecutorConfig.java +++ b/src/main/java/team7/inplace/global/scheduler/ScheduledExecutorConfig.java @@ -1,10 +1,11 @@ package team7.inplace.global.scheduler; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + @Configuration public class ScheduledExecutorConfig { diff --git a/src/main/java/team7/inplace/influencer/application/InfluencerService.java b/src/main/java/team7/inplace/influencer/application/InfluencerService.java index e8ec9cf9..c8a03cb4 100644 --- a/src/main/java/team7/inplace/influencer/application/InfluencerService.java +++ b/src/main/java/team7/inplace/influencer/application/InfluencerService.java @@ -1,7 +1,5 @@ package team7.inplace.influencer.application; -import java.util.List; -import java.util.Set; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -17,6 +15,9 @@ import team7.inplace.security.util.AuthorizationUtil; import team7.inplace.user.persistence.UserRepository; +import java.util.List; +import java.util.Set; + @RequiredArgsConstructor @Service public class InfluencerService { @@ -39,12 +40,12 @@ public Page getAllInfluencers(Pageable pageable) { Set likedInfluencerIds = favoriteRepository.findLikedInfluencerIdsByUserId(userId); List influencerInfos = influencersPage.stream() - .map(influencer -> { - boolean isLiked = likedInfluencerIds.contains(influencer.getId()); - return InfluencerInfo.from(influencer, isLiked); - }) - .sorted((a, b) -> Boolean.compare(b.likes(), a.likes())) - .toList(); + .map(influencer -> { + boolean isLiked = likedInfluencerIds.contains(influencer.getId()); + return InfluencerInfo.from(influencer, isLiked); + }) + .sorted((a, b) -> Boolean.compare(b.likes(), a.likes())) + .toList(); return new PageImpl<>(influencerInfos, pageable, influencersPage.getTotalElements()); } @@ -53,8 +54,8 @@ public Page getAllInfluencers(Pageable pageable) { public List getAllInfluencerNames() { List names = influencerRepository.findAllInfluencerNames(); return names.stream() - .map(InfluencerNameInfo::new) - .toList(); + .map(InfluencerNameInfo::new) + .toList(); } @Transactional @@ -67,7 +68,7 @@ public Long createInfluencer(InfluencerCommand command) { public Long updateInfluencer(Long id, InfluencerCommand command) { Influencer influencer = influencerRepository.findById(id).orElseThrow(); influencer.update(command.influencerName(), command.influencerImgUrl(), - command.influencerJob()); + command.influencerJob()); return influencer.getId(); } diff --git a/src/main/java/team7/inplace/influencer/application/dto/InfluencerCommand.java b/src/main/java/team7/inplace/influencer/application/dto/InfluencerCommand.java index c0ac6e03..99e0e9bd 100644 --- a/src/main/java/team7/inplace/influencer/application/dto/InfluencerCommand.java +++ b/src/main/java/team7/inplace/influencer/application/dto/InfluencerCommand.java @@ -3,16 +3,16 @@ import team7.inplace.influencer.domain.Influencer; public record InfluencerCommand( - String influencerName, - String influencerImgUrl, - String influencerJob + String influencerName, + String influencerImgUrl, + String influencerJob ) { public static Influencer to(InfluencerCommand influencerCommand) { return new Influencer( - influencerCommand.influencerName, - influencerCommand.influencerImgUrl, - influencerCommand.influencerJob + influencerCommand.influencerName, + influencerCommand.influencerImgUrl, + influencerCommand.influencerJob ); } } diff --git a/src/main/java/team7/inplace/influencer/application/dto/InfluencerInfo.java b/src/main/java/team7/inplace/influencer/application/dto/InfluencerInfo.java index ca82957f..7f65194a 100644 --- a/src/main/java/team7/inplace/influencer/application/dto/InfluencerInfo.java +++ b/src/main/java/team7/inplace/influencer/application/dto/InfluencerInfo.java @@ -3,20 +3,20 @@ import team7.inplace.influencer.domain.Influencer; public record InfluencerInfo( - Long influencerId, - String influencerName, - String influencerImgUrl, - String influencerJob, - boolean likes + Long influencerId, + String influencerName, + String influencerImgUrl, + String influencerJob, + boolean likes ) { public static InfluencerInfo from(Influencer influencer, boolean isLiked) { return new InfluencerInfo( - influencer.getId(), - influencer.getName(), - influencer.getImgUrl(), - influencer.getJob(), - isLiked + influencer.getId(), + influencer.getName(), + influencer.getImgUrl(), + influencer.getJob(), + isLiked ); } } diff --git a/src/main/java/team7/inplace/influencer/domain/Influencer.java b/src/main/java/team7/inplace/influencer/domain/Influencer.java index e35d1899..69154ac6 100644 --- a/src/main/java/team7/inplace/influencer/domain/Influencer.java +++ b/src/main/java/team7/inplace/influencer/domain/Influencer.java @@ -1,16 +1,12 @@ package team7.inplace.influencer.domain; -import static lombok.AccessLevel.PROTECTED; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; +import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import static lombok.AccessLevel.PROTECTED; + @Getter @NoArgsConstructor(access = PROTECTED) @AllArgsConstructor diff --git a/src/main/java/team7/inplace/influencer/persistence/InfluencerRepository.java b/src/main/java/team7/inplace/influencer/persistence/InfluencerRepository.java index 8a620738..40b4e5f5 100644 --- a/src/main/java/team7/inplace/influencer/persistence/InfluencerRepository.java +++ b/src/main/java/team7/inplace/influencer/persistence/InfluencerRepository.java @@ -1,12 +1,13 @@ package team7.inplace.influencer.persistence; -import java.util.List; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import team7.inplace.influencer.domain.Influencer; +import java.util.List; + public interface InfluencerRepository extends JpaRepository { @Override diff --git a/src/main/java/team7/inplace/influencer/presentation/InfluencerController.java b/src/main/java/team7/inplace/influencer/presentation/InfluencerController.java index 23cacb42..f9738682 100644 --- a/src/main/java/team7/inplace/influencer/presentation/InfluencerController.java +++ b/src/main/java/team7/inplace/influencer/presentation/InfluencerController.java @@ -1,26 +1,20 @@ package team7.inplace.influencer.presentation; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import team7.inplace.influencer.application.InfluencerService; import team7.inplace.influencer.application.dto.InfluencerCommand; import team7.inplace.influencer.presentation.dto.InfluencerNameResponse; import team7.inplace.influencer.presentation.dto.InfluencerRequest; import team7.inplace.influencer.presentation.dto.InfluencerResponse; +import java.util.List; + @RequiredArgsConstructor @RestController @RequestMapping("/influencers") @@ -30,9 +24,9 @@ public class InfluencerController implements InfluencerControllerApiSpec { @GetMapping() public ResponseEntity> getAllInfluencers( - @PageableDefault(page = 0, size = 10) Pageable pageable) { + @PageableDefault(page = 0, size = 10) Pageable pageable) { Page influencers = influencerService.getAllInfluencers(pageable) - .map(InfluencerResponse::from); + .map(InfluencerResponse::from); return new ResponseEntity<>(influencers, HttpStatus.OK); } @@ -40,8 +34,8 @@ public ResponseEntity> getAllInfluencers( @GetMapping("/names") public ResponseEntity> getAllInfluencerNames() { List names = influencerService.getAllInfluencerNames().stream() - .map(InfluencerNameResponse::from) - .toList(); + .map(InfluencerNameResponse::from) + .toList(); return new ResponseEntity<>(names, HttpStatus.OK); } @@ -55,13 +49,13 @@ public ResponseEntity createInfluencer(@RequestBody InfluencerRequest requ @PutMapping("/{id}") public ResponseEntity updateInfluencer( - @PathVariable Long id, - @RequestBody InfluencerRequest request + @PathVariable Long id, + @RequestBody InfluencerRequest request ) { InfluencerCommand influencerCommand = new InfluencerCommand( - request.influencerName(), - request.influencerImgUrl(), - request.influencerJob() + request.influencerName(), + request.influencerImgUrl(), + request.influencerJob() ); Long updatedId = influencerService.updateInfluencer(id, influencerCommand); diff --git a/src/main/java/team7/inplace/influencer/presentation/InfluencerControllerApiSpec.java b/src/main/java/team7/inplace/influencer/presentation/InfluencerControllerApiSpec.java index 520853b7..dccc9b7c 100644 --- a/src/main/java/team7/inplace/influencer/presentation/InfluencerControllerApiSpec.java +++ b/src/main/java/team7/inplace/influencer/presentation/InfluencerControllerApiSpec.java @@ -1,7 +1,6 @@ package team7.inplace.influencer.presentation; import io.swagger.v3.oas.annotations.Operation; -import java.util.List; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; @@ -11,6 +10,8 @@ import team7.inplace.influencer.presentation.dto.InfluencerRequest; import team7.inplace.influencer.presentation.dto.InfluencerResponse; +import java.util.List; + public interface InfluencerControllerApiSpec { @Operation(summary = "인플루언서들 반환", description = "토큰이 있는 경우 좋아요된 인플루언서가 먼저 반환됩니다.") @@ -24,7 +25,7 @@ public interface InfluencerControllerApiSpec { @Operation(summary = "인플루언서 수정", description = "인플루언서를 수정합니다.") ResponseEntity updateInfluencer(@PathVariable Long id, - @RequestBody InfluencerRequest request); + @RequestBody InfluencerRequest request); @Operation(summary = "인플루언서 삭제", description = "인플루언서를 삭제합니다.") ResponseEntity deleteInfluencer(@PathVariable Long id); diff --git a/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerNameResponse.java b/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerNameResponse.java index e5c06660..fc821427 100644 --- a/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerNameResponse.java +++ b/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerNameResponse.java @@ -3,12 +3,12 @@ import team7.inplace.influencer.application.dto.InfluencerNameInfo; public record InfluencerNameResponse( - String influencerName + String influencerName ) { public static InfluencerNameResponse from(InfluencerNameInfo influencerNameInfo) { return new InfluencerNameResponse( - influencerNameInfo.name() + influencerNameInfo.name() ); } } diff --git a/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerRequest.java b/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerRequest.java index a5ca7a26..2ac73abe 100644 --- a/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerRequest.java +++ b/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerRequest.java @@ -3,16 +3,16 @@ import team7.inplace.influencer.application.dto.InfluencerCommand; public record InfluencerRequest( - String influencerName, - String influencerImgUrl, - String influencerJob + String influencerName, + String influencerImgUrl, + String influencerJob ) { public static InfluencerCommand to(InfluencerRequest request) { return new InfluencerCommand( - request.influencerName(), - request.influencerImgUrl(), - request.influencerJob() + request.influencerName(), + request.influencerImgUrl(), + request.influencerJob() ); } } diff --git a/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerResponse.java b/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerResponse.java index 12729aad..a2eb53a2 100644 --- a/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerResponse.java +++ b/src/main/java/team7/inplace/influencer/presentation/dto/InfluencerResponse.java @@ -3,20 +3,20 @@ import team7.inplace.influencer.application.dto.InfluencerInfo; public record InfluencerResponse( - Long influencerId, - String influencerName, - String influencerImgUrl, - String influencerJob, - boolean likes + Long influencerId, + String influencerName, + String influencerImgUrl, + String influencerJob, + boolean likes ) { public static InfluencerResponse from(InfluencerInfo influencerInfo) { return new InfluencerResponse( - influencerInfo.influencerId(), - influencerInfo.influencerName(), - influencerInfo.influencerImgUrl(), - influencerInfo.influencerJob(), - influencerInfo.likes() + influencerInfo.influencerId(), + influencerInfo.influencerName(), + influencerInfo.influencerImgUrl(), + influencerInfo.influencerJob(), + influencerInfo.likes() ); } } diff --git a/src/main/java/team7/inplace/likedPlace/domain/LikedPlace.java b/src/main/java/team7/inplace/likedPlace/domain/LikedPlace.java index 35cdab35..ed31817c 100644 --- a/src/main/java/team7/inplace/likedPlace/domain/LikedPlace.java +++ b/src/main/java/team7/inplace/likedPlace/domain/LikedPlace.java @@ -1,15 +1,6 @@ package team7.inplace.likedPlace.domain; -import static jakarta.persistence.GenerationType.IDENTITY; -import static lombok.AccessLevel.PROTECTED; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; @@ -17,6 +8,9 @@ import team7.inplace.place.domain.Place; import team7.inplace.user.domain.User; +import static jakarta.persistence.GenerationType.IDENTITY; +import static lombok.AccessLevel.PROTECTED; + @Getter @RequiredArgsConstructor @NoArgsConstructor(access = PROTECTED) diff --git a/src/main/java/team7/inplace/likedPlace/persistence/LikedPlaceRepository.java b/src/main/java/team7/inplace/likedPlace/persistence/LikedPlaceRepository.java index 66f17eac..b1d1a7d2 100644 --- a/src/main/java/team7/inplace/likedPlace/persistence/LikedPlaceRepository.java +++ b/src/main/java/team7/inplace/likedPlace/persistence/LikedPlaceRepository.java @@ -1,11 +1,12 @@ package team7.inplace.likedPlace.persistence; -import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import team7.inplace.likedPlace.domain.LikedPlace; +import java.util.Optional; + public interface LikedPlaceRepository extends JpaRepository { Optional findByUserIdAndPlaceId(Long userId, Long placeId); diff --git a/src/main/java/team7/inplace/oauthToken/application/OauthTokenService.java b/src/main/java/team7/inplace/oauthToken/application/OauthTokenService.java index aec4df0b..5a031c4f 100644 --- a/src/main/java/team7/inplace/oauthToken/application/OauthTokenService.java +++ b/src/main/java/team7/inplace/oauthToken/application/OauthTokenService.java @@ -23,17 +23,17 @@ public class OauthTokenService { @Transactional(readOnly = true) public String findOAuthTokenByUserId(Long userId) throws InplaceException { return tokenEncryptionUtil.decrypt(oauthTokenRepository.findByUserId(userId) - .orElseThrow(() -> InplaceException.of(UserErrorCode.OAUTH_TOKEN_NOT_FOUND)) - .getOauthToken()); + .orElseThrow(() -> InplaceException.of(UserErrorCode.OAUTH_TOKEN_NOT_FOUND)) + .getOauthToken()); } @Transactional public void insertOauthToken(OauthTokenCommand oauthTokenCommand) throws InplaceException { User userProxy = entityManager.getReference(User.class, oauthTokenCommand.userId()); OauthToken oauthToken = OauthToken.of( - tokenEncryptionUtil.encrypt(oauthTokenCommand.oauthToken()), - oauthTokenCommand.expiresAt(), - userProxy + tokenEncryptionUtil.encrypt(oauthTokenCommand.oauthToken()), + oauthTokenCommand.expiresAt(), + userProxy ); oauthTokenRepository.save(oauthToken); @@ -42,11 +42,11 @@ public void insertOauthToken(OauthTokenCommand oauthTokenCommand) throws Inplace @Transactional public void updateOauthToken(OauthTokenCommand oauthTokenCommand) throws InplaceException { OauthToken oauthToken = oauthTokenRepository.findByUserId(oauthTokenCommand.userId()) - .orElseThrow(() -> InplaceException.of(UserErrorCode.OAUTH_TOKEN_NOT_FOUND)); + .orElseThrow(() -> InplaceException.of(UserErrorCode.OAUTH_TOKEN_NOT_FOUND)); oauthToken.updateInfo( - tokenEncryptionUtil.encrypt(oauthTokenCommand.oauthToken()), - oauthTokenCommand.expiresAt() + tokenEncryptionUtil.encrypt(oauthTokenCommand.oauthToken()), + oauthTokenCommand.expiresAt() ); } diff --git a/src/main/java/team7/inplace/oauthToken/application/command/OauthTokenCommand.java b/src/main/java/team7/inplace/oauthToken/application/command/OauthTokenCommand.java index c8b53f54..5b1aa3e9 100644 --- a/src/main/java/team7/inplace/oauthToken/application/command/OauthTokenCommand.java +++ b/src/main/java/team7/inplace/oauthToken/application/command/OauthTokenCommand.java @@ -3,9 +3,9 @@ import java.time.Instant; public record OauthTokenCommand( - String oauthToken, - Instant expiresAt, - Long userId + String oauthToken, + Instant expiresAt, + Long userId ) { public static OauthTokenCommand of(String oauthToken, Instant expiresAt, Long userId) { diff --git a/src/main/java/team7/inplace/oauthToken/domain/OauthToken.java b/src/main/java/team7/inplace/oauthToken/domain/OauthToken.java index cc9c77a5..8e4eadfb 100644 --- a/src/main/java/team7/inplace/oauthToken/domain/OauthToken.java +++ b/src/main/java/team7/inplace/oauthToken/domain/OauthToken.java @@ -1,20 +1,15 @@ package team7.inplace.oauthToken.domain; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.OneToOne; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; import team7.inplace.user.domain.User; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; + @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/src/main/java/team7/inplace/oauthToken/persistence/OauthTokenRepository.java b/src/main/java/team7/inplace/oauthToken/persistence/OauthTokenRepository.java index 4bb2c499..bf09ccd5 100644 --- a/src/main/java/team7/inplace/oauthToken/persistence/OauthTokenRepository.java +++ b/src/main/java/team7/inplace/oauthToken/persistence/OauthTokenRepository.java @@ -1,10 +1,11 @@ package team7.inplace.oauthToken.persistence; -import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import team7.inplace.oauthToken.domain.OauthToken; +import java.util.Optional; + @Repository public interface OauthTokenRepository extends JpaRepository { diff --git a/src/main/java/team7/inplace/place/application/CategoryService.java b/src/main/java/team7/inplace/place/application/CategoryService.java index e3103751..f8ad2ff6 100644 --- a/src/main/java/team7/inplace/place/application/CategoryService.java +++ b/src/main/java/team7/inplace/place/application/CategoryService.java @@ -1,13 +1,14 @@ package team7.inplace.place.application; -import java.util.Arrays; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import team7.inplace.place.application.dto.CategoryInfo; import team7.inplace.place.domain.Category; import team7.inplace.place.persistence.PlaceRepository; +import java.util.Arrays; +import java.util.List; + @Service @RequiredArgsConstructor public class CategoryService { @@ -16,6 +17,6 @@ public class CategoryService { public List getCategories() { return Arrays.stream(Category.values()).map(category -> new CategoryInfo(category.name())) - .toList(); + .toList(); } } diff --git a/src/main/java/team7/inplace/place/application/PlaceService.java b/src/main/java/team7/inplace/place/application/PlaceService.java index 9c464ff8..2222c4f8 100644 --- a/src/main/java/team7/inplace/place/application/PlaceService.java +++ b/src/main/java/team7/inplace/place/application/PlaceService.java @@ -1,11 +1,5 @@ package team7.inplace.place.application; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -34,6 +28,9 @@ import team7.inplace.video.domain.Video; import team7.inplace.video.persistence.VideoRepository; +import java.util.*; +import java.util.stream.Collectors; + @Service @RequiredArgsConstructor public class PlaceService { @@ -47,21 +44,21 @@ public class PlaceService { private final LikedPlaceRepository likedPlaceRepository; public Page getPlacesWithinRadius( - PlacesCoordinateCommand placesCoordinateCommand, - PlacesFilterParamsCommand placesFilterParamsCommand) { + PlacesCoordinateCommand placesCoordinateCommand, + PlacesFilterParamsCommand placesFilterParamsCommand) { // categories와 influencers 필터 처리 List categoryFilters = placesFilterParamsCommand.isCategoryFilterExists() - ? Arrays.stream(placesFilterParamsCommand.categories().split(",")).toList() - : null; + ? Arrays.stream(placesFilterParamsCommand.categories().split(",")).toList() + : null; List influencerFilters = placesFilterParamsCommand.isInfluencerFilterExists() - ? Arrays.stream(placesFilterParamsCommand.influencers().split(",")).toList() - : null; + ? Arrays.stream(placesFilterParamsCommand.influencers().split(",")).toList() + : null; // 주어진 좌표로 장소를 찾고, 해당 페이지의 결과를 가져옵니다. Page placesPage = getPlacesByDistance(placesCoordinateCommand, categoryFilters, - influencerFilters); + influencerFilters); // Place ID 목록 추출 List placeIds = getPlaceIds(placesPage); @@ -69,7 +66,7 @@ public Page getPlacesWithinRadius( // influencer 조회 => video->Map(placeId, influencerName) List