-
Notifications
You must be signed in to change notification settings - Fork 0
Release: 전반적인 코드 리팩터링 및 IP 화이트 리스트를 통한 모니터링 도구 접근 제한 #50
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
Conversation
- 사용자 편의성을 위해서 회원 기능을 사용하지 않기로 결정했습니다. - 따라서, 회원 기능과 관련된 파일 및 디렉터리를 삭제합니다. 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 화이트 리스트 설정으로 모니터링 도구 접근 제한
There was a problem hiding this 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) |
Copilot
AI
Jul 20, 2025
There was a problem hiding this comment.
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.
| .reduce((first, second) -> second) | |
| .max(Comparator.naturalOrder()) |
| } | ||
| } | ||
| if (!foundCluster) { | ||
| clusters.add(new ArrayList<>(Collections.singletonList(meta))); |
Copilot
AI
Jul 20, 2025
There was a problem hiding this comment.
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.
| clusters.add(new ArrayList<>(Collections.singletonList(meta))); | |
| clusters.add(new ArrayList<>(List.of(meta))); |
| private Member member; | ||
| @OneToMany(mappedBy = "retrip", cascade = CascadeType.ALL, orphanRemoval = true) | ||
| @JsonManagedReference | ||
| private final List<RecommendationPlace> recommendations = new ArrayList<>(); |
Copilot
AI
Jul 20, 2025
There was a problem hiding this comment.
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.
| private final List<RecommendationPlace> recommendations = new ArrayList<>(); | |
| private List<RecommendationPlace> recommendations = new ArrayList<>(); |
| public class RetripService { | ||
|
|
||
| private final MemberRepository memberRepository; | ||
| public static final String DEFAULT_USERNAME = "여행자님"; |
Copilot
AI
Jul 20, 2025
There was a problem hiding this comment.
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.
#️⃣ 연관된 이슈
#32
📝 작업 내용
💬 리뷰 요구사항