Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Refactor] #163 프로젝트 파일의 코드들의 서식을 맞추었어요 #164

Merged
merged 5 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/java/team7/inplace/InplaceApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/team7/inplace/admin/AdminPageController.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,6 +14,8 @@
import team7.inplace.video.domain.Video;
import team7.inplace.video.persistence.VideoRepository;

import java.util.List;

@Controller
@RequiredArgsConstructor
@RequestMapping("/admin")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/team7/inplace/admin/ErrorLogController.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ResponseEntity<Void> resolveErrorLog(@PathVariable Long id) {
errorLog.resolve();
errorLogRepository.save(errorLog);
});

return ResponseEntity.ok().build();
}
}
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package team7.inplace.crawling.application;

import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import team7.inplace.crawling.application.dto.CrawlingInfo;
import team7.inplace.crawling.client.YoutubeClient;
import team7.inplace.video.persistence.VideoRepository;

import java.util.List;

@Service
@RequiredArgsConstructor
public class VideoCrawlingService {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/team7/inplace/crawling/domain/YoutubeChannel.java
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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<YoutubeChannel, Long> {
Optional<YoutubeChannel> findYoutubeChannelByPlayListUUID(String playListUUID);
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -67,10 +68,10 @@ private void processFavoriteInfluencer(User user, Influencer influencer, Boolean
@Transactional(readOnly = true)
public Page<InfluencerInfo> getFavoriteInfluencers(Long userId, Pageable pageable) {
Page<FavoriteInfluencer> influencerPage = favoriteRepository.findByUserIdAndIsLikedTrue(
userId, pageable);
userId, pageable);

return influencerPage.map(
favorite -> InfluencerInfo.from(favorite.getInfluencer(), favorite.isLiked()));
favorite -> InfluencerInfo.from(favorite.getInfluencer(), favorite.isLiked()));
}
}

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package team7.inplace.favoriteInfluencer.application.dto;

public record FavoriteInfluencerCommand(
Long influencerId,
Boolean likes
Long influencerId,
Boolean likes
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import java.util.List;

public record FavoriteInfluencerListCommand(
List<Long> influencerIds,
Boolean likes
List<Long> influencerIds,
Boolean likes
) {

}
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
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;
import lombok.RequiredArgsConstructor;
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
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;
import org.springframework.data.jpa.repository.Query;
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<FavoriteInfluencer, Long> {

List<FavoriteInfluencer> findByUserId(Long userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ResponseEntity<Void> likeToInfluencer(@RequestBody InfluencerLikeRequest

@PostMapping("/multiple/likes")
public ResponseEntity<Void> likeToManyInfluencer(
@RequestBody InfluencerListLikeRequest request) {
@RequestBody InfluencerListLikeRequest request) {
FavoriteInfluencerListCommand command = request.toCommand();
favoriteInfluencerService.likeToManyInfluencer(command);
return new ResponseEntity<>(HttpStatus.OK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Long> influencerIds,
Boolean likes
List<Long> influencerIds,
Boolean likes
) {

public FavoriteInfluencerListCommand toCommand() {
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/team7/inplace/global/annotation/Facade.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/team7/inplace/global/exception/ErrorLog.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ErrorLog, Long> {
List<ErrorLog> findByIsResolvedFalse();
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading