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