Skip to content

Conversation

@Bumnote
Copy link
Member

@Bumnote Bumnote commented Jul 20, 2025

#️⃣ 연관된 이슈

#32

📝 작업 내용

  • 전체적인 코드에 대한 리팩터링 과정을 진행했습니다.
    • Entity 디렉터리 분리 및 파일을 이동시켰습니다.
    • 현재 활용하지 않는 회원 관련 기능 코드 및 디렉터리들을 제거했습니다.
    • 불필요한 주석 또는 코드로 이해할 수 있는 주석들을 과감하게 제거했습니다.
    • 매직 넘버, 매직 스트링을 별도의 상수로 추출하여 가독성을 높였습니다.
    • 값을 변화시킬 수 있는 Setter, Builder 어노테이션을 제거하여 코드 통제성을 높였습니다.
  • IP 화이트 리스트를 설정하여 모니터링 도구에 접근할 수 있는 리소스를 제한했습니다.

💬 리뷰 요구사항

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요


Bumnote and others added 13 commits July 13, 2025 02:54
- 사용자 편의성을 위해서 회원 기능을 사용하지 않기로 결정했습니다.
- 따라서, 회원 기능과 관련된 파일 및 디렉터리를 삭제합니다.

issue #32
- RecommendationPlace Entity를 place 디렉터리 생성 후, 그 하위로 이동시켰습니다.
- 역할을 정확하게 분리하기 위함입니다.

issue #32
- 거대힌 RetripService를 구성하는 기능 중 일부를 Util 클래스로 추출했습니다.
  - CoordinateUtil: 위도, 경도 값과 관련된 Util 클래스
  - DateUtil: 날짜 관련된 Util 클래스
  - DistanceUtil: 거리 관련된 Util 클래스
  - ImageMetaDataUtil: 업로드한 이미지의 메타 데이터와 괸련된 Util 클래스

issue #32
- RetripService 파일에 내장되어있던 클래스를 별도의 클래스로 분리했습니다.
- 새롭게 생성한 info 디렉터리 하위에 위치시켰습니다.

issue #32
- 작성은 되어있지만, 사용하지 않는 코드들을 제거했습니다.
- 충분히 흐름을 통해서 알 수 있는 주석들을 제거했습니다.

issue #32
- Util 클래스로 묶을 수 있는 기능들을 별도의 Util 클래스로 추출했습니다.
  - Date, Coordinate, Distance, ImageMetaData
- 흐름을 통해서 알 수 있는 주석들을 제거했습니다.
- 내장 클래스를 외부로 분리했습니다.
- 이제는 사용되지 않는 회원 관련 코드들을 제거했습니다.

issue #32
- 사용하지 않는 회원 엔티티와 연관 관계 코드를 제거했습니다.
- 딱 봐도 알 수 있는 주석을 제거했습니다.
- Setter 어노테이션을 제거하고, 데이터 수정 로직을 추가했습니다.

issue #32
- 코드로도 이해할 수 있는 주석을 제거합니다.
- 매직 스트링을 별도의 상수로 추출하여 이해하기 쉽도록 이름을 부여합니다.

issue #32
- 기존에 있던 OAuth2 관련 설정을 제거하여 이와 관련된 config 코드를 제거했습니다.
- 회원과 세션 관련 필요없는 코드를 삭제했습니다.

issue #32
- 클래스 전역으로 선언되어있던 Setter, Builder 어노테이션을 제거했습니다.
- Builder 어노테이션의 경우 필요한 매개변수들만을 포함한 메소드 단위로 분리하였고, private 접근 제한자로 변경하여 외부와 차단시켰습니다.
- 기본 생성자의 경우 protected 접근 제한자를 설정하여 쉽게 접근을 못하도록 했습니다.
- Builder.Default 어노테이션을 final 키워드로 대신하였습니다.

issue #32
- 프로메테우스, 그라파나 모니터링 도구의 접근을 IP 기반 접근 제한을 두었습니다.
- 2명의 개발자의 작업공간 공인 IP 에서만 접근이 가능합니다.
- deploy.sh 자동화 쉘 스크립트를 실행했을 때, 화이트 리스트를 적용하기 위해서 동작을 수정했습니다.
- deploy.sh 실행 시, Permission denied 오류를 해결하기 위해서 sudo 명령어를 추가했습니다.

issue #32
Refactor: 전반적인 서비스 코드 리팩터링 진행
Refactor: IP 화이트 리스트 설정으로 모니터링 도구 접근 제한
@Bumnote Bumnote requested a review from Copilot July 20, 2025 16:11
@Bumnote Bumnote self-assigned this Jul 20, 2025
@Bumnote Bumnote added ♻️ refactor 리팩터링 이슈 🔖 release 배포 이슈 labels Jul 20, 2025
@Bumnote Bumnote changed the title Dev Release: 전반적인 코드 리팩터링 및 IP 화이트 리스트를 통한 모니터링 도구 접근 제한 Jul 20, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive code refactoring and security improvements across the ReTrip application:

  • Removes unused member authentication features and simplifies the codebase for core photo analysis functionality
  • Extracts utility classes for image metadata processing, coordinate calculations, and date operations to improve code modularity
  • Eliminates magic numbers/strings by introducing constants and improves code maintainability by removing setter/builder annotations

Reviewed Changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main/java/ssafy/retrip/utils/ New utility classes for image metadata, distance calculations, coordinates, and date operations
src/main/java/ssafy/retrip/domain/ Refactored domain entities with member-related code removal and entity directory restructuring
src/main/java/ssafy/retrip/api/service/ Simplified service layer by removing member authentication and OAuth services
src/main/java/ssafy/retrip/config/ Updated security configuration to remove OAuth2 components
nginx/ and deployment files Enhanced IP whitelisting configuration for monitoring tools
Comments suppressed due to low confidence (1)

src/main/java/ssafy/retrip/api/service/retrip/RetripService.java:142

  • [nitpick] Using forEach with side effects (modifying retrip) is discouraged. Consider using a traditional for-loop or collect() for better readability and debugging.
        retrip.addRecommendation(RecommendationPlace.builder()

return metadataList.stream()
.map(ImageMetaData::getTakenDate)
.filter(Objects::nonNull)
.reduce((first, second) -> second)
Copy link

Copilot AI Jul 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using reduce with (first, second) -> second is unclear. Consider using findFirst() on a reverse-sorted stream or max(Comparator.comparing(...)) for better readability.

Suggested change
.reduce((first, second) -> second)
.max(Comparator.naturalOrder())

Copilot uses AI. Check for mistakes.
}
}
if (!foundCluster) {
clusters.add(new ArrayList<>(Collections.singletonList(meta)));
Copy link

Copilot AI Jul 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collections.singletonList(meta) can be simplified to List.of(meta) for better readability and performance.

Suggested change
clusters.add(new ArrayList<>(Collections.singletonList(meta)));
clusters.add(new ArrayList<>(List.of(meta)));

Copilot uses AI. Check for mistakes.
private Member member;
@OneToMany(mappedBy = "retrip", cascade = CascadeType.ALL, orphanRemoval = true)
@JsonManagedReference
private final List<RecommendationPlace> recommendations = new ArrayList<>();
Copy link

Copilot AI Jul 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'final' with @builder annotation will cause compilation issues. The Builder pattern requires the field to be mutable during construction.

Suggested change
private final List<RecommendationPlace> recommendations = new ArrayList<>();
private List<RecommendationPlace> recommendations = new ArrayList<>();

Copilot uses AI. Check for mistakes.
public class RetripService {

private final MemberRepository memberRepository;
public static final String DEFAULT_USERNAME = "여행자님";
Copy link

Copilot AI Jul 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Hard-coded Korean text should be externalized to properties files for internationalization support.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit c510b53. ± Comparison against base commit cccb623.

@Bumnote Bumnote merged commit b49a408 into main Jul 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ refactor 리팩터링 이슈 🔖 release 배포 이슈

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants