Skip to content

Conversation

@JanooGwan
Copy link
Contributor

동아리 정보 수정 관련 API 리팩토링했습니다.

변경사항은 다음과 같습니다.

  • 동아리 정보 수정 페이지 -> 프로필 수정 페이지 & 상세정보 수정 페이지 로 분리 (/profile, /details)
  • 프로필 수정 페이지 : 한 줄 소개, 태그 수정 가능
  • 상세정보 수정 페이지 : 동아리 위치(동방), 소개 수정 가능
  • 동아리명, 분과 변경 API 추가 (이 기능은 후에 어드민 계정만 할 수 있도록 해야하지만, 우선 API 추가만 해두었습니다.)

리뷰 부탁드리겠습니다. 감사합니다.

@dh2906
Copy link
Contributor

dh2906 commented Jan 23, 2026

이전에 작업한 브랜치의 커밋도 포함되어 있는 것 같습니다. 지금은 해당 부모 브랜치가 머지된 상태이니 rebase 후에 다시 리뷰 요청 부탁드릴게요~

@JanooGwan
Copy link
Contributor Author

앗 알겠습니다

@JanooGwan JanooGwan force-pushed the refactor/update-club branch from 9a4c6b3 to 55b0a96 Compare January 24, 2026 08:03
@JanooGwan
Copy link
Contributor Author

리베이스 완료 했습니다..!

@dh2906
Copy link
Contributor

dh2906 commented Jan 25, 2026

작업 이후 pr 오른쪽에 리뷰어 선택 부탁드립니다! 안해주시면 알림이 안와서 빠른 체크가 어렵습니다..!

Copy link
Contributor

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

동아리 정보 수정 관련 API를 프로필(/profile)과 상세정보(/details)로 분리하고, 태그 조회/수정 및 동아리명·분과 변경(basic-info) 기능을 추가한 리팩토링입니다.

Changes:

  • 동아리 정보 수정 API를 프로필 수정과 상세정보 수정으로 분리하고, 기존 update 응답을 204 No Content로 전환
  • 동아리 태그 조회 API(/tags) 및 프로필 태그 수정 로직(매핑 테이블) 추가
  • 동아리명/분과 변경 API(/basic-info) 추가(어드민 전용 의도)

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/main/java/gg/agit/konect/domain/club/service/ClubService.java 프로필/상세/기본정보 수정 분리 및 태그 매핑 갱신 로직 추가
src/main/java/gg/agit/konect/domain/club/controller/ClubController.java 신규 엔드포인트(profile/details/basic-info/tags)로 라우팅 변경 및 204 응답 처리
src/main/java/gg/agit/konect/domain/club/controller/ClubApi.java API 스펙 업데이트(경로 분리, 태그 조회, 기본정보 수정 추가)
src/main/java/gg/agit/konect/domain/club/dto/ClubDetailResponse.java 상세 조회 응답에 회장 이름/태그 목록 포함 및 대표자 리스트 제거
src/main/java/gg/agit/konect/domain/club/dto/ClubProfileUpdateRequest.java 프로필 수정 요청 DTO(한줄소개/이미지/태그) 추가
src/main/java/gg/agit/konect/domain/club/dto/ClubDetailUpdateRequest.java 상세정보 수정 요청 DTO(위치/상세소개) 추가
src/main/java/gg/agit/konect/domain/club/dto/ClubBasicInfoUpdateRequest.java 기본정보 수정 요청 DTO(동아리명/분과) 추가
src/main/java/gg/agit/konect/domain/club/dto/ClubTagsResponse.java 태그 목록 응답 DTO 추가
src/main/java/gg/agit/konect/domain/club/dto/ClubTagResponse.java 태그 단건 응답 DTO 추가
src/main/java/gg/agit/konect/domain/club/repository/ClubTagRepository.java 태그 조회/저장 레포지토리 추가
src/main/java/gg/agit/konect/domain/club/repository/ClubTagMapRepository.java 태그-동아리 매핑 조회/삭제 레포지토리 추가
src/main/java/gg/agit/konect/domain/club/model/Club.java 업데이트 메서드를 profile/details/basicInfo로 분리
src/main/java/gg/agit/konect/domain/club/model/ClubMembers.java 회장 단건 조회(getPresident) 추가
src/main/java/gg/agit/konect/domain/club/model/ClubMember.java updatePosition 제거 및 changePosition 사용 유지


default ClubTag getById(Integer id) {
return findById(id)
.orElseThrow(() -> CustomException.of(ApiResponseCode.NOT_FOUND_CLUB));
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

태그 조회용 레포지토리인데, getById에서 태그 미존재 시 NOT_FOUND_CLUB를 던지고 있어 에러 코드/메시지가 실제 원인과 불일치합니다. 태그 전용 NOT_FOUND 코드를 추가하거나, 최소한 INVALID_REQUEST_BODY 등 더 정확한 코드로 교체하는 게 좋습니다.

Suggested change
.orElseThrow(() -> CustomException.of(ApiResponseCode.NOT_FOUND_CLUB));
.orElseThrow(() -> CustomException.of(ApiResponseCode.INVALID_REQUEST_BODY));

Copilot uses AI. Check for mistakes.

List<ClubTag> tags = clubTagRepository.findAllByIdIn(request.tagIds());
if (tags.size() != request.tagIds().size()) {
throw CustomException.of(NOT_FOUND_CLUB);
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

요청한 tagIds 중 일부가 존재하지 않을 때 NOT_FOUND_CLUB를 던지고 있어 원인(잘못된 태그 ID)과 에러가 맞지 않습니다. 태그 미존재를 나타내는 별도 코드/메시지로 분리하거나, 요청 검증 실패로 처리하는 방식으로 수정해 주세요.

Suggested change
throw CustomException.of(NOT_FOUND_CLUB);
throw CustomException.of(INVALID_REQUEST);

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +58
@Schema(description = "동아리 회장 이름", example = "김철수", requiredMode = REQUIRED)
String presidentName,

@Schema(description = "동아리 태그 목록", requiredMode = REQUIRED)
List<ClubTagResponse> tags,
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

ClubDetailResponse에서 기존 representatives(연락처/이메일 포함) 필드를 제거하고 presidentName만 내려주도록 변경되어 응답 스키마가 깨지는 변경입니다. 하위 호환이 필요하다면 기존 필드를 유지하거나 버저닝/마이그레이션 계획(프론트/외부 소비자 반영)을 명확히 해 주세요.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +18
@Query("SELECT ctm FROM ClubTagMap ctm JOIN FETCH ctm.tag WHERE ctm.club.id = :clubId")
List<ClubTagMap> findAllByClubId(@Param("clubId") Integer clubId);

void deleteByClubId(Integer clubId);

Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

deleteByClubIdClubTagMap 엔티티에 clubId 필드가 없어 Spring Data 파생 쿼리로 해석되지 않아 애플리케이션 기동 시점에 실패할 가능성이 큽니다. deleteByClub_Id(...)처럼 연관관계 경로를 사용하거나, @Modifying + @Query("delete from ClubTagMap ctm where ctm.club.id = :clubId") 형태로 명시 쿼리를 추가하세요.

Copilot uses AI. Check for mistakes.
Comment on lines +193 to +200
public void updateBasicInfo(Integer clubId, Integer userId, ClubBasicInfoUpdateRequest request) {
userRepository.getById(userId);
Club club = clubRepository.getById(clubId);

// TODO: 어드민 권한 체크 로직 추가 필요 (현재는 미구현)
// if (!isAdmin(userId)) {
// throw CustomException.of(FORBIDDEN_CLUB_MANAGER_ACCESS);
// }
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

updateBasicInfo는 API 설명상 “어드민 전용”인데, 현재 권한 체크가 TODO로 주석 처리되어 있어 누구나 동아리명/분과를 변경할 수 있습니다. 실제 어드민 권한 검증(예: 사용자 role 확인)을 구현하고 실패 시 적절한 403 코드로 차단해야 합니다.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@dh2906 dh2906 left a comment

Choose a reason for hiding this comment

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

깃허브 코파일럿이 남긴 리뷰 보시면서 해결해야 한다고 생각 드는건 수정해주세요!

Comment on lines +171 to +177
tags.forEach(tag -> {
ClubTagMap tagMap = ClubTagMap.builder()
.club(club)
.tag(tag)
.build();
clubTagMapRepository.save(tagMap);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

커밋 메시지를 보니 조회 오류 때문에 해당 방식으로 수정하셨는데, 무슨 문제였는지 자세히 알 수 있을까요??

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