Hotfix/mateboard : bio null 값 수정, 동행 신청 여부 판단 필드 추가#177
Conversation
| * @return | ||
| */ | ||
| Optional<MateApplication> findByMateIdAndApplicantId(Long mateId, Long userId); | ||
|
|
There was a problem hiding this comment.
좋은 추가입니다. MateApplication 엔티티에 대한 존재 여부를 효율적으로 확인할 수 있는 메서드가 추가되었습니다. 메서드 이름도 명확하고 좋습니다.
| @ResponseStatus(HttpStatus.OK) | ||
| public MateResponseDto getMate(@PathVariable Long id) { | ||
| return mateService.getMate(id); | ||
| public MateResponseDto getMate(@PathVariable Long id, |
There was a problem hiding this comment.
getMate 메서드에 사용자 ID (userId)를 추가한 것은 긍정적입니다. 이제 특정 게시글에 사용자가 지원했는지 여부를 확인하는 데 필요한 정보를 서비스 계층에 전달할 수 있습니다. @AuthenticationPrincipal 어노테이션 사용도 적절합니다.
| private final int commentCount; | ||
| private final int likeCount; | ||
| private final LocalDateTime createdAt; | ||
| private boolean isApplied; |
There was a problem hiding this comment.
isApplied 필드를 추가하여 사용자가 해당 모임에 지원했는지 여부를 표시하는 것은 매우 좋습니다. DTO에 필요한 정보가 명확하게 추가되었습니다. 생성자와 setter도 잘 업데이트 되었습니다.
| * @return MateResponseDto 변환 결과 | ||
| */ | ||
| public static MateResponseDto toResponseDto(Mate mate, String imageUrl) { | ||
| public static MateResponseDto toResponseDto(Mate mate, String imageUrl, boolean isApplied) { |
There was a problem hiding this comment.
기존의 toResponseDto 메서드를 오버로드하여 isApplied 값을 처리하도록 수정한 것은 효율적입니다. 기존 메서드는 기본값으로 isApplied를 false로 설정하는 새로운 메서드를 호출하여 코드 중복을 방지합니다. 가독성과 유지보수성이 향상되었습니다.
| mateComment.countDistinct().intValue(), | ||
| matePostLike.countDistinct().intValue(), | ||
| mate.createdAt | ||
| mate.createdAt, |
There was a problem hiding this comment.
Expressions.constant(false) 를 추가하여 기본적으로 지원하지 않은 상태로 설정하는 것은 논리적으로 일관성이 있습니다. 쿼리 결과에 isApplied 필드를 추가하여 서비스 계층에서 불필요한 처리를 줄였습니다. 명확한 의도를 보여줍니다.
|
|
||
| import com.frend.planit.domain.image.service.ImageService; | ||
| import com.frend.planit.domain.image.type.HolderType; | ||
| import com.frend.planit.domain.mateboard.application.repository.MateApplicationRepository; |
There was a problem hiding this comment.
MateApplicationRepository 의존성 주입은 적절하며, getMate 메서드에 사용자 ID를 추가하여 isApplied 여부를 확인하는 로직을 추가한 부분이 매우 좋습니다. 코드의 가독성과 유지보수성이 향상되었습니다. mateApplicationRepository를 사용하여 isApplied 값을 효율적으로 가져오는 방식도 효율적입니다.
Hotfix/mateboard : bio null 값 수정, 동행 신청 여부 판단 필드 추가
🔘 Part
🔎 PR Type
🔧 작업 내용 상세 작성
[레포 이름 #이슈번호](이슈 주소)
작업 내용을 상세하게 작성해 주세요!
✔️ PR Checklist
커밋 메세지를 컨벤션에 맞게 잘 적용 하였나요?
테스트 코드 작성 / 단위 테스트 or 통합 테스트 진행 하셨나요?