Skip to content

Hotfix/mateboard : bio null 값 수정, 동행 신청 여부 판단 필드 추가#177

Merged
sete3683 merged 5 commits into
developfrom
hotfix/Mateboard
Apr 14, 2025
Merged

Hotfix/mateboard : bio null 값 수정, 동행 신청 여부 판단 필드 추가#177
sete3683 merged 5 commits into
developfrom
hotfix/Mateboard

Conversation

@zelly-log
Copy link
Copy Markdown
Collaborator

Hotfix/mateboard : bio null 값 수정, 동행 신청 여부 판단 필드 추가

🔘 Part

  • BE
  • Infra

🔎 PR Type

  • 새로운 기능 추가
  • 버그 수정
  • 주요 코드 리팩토링(성능 최적화 등)
  • 간단 코드 리팩토링(주석, 코드 컨벤션, 오타 수정 등)
  • 기타 (기타 사항 기입)

🔧 작업 내용 상세 작성

  • [레포 이름 #이슈번호](이슈 주소)

  • 작업 내용을 상세하게 작성해 주세요!

✔️ PR Checklist

  • 커밋 메세지를 컨벤션에 맞게 잘 적용 하였나요?

  • 테스트 코드 작성 / 단위 테스트 or 통합 테스트 진행 하셨나요?

@zelly-log zelly-log added the bug 버그 관련 label Apr 14, 2025
@zelly-log zelly-log requested a review from sete3683 April 14, 2025 05:29
@zelly-log zelly-log self-assigned this Apr 14, 2025
* @return
*/
Optional<MateApplication> findByMateIdAndApplicantId(Long mateId, Long userId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

좋은 추가입니다. MateApplication 엔티티에 대한 존재 여부를 효율적으로 확인할 수 있는 메서드가 추가되었습니다. 메서드 이름도 명확하고 좋습니다.

@ResponseStatus(HttpStatus.OK)
public MateResponseDto getMate(@PathVariable Long id) {
return mateService.getMate(id);
public MateResponseDto getMate(@PathVariable Long id,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

getMate 메서드에 사용자 ID (userId)를 추가한 것은 긍정적입니다. 이제 특정 게시글에 사용자가 지원했는지 여부를 확인하는 데 필요한 정보를 서비스 계층에 전달할 수 있습니다. @AuthenticationPrincipal 어노테이션 사용도 적절합니다.

private final int commentCount;
private final int likeCount;
private final LocalDateTime createdAt;
private boolean isApplied;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

isApplied 필드를 추가하여 사용자가 해당 모임에 지원했는지 여부를 표시하는 것은 매우 좋습니다. DTO에 필요한 정보가 명확하게 추가되었습니다. 생성자와 setter도 잘 업데이트 되었습니다.

* @return MateResponseDto 변환 결과
*/
public static MateResponseDto toResponseDto(Mate mate, String imageUrl) {
public static MateResponseDto toResponseDto(Mate mate, String imageUrl, boolean isApplied) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

기존의 toResponseDto 메서드를 오버로드하여 isApplied 값을 처리하도록 수정한 것은 효율적입니다. 기존 메서드는 기본값으로 isApplied를 false로 설정하는 새로운 메서드를 호출하여 코드 중복을 방지합니다. 가독성과 유지보수성이 향상되었습니다.

mateComment.countDistinct().intValue(),
matePostLike.countDistinct().intValue(),
mate.createdAt
mate.createdAt,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

MateApplicationRepository 의존성 주입은 적절하며, getMate 메서드에 사용자 ID를 추가하여 isApplied 여부를 확인하는 로직을 추가한 부분이 매우 좋습니다. 코드의 가독성과 유지보수성이 향상되었습니다. mateApplicationRepository를 사용하여 isApplied 값을 효율적으로 가져오는 방식도 효율적입니다.

@sete3683 sete3683 merged commit 05683a4 into develop Apr 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 버그 관련

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants