diff --git a/src/main/java/com/core/linkup/club/converter/ClubConverter.java b/src/main/java/com/core/linkup/club/converter/ClubConverter.java index e6f8949..1130d4b 100644 --- a/src/main/java/com/core/linkup/club/converter/ClubConverter.java +++ b/src/main/java/com/core/linkup/club/converter/ClubConverter.java @@ -9,6 +9,7 @@ import com.core.linkup.common.exception.BaseException; import com.core.linkup.common.response.BaseResponseStatus; import com.core.linkup.member.entity.Member; +import com.core.linkup.security.MemberDetails; @Converter public class ClubConverter { @@ -24,7 +25,7 @@ public ClubSearchResponse toClubResponse(Club club) { } - public Club toClubEntity(ClubCreateRequest request, Long memberId) { + public Club toClubEntity(ClubCreateRequest request, MemberDetails member) { ClubType category; try { category = ClubType.fromKor(String.valueOf(request.clubType())); @@ -40,8 +41,7 @@ public Club toClubEntity(ClubCreateRequest request, Long memberId) { .detailedIntroduction(request.detailedIntroduction()) .applicationIntroduction(request.applicationIntroduction()) .clubThumbnail(request.clubThumbnail()) - .member( - Member.builder().id(memberId).build()) + .member(member.getMember()) .build(); //TODO : list로 question 받는거 해야 함, clubid르 null로 받아옴 @@ -57,7 +57,7 @@ public Club toClubEntity(ClubCreateRequest request, Long memberId) { return club; } - public Club updateClubEntity(Club updateClub, ClubUpdateRequest updateRequest,Long memberId) { + public Club updateClubEntity(Club updateClub, ClubUpdateRequest updateRequest,MemberDetails member) { ClubType category = ClubType.fromKor(String.valueOf(updateRequest.clubType())); return Club.builder() .id(updateClub.getId()) @@ -68,8 +68,7 @@ public Club updateClubEntity(Club updateClub, ClubUpdateRequest updateRequest,Lo .detailedIntroduction(updateRequest.detailedIntroduction()) .applicationIntroduction(updateRequest.applicationIntroduction()) .clubThumbnail(updateRequest.clubThumbnail()) - .member( - Member.builder().id(memberId).build()) + .member(member.getMember()) .build(); } diff --git a/src/main/java/com/core/linkup/club/service/ClubService.java b/src/main/java/com/core/linkup/club/service/ClubService.java index e724b48..2b656ce 100644 --- a/src/main/java/com/core/linkup/club/service/ClubService.java +++ b/src/main/java/com/core/linkup/club/service/ClubService.java @@ -37,7 +37,7 @@ public Page findClubs(Pageable pageable, ClubSearchRequest r public ClubSearchResponse createClub(MemberDetails member, ClubCreateRequest request) { Long memberId = getMemberId(member); - Club club = clubConverter.toClubEntity(request, memberId); + Club club = clubConverter.toClubEntity(request, member); Club savedClub = clubRepository.save(club); return clubConverter.toClubResponse(savedClub); @@ -52,7 +52,7 @@ public ClubSearchResponse updateClub(MemberDetails member, Long clubId, ClubUpda throw new BaseException(BaseResponseStatus.INVALID_MEMBER); } - Club updatedClub = clubConverter.updateClubEntity(existingClub, updateRequest, memberId); + Club updatedClub = clubConverter.updateClubEntity(existingClub, updateRequest, member); Club savedClub = clubRepository.save(updatedClub); return clubConverter.toClubResponse(savedClub); }