Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add a member policy when start match #525

Merged

Conversation

soeunnPark
Copy link
Collaborator

PR에 대한 설명 🔍

start match를 하려면 경기 참여를 한 사용자여야 합니다.

변경된 사항 📝

  • 경기 참여를 하지 않아도 start match 기능을 사용할 수 있었던 문제를 해결했습니다.
  • 토너먼트 경기에서, Match 가 아직 종료되지 않아 참가자가 비어 있는 Match가 있습니다. 해당하는 Match에 대해 점수를 입력하려고 할 때 예외가 발생합니다. 이때 예외의 에러코드가 잘못 매칭되어 있어 수정했습니다.

PR에서 중점적으로 확인되어야 하는 사항

  • start match 를 하기 위한 권한을 확인해주세요.
  • Facade 안에서 권한을 확인하려고 했으나, Tournament/Free 에 따라 Facade가 나뉘어 코드 중복을 막고자 Controller 코드에 작성했습니다.
  • 경기 Owner인지를 확인하는 코드도 현재 중복이 많아 ClubMemberPolicy에 추가하면 좋을 것 같습니다.

@soeunnPark soeunnPark added 5PM🌝 오후 5시 전까지 리뷰가 필요합니다. refactor✍️ 그냥 수정 labels Dec 5, 2024
@soeunnPark soeunnPark requested a review from a team December 5, 2024 06:01
@soeunnPark soeunnPark self-assigned this Dec 5, 2024
@soeunnPark soeunnPark linked an issue Dec 5, 2024 that may be closed by this pull request
Copy link
Collaborator

@km2535 km2535 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다.

) {
StartMatchCommand startMatchCommand =
new StartMatchCommand(clubToken, leagueId, matchId);
clubMemberPolicy.validateLeagueParticipant(leagueId, member.getMemberToken());
Copy link
Collaborator

Choose a reason for hiding this comment

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

검증을 추가했군요
좋은 생각입니다.

throw new LeagueParticipantsNotExistsException(matchId);
throw new LeagueParticipantNotDeterminedException(matchId);
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
Collaborator Author

Choose a reason for hiding this comment

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

경기 참여자가 존재하지 않는다 -> 라는 게 조금 모호한 것 같아요. 해당 예외는 부전승 경기에서 아직 나머지 짝꿍이 정해지지 않았을 때 Match 를 시작하려고 하거나, 점수를 올리려고 할 때 나는 예외입니다. 따라서 상대 경기 참여자가 아직 결정되지 않았다는 의미를 더해 바꾸게 되었습니다.

Copy link
Collaborator

@I-migi I-migi 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 8 to 15
public LeagueParticipantsNotExistsException(Long matchId) {
super(ErrorCode.LEAGUE_PARTICIPANTS_NOT_EXISTS, "[매치 ID : " + matchId + "]");
super(ErrorCode.LEAGUE_NOT_PARTICIPATED, "[매치 ID : " + matchId + "]");
}

public LeagueParticipantsNotExistsException(Long matchId, Exception e) {
super(ErrorCode.LEAGUE_PARTICIPANTS_NOT_EXISTS, "[매치 ID : " + matchId + "]", e);
super(ErrorCode.LEAGUE_NOT_PARTICIPATED, "[매치 ID : " + matchId + "]", e);
}
}
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
Collaborator Author

Choose a reason for hiding this comment

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

LeagueNotParticipatedException으로 바꿔야겠네요!

@soeunnPark soeunnPark merged commit 4baf4f7 into develop Dec 5, 2024
1 check passed
@soeunnPark soeunnPark deleted the 522-refactor-add-a-member-policy-when-start-match branch December 5, 2024 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5PM🌝 오후 5시 전까지 리뷰가 필요합니다. refactor✍️ 그냥 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[refactor] add a member policy when start match
3 participants