Skip to content

Conversation

@JjungminLee
Copy link
Collaborator

No description provided.

* feat: /user/v2/my api추가

* feat: 단과대, 학과 조회 API추가

* feat: 유저 탈퇴 로직 -> 닉네임 파라미터 받게 변경

* refactor: gemini 리뷰에 맞춰 변경
* feat: 학과 등록시 학과 id  파라미터로 전달하게끔 변경

* refactor: /users/department 학과, 단과대 추가

* feat: /user/mypage 단과대, 학과정보 추가

* refactor: 현재 날짜에 해당하는 제휴들만 조회되게 변경

* refactor: 유저의 학과별, 단과대별 제휴 로직 변경

* refactor: gemini 코드리뷰 바탕으로 수정
@JjungminLee JjungminLee self-assigned this Sep 1, 2025
@JjungminLee JjungminLee merged commit a9ceae3 into main Sep 1, 2025
3 of 4 checks passed
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.

Summary of Changes

Hello @JjungminLee, 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!

이 Pull Request는 v2.0.2 릴리즈를 위한 변경 사항을 포함하며, 주로 제휴 정보 조회 로직을 개선하고 사용자 학과/단과대 정보 관리 기능을 확장하는 데 중점을 둡니다. 또한, 새로운 API 엔드포인트를 추가하여 사용자 경험을 향상시키고, 개발 환경의 JWT 토큰 유효 기간을 조정했습니다.

Highlights

  • 제휴 기능 개선: 제휴(Partnership) 엔티티의 @Where 절에 start_date 조건을 추가하여 유효 기간 내의 제휴만 조회되도록 개선했습니다. 또한, 제휴 관련 Repository 및 Service 로직을 업데이트하여 PartnershipRestaurant 엔티티를 직접 반환하고, 유효 기간 필터링을 강화했습니다.
  • 사용자 학과/단과대 정보 조회 및 업데이트 기능 확장: 사용자 마이페이지 응답(MyPageResponse)에 학과 및 단과대 정보를 포함하도록 확장했습니다. 학과 등록/업데이트 요청 시 학과 이름 대신 학과 ID를 사용하도록 변경했으며, 단과대 및 학과 목록을 조회할 수 있는 새로운 API 엔드포인트를 추가했습니다.
  • JWT 토큰 유효 기간 연장: 개발 및 로컬 환경의 JWT 토큰 유효 기간을 연장하여 개발 편의성을 높였습니다.
  • 새로운 API 엔드포인트 추가: 사용자가 작성한 리뷰 목록을 조회하는 /v2/reviews 엔드포인트와 단과대 및 학과 목록을 조회하는 /lookup/colleges, /lookup/departments 엔드포인트를 추가했습니다.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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

이번 릴리즈는 제휴 기능 개선, 사용자 정보 조회 기능 확장, 그리고 새로운 API 엔드포인트 추가 등 여러 중요한 변경 사항을 포함하고 있습니다. 전반적으로 코드의 가독성과 유지보수성을 높이려는 노력이 돋보입니다. 몇 가지 개선점을 제안드렸습니다. UserService에서 더 명확한 예외 처리를 사용하고, UserController의 변수명을 수정하여 코드의 명확성을 높이는 것을 고려해 주세요. 또한, DTO와 응답 상태 코드 관련하여 약간의 수정을 제안했습니다. 이 피드백들이 코드 품질을 더욱 향상시키는 데 도움이 되기를 바랍니다.

Comment on lines +130 to +131
College college = collegeRepository.findById(collegeId)
.orElseThrow(() -> new BaseException(VALIDATION_ERROR));

Choose a reason for hiding this comment

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

high

getDepartmentList 메서드에서 collegeIdCollege를 찾지 못했을 때 VALIDATION_ERROR 예외를 발생시키고 있습니다. 이는 "입력값 유효성 검사 오류"를 의미하는 일반적인 예외로, "해당 단과대를 찾을 수 없음"이라는 더 구체적인 상황을 표현하기에는 부족합니다. BaseResponseStatus에 정의된 NOT_FOUND_COLLEGE를 사용하여 더 명확하고 의미 있는 예외 처리를 하는 것이 좋습니다.

        College college = collegeRepository.findById(collegeId)
                                           .orElseThrow(() -> new BaseException(NOT_FOUND_COLLEGE));

Comment on lines +41 to +51
Department department = user.getDepartment();
College college = department != null ? department.getCollege() : null;

return MyPageResponse.builder()
.nickname(user.getNickname())
.provider(user.getProvider())
.departmentId(department != null ? department.getId() : null)
.departmentName(department != null ? department.getName() : null)
.collegeId(college != null ? college.getId() : null)
.collegeName(college != null ? college.getName() : null)
.build();

Choose a reason for hiding this comment

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

medium

from 정적 팩토리 메서드 내에서 departmentcollege 객체의 null 여부를 확인하고 값을 할당하는 로직이 여러 번 반복되고 있습니다. 이 로직을 개선하여 코드의 가독성과 유지보수성을 높일 수 있습니다. if 문을 사용하여 null 체크를 한 번만 수행하고, 빌더에 값을 설정하는 방식으로 리팩토링하는 것을 제안합니다.

        MyPageResponseBuilder builder = MyPageResponse.builder()
                .nickname(user.getNickname())
                .provider(user.getProvider());

        Department department = user.getDepartment();
        if (department != null) {
            builder.departmentId(department.getId()).departmentName(department.getName());
            College college = department.getCollege();
            if (college != null) {
                builder.collegeId(college.getId()).collegeName(college.getName());
            }
        }
        return builder.build();

Comment on lines +222 to +223
List<GetDepartmentResponse> getCollegeResponses = userService.getDepartmentList(collegeId);
return BaseResponse.success(getCollegeResponses);

Choose a reason for hiding this comment

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

medium

getDepartments 메서드 내에서 userService.getDepartmentList(collegeId)의 반환 값을 getCollegeResponses라는 변수에 할당하고 있습니다. 이 변수명은 메서드의 기능과 반환되는 데이터의 타입(List<GetDepartmentResponse>)을 정확하게 반영하지 못하여 혼동을 줄 수 있습니다. 변수명을 getDepartmentResponses로 변경하여 코드의 명확성을 높이는 것을 권장합니다.

Suggested change
List<GetDepartmentResponse> getCollegeResponses = userService.getDepartmentList(collegeId);
return BaseResponse.success(getCollegeResponses);
List<GetDepartmentResponse> getDepartmentResponses = userService.getDepartmentList(collegeId);
return BaseResponse.success(getDepartmentResponses);

Comment on lines +122 to +126
return colleges.stream().map(college -> GetCollegeResponse.builder()
.id(college.getId())
.name(college.getName())
.build())
.toList();

Choose a reason for hiding this comment

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

medium

getCollegeList 메서드에서 stream().map()을 사용하여 GetCollegeResponse 객체를 생성할 때 빌더 패턴을 사용하고 있습니다. GetCollegeResponserecord 타입이므로, 빌더 대신 생성자를 직접 호출하는 것이 더 간결하고 효율적입니다.

        return colleges.stream().map(college -> new GetCollegeResponse(college.getId(), college.getName()))
                       .toList();

Comment on lines +133 to +137
return departments.stream().map(department -> GetDepartmentResponse.builder()
.id(department.getId())
.name(department.getName())
.build())
.toList();

Choose a reason for hiding this comment

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

medium

getDepartmentList 메서드에서 stream().map()을 사용하여 GetDepartmentResponse 객체를 생성할 때 빌더 패턴을 사용하고 있습니다. GetDepartmentResponserecord 타입이므로, 빌더 대신 생성자를 직접 호출하는 것이 더 간결하고 효율적입니다.

        return departments.stream().map(department -> new GetDepartmentResponse(department.getId(), department.getName()))
                       .toList();

NOT_FOUND_DEPARTMENT(false, HttpStatus.NOT_FOUND, 40409, "해당 학과를 찾을 수 없습니다."),
NOT_FOUND_PARTNERSHIP(false, HttpStatus.NOT_FOUND, 40410, "해당 제휴를 찾을 수 없습니다."),
NOT_FOUND_PARTNERSHIP_RESTAURANT(false, HttpStatus.NOT_FOUND, 40411, "해당 제휴 식당을 찾을 수 없습니다."),
INVALID_NICKNAME(false,HttpStatus.NOT_FOUND,40412,"잘못된 닉네임입니다."),

Choose a reason for hiding this comment

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

medium

새로 추가된 INVALID_NICKNAME 상태의 HTTP 상태 코드가 HttpStatus.NOT_FOUND (404)로 설정되어 있습니다. "잘못된 닉네임"은 클라이언트의 요청 값이 유효하지 않다는 의미이므로, "리소스를 찾을 수 없음"을 의미하는 404보다는 "잘못된 요청"을 의미하는 HttpStatus.BAD_REQUEST (400)가 더 적절해 보입니다.

Suggested change
INVALID_NICKNAME(false,HttpStatus.NOT_FOUND,40412,"잘못된 닉네임입니다."),
INVALID_NICKNAME(false,HttpStatus.BAD_REQUEST,40412,"잘못된 닉네임입니다."),

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.

2 participants