Skip to content

Conversation

@yongjun0511
Copy link
Collaborator

No description provided.

JjungminLee and others added 4 commits September 6, 2025 19:20
* refactor: amount rating, taste rating 제거

* refactor: 안쓰는 메서드 제거

* docs: local yml 규칙 추가

* fix: 평균 별점 계산 안되는 문제 수정

* docs: local yml 제거

* chore: beer->pub
* fix: Security Filter Chain 수정

선택적으로 토큰을 받을 수 있돌고 수정

* fix: yml 하드 코딩 제거

---------

Co-authored-by: 나용준 <[email protected]>
@yongjun0511 yongjun0511 self-assigned this Sep 22, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @yongjun0511, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 v2.0.6 릴리즈를 위한 변경사항을 포함하며, 핵심적으로 리뷰 평점 시스템을 '메인 평점' 하나로 간소화하여 코드 복잡성을 줄였습니다. 또한, 제휴 정보 표시 로직을 개선하고, 리뷰 가능한 메뉴 목록에 메뉴 ID를 추가하여 사용자 경험을 향상시켰습니다. JWT 인증 필터의 동작 방식도 조정되었으며, 개발 환경 설정 파일이 .gitignore에 추가되었습니다.

Highlights

  • 평점 시스템 간소화: 리뷰 평점 시스템에서 '양 평점'과 '맛 평점' 필드를 제거하고, '메인 평점' 하나로 통합하여 리뷰 관련 엔티티, DTO, 계산 로직을 간소화했습니다.
  • 제휴 정보 표시 개선: 제휴 정보 DTO에서 대학 및 학과 정보가 모두 없을 경우 '총학'으로 표시되도록 로직을 개선하고, 관련 쿼리도 업데이트했습니다.
  • 리뷰 가능 메뉴 목록 상세화: 리뷰 가능한 메뉴 목록을 반환하는 응답에서 메뉴 이름만 제공하던 것을 메뉴 ID와 이름을 포함하는 상세 DTO 목록으로 변경하여 더 풍부한 정보를 제공합니다.
  • JWT 필터 화이트리스트 처리 개선: 화이트리스트에 포함된 URI 요청이라도 JWT 토큰이 유효하면 인증 컨텍스트를 설정하도록 JwtAuthenticationFilter 로직을 수정했습니다.
  • 기타 변경사항: .gitignore 파일에 application-local.yml을 추가하고, RestaurantType enum의 'BEER'를 'PUB'으로 변경했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


평점은 하나로, 코드도 간결해졌네, 릴리즈의 기쁨.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

v2.0.6 릴리즈를 위한 PR로 보입니다. 리뷰 시스템에서 tasteRatingamountRating을 제거하고 mainRating으로 단일화하는 대규모 리팩토링, '총학' 제휴 로직 개선, 화이트리스트 API에 대한 선택적 인증 허용, API 응답 DTO 개선 등 여러 변경 사항이 포함되어 있습니다. 전반적으로 변경 사항들은 잘 적용된 것으로 보입니다. 특히 리뷰 시스템 리팩토링은 여러 파일에 걸쳐 일관성 있게 수정되었습니다. 리뷰에서는 새로 추가된 선택적 인증 로직의 잠재적인 문제점과 제휴 DTO의 가독성 개선에 대한 제안을 포함했습니다.

Comment on lines +48 to +52
String token = resolveToken(httpRequest);
if (token != null && jwtTokenProvider.validateToken(token)) {
Authentication authentication = jwtTokenProvider.getAuthentication(token);
SecurityContextHolder.getContext().setAuthentication(authentication);
}

Choose a reason for hiding this comment

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

high

화이트리스트에 포함된 URL의 경우, 인증이 선택적이어야 합니다. 즉, 유효한 토큰이 있으면 인증된 사용자로 처리하고, 토큰이 없거나 유효하지 않으면 비로그인 사용자로 처리하여 요청을 계속 진행해야 합니다.
현재 코드는 jwtTokenProvider.validateToken(token)true를 반환하더라도 jwtTokenProvider.getAuthentication(token)에서 예외(예: JsonProcessingException)가 발생할 수 있습니다. 이 경우, 예외가 처리되지 않아 서버 오류(500)가 발생하여 비로그인 상태로도 접근 가능해야 할 화이트리스트 URL에 접근하지 못하는 문제가 생길 수 있습니다.
선택적 인증 로직을 try-catch 블록으로 감싸서 예외 발생 시에도 요청이 중단되지 않도록 하는 것이 안전합니다.

            String token = resolveToken(httpRequest);
            if (token != null && jwtTokenProvider.validateToken(token)) {
                try {
                    Authentication authentication = jwtTokenProvider.getAuthentication(token);
                    SecurityContextHolder.getContext().setAuthentication(authentication);
                } catch (Exception e) {
                    log.warn("JWT 토큰 인증 중 오류가 발생했으나, 화이트리스트 경로이므로 비로그인 상태로 계속 진행합니다. URI: {}", requestURI, e);
                }
            }

Comment on lines +30 to +32
.collegeName(partnership.getPartnershipCollege() == null && partnership.getPartnershipDepartment() == null
? "총학"
: (partnership.getPartnershipCollege() != null ? partnership.getPartnershipCollege().getName() : null))

Choose a reason for hiding this comment

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

medium

collegeName을 결정하는 로직이 중첩된 삼항 연산자로 구현되어 있어 가독성이 떨어집니다. 코드를 더 명확하게 만들기 위해 이 로직을 별도의 private static 메서드로 추출하는 것을 고려해 보세요.

예를 들어, PartnershipInfo 클래스 내에 다음과 같은 헬퍼 메서드를 추가할 수 있습니다.

private static String getCollegeName(Partnership partnership) {
    if (partnership.getPartnershipCollege() == null && partnership.getPartnershipDepartment() == null) {
        return "총학";
    }
    if (partnership.getPartnershipCollege() != null) {
        return partnership.getPartnershipCollege().getName();
    }
    return null;
}

그리고 fromEntity 메서드에서는 다음과 같이 호출합니다.

.collegeName(getCollegeName(partnership))

@yongjun0511 yongjun0511 merged commit 907f578 into main Sep 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants