Skip to content

Commit

Permalink
♻️REFACTOR: 내 팀 정보 조회는 방장뿐만 아니라 모든 팀원들이 조회할 수 있게 리팩토링(#152) (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
600gramSik authored Jul 15, 2024
1 parent 6f43c23 commit f476941
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ public GetTeamResponseDto getMyTeamById(Long teamId, User user) {

Team team = teamRepository.findById(teamId).orElseThrow(() -> new TeamExceptionHandler(ErrorCode.TEAM_NOT_FOUND));

if (!user.getTeam().contains(team)) {
boolean isMember = team.getTeamMembers().stream()
.anyMatch(teamMember -> teamMember.getUser().equals(user));

if (!isMember) {
throw new TeamExceptionHandler(ErrorCode.NO_AUTHORIZATION);
}

Expand Down

0 comments on commit f476941

Please sign in to comment.