Skip to content

feat: 크루 참여 요청 수락 및 거절 기능 추가#31

Merged
mandykr merged 14 commits intodevelopfrom
feature-3/approval-or-rejection-demand
Apr 7, 2025
Merged

feat: 크루 참여 요청 수락 및 거절 기능 추가#31
mandykr merged 14 commits intodevelopfrom
feature-3/approval-or-rejection-demand

Conversation

@mandykr
Copy link
Contributor

@mandykr mandykr commented Mar 25, 2025

🔍 PR 타입 선택

아래 타입 중 해당하는 하나를 선택해 주세요. 반드시 하나만 선택해 주세요.

  • feat: 새로운 기능 추가

📝 변경 사항 요약

변경 사항을 간단히 요약해 주세요.

  • 참여 요청 대기, 승인, 거절 목록 조회 기능 추가
  • 참여 요청자가 속한 크루 목록 조회 기능 추가
  • 크루 참여 요청 수락 및 거절 기능 추가
  • 참여 요청 취소 및 재요청 기능 추가

🛠 관련 이슈

Resolves: #3

추가 설명 (선택 사항)

@mandykr mandykr self-assigned this Mar 25, 2025
@mandykr mandykr linked an issue Mar 25, 2025 that may be closed by this pull request
8 tasks
@mandykr mandykr changed the title Feature 3/approval or rejection demand feat: 크루 참여 요청 수락 및 거절 기능 추가 Apr 5, 2025
return crewQueryRepository.findAllContainsMember(pageable, demand.getMemberId());
}

private static void throwIfNotLeader(Crew crew, UUID memberId, BusinessException exception) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 코드가 서비스 로직에 있는것이 맞는걸까요??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

조회를 위한 검증이라 entity로 옮기긴 애매할것 같아요. 생각나는 좋은 방법 있으신가요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

엔티티에 있으면 좋을 것 같다고 생각하긴 했는데.. 말씀주신대로 조회를 위한 검증이라 서비스에 있는것이 좋을 것 같습니다.
추가로 Crew 조회 시, Crew Member와 같이 Fetch 조인하면, Query를 1번만 호출할 거 같네요!

return ApproveDemandResponse.of(demand);
}

private Demand findDemandByIdAndCrewId(UUID demandId, UUID crewId) {
Copy link
Collaborator

@xjvmdutl xjvmdutl Apr 6, 2025

Choose a reason for hiding this comment

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

CrewId까지 Join한 이유가 궁금합니다~
추가로 CrewId로 조인한 것이면, Crew를 조회할 필요가 있을지도 궁금합니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

crew는 approveDemand를 호출하기 위해 필요하고 demand를 조회할때 crewId를 파라미터로 사용한 이유는 크루에 해당하는 demand를 안전하게 조회하기 위함입니다. 또한 demand에서 crewId는 외래키이기 때문에 조인은 되지 않습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

2테이블을 Join 조회 한 후, Demand에 대한 정보만 조회한다면, Query 1번 만으로 가능할 거 같아서요!
현재는 Crew 조회(DB 조회) > Crew, DemandId를 통한 Demand 엔티티 조회(DB조회)
-> Demand 조회 시, Crew & Demand 테이블을 조인해서 조회 (DB 조회)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이해했습니다. crew를 조회할때 demand도 함께 가져오는게 좋겠네요.

import java.util.UUID;

public interface CrewDemandRepository extends JpaRepository<Demand, UUID> {
Page<Demand> findByCrewIdAndStatus(UUID crewId, DemandStatus pending, Pageable pageRequest);
Copy link
Collaborator

Choose a reason for hiding this comment

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

정수님이 공유주신 무한 스크롤 사용해야 될 것 같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

사용자(크루 리더) 입장에서 많은 수의 참여 요청 목록을 수시로 조회할때 페이지 번호를 선택해서 필요한 위치로 이동하는게 더 편할것 같다고 생각했어요

@Override
public String convertToDatabaseColumn(RecruitmentStatus status) {
if(status == null){
throw new NullPointerException("crewMemberRole을 DB 칼럼으로 변경하는 과정에서 null이 포함되었습니다.");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

오타 수정이 필요합니다

@mandykr mandykr requested a review from xjvmdutl April 6, 2025 08:39
private Optional<Demand> findReDemand(UUID memberId) {
return demands.stream()
.filter(d -> isReDemand(memberId, d))
.findFirst();
Copy link
Collaborator

Choose a reason for hiding this comment

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

any() 메서드가 따로 없나요? any 메서드가 있다면 해당 메서드를 사용하는게 의미상 더 명확해 보입니다.!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

any() 메서드는 따로 없네요


private static void throwIfNotPending(Demand find) {
if (find.isNotPending()) {
throw new IllegalStateException("참여 요청의 상태가 대기중이 아닙니다.");
Copy link
Collaborator

@xjvmdutl xjvmdutl Apr 7, 2025

Choose a reason for hiding this comment

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

도메인 예외 처리는 필요 없을까요:?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

커스텀 예외를 만드는게 적절해 보이네요

return ApiResponse.created(demand);
}

@PutMapping("/{crewId}/demands/{demandId}/cancel")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Demand 별도로 Controller 분리하는것도 좋은 방안일 것 같습니다.!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네 분리하는것도 깔끔하겠네요

jpa:
hibernate:
ddl-auto: create-drop
ddl-auto: create
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 값 변경한 이유가 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

db 데이터 확인을 하는 과정에서 커밋에 포함되었네요. 로컬이나 테스트 환경 설정 파일은 자유롭게 수정해서 사용하시면 될것같아요

mandykr added 2 commits April 7, 2025 17:41
- crew 조회 -> demand 조회로 분리된 로직을 crew와 demand를 조인해서 조회하도록 변경
@mandykr mandykr merged commit e0eea35 into develop Apr 7, 2025
@mandykr mandykr deleted the feature-3/approval-or-rejection-demand branch April 7, 2025 09:23
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.

크루 참여 승인/거절

3 participants