Skip to content

Commit

Permalink
Merge pull request #100 from GDSC-KNU/fix/issue-#99
Browse files Browse the repository at this point in the history
[Fix] 팀 배치 오류 관련 수정
  • Loading branch information
chaejm55 authored Sep 20, 2024
2 parents 9140d07 + 93fba27 commit 43c767f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public MemberResponse getMemberInfo(Long id) {
.orElseThrow(() -> new CustomException(ErrorCode.NOT_FOUND));

List<TeamInfoResponse> teamInfos = member.getMemberTeams().stream()
.filter(memberTeam -> memberTeam.getTeam().getParent() != null)
.map(memberTeam -> new TeamInfoResponse(memberTeam.getTeam()))
.collect(Collectors.toList());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.gdsc_knu.official_homepage.entity.Member;
import com.gdsc_knu.official_homepage.entity.MemberTeam;
import com.gdsc_knu.official_homepage.entity.Team;
import com.gdsc_knu.official_homepage.entity.enumeration.Role;
import com.gdsc_knu.official_homepage.entity.enumeration.Track;
import com.gdsc_knu.official_homepage.exception.CustomException;
import com.gdsc_knu.official_homepage.exception.ErrorCode;
Expand Down Expand Up @@ -46,7 +47,7 @@ public List<AdminTeamResponse.Team> getTeamInfos() {
}

/**
* 새로운 부모 팀을 생성함. 직렬을 지정 하면 해당 직렬의 회원만 해당 팀에 소속
* 새로운 부모 팀을 생성함. 직렬을 지정 하면 해당 직렬의 회원(MEMBER,CORE)만 해당 팀에 소속
* @param createRequest 새로운 부모 팀 생성 요청 (팀 이름, 트랙)
* @return Long 새로 생성된 팀의 id
*/
Expand All @@ -64,6 +65,8 @@ public Long createParentTeam(AdminTeamRequest.Create createRequest) {
List<Member> members = (track != null)
? memberRepository.findAllByTrack(track)
: memberRepository.findAll();
members.removeIf(member -> member.getRole().equals(Role.ROLE_GUEST) || member.getRole().equals(Role.ROLE_TEMP));

List<MemberTeam> memberTeams = members.stream()
.map(member -> MemberTeam.builder()
.member(member)
Expand Down

0 comments on commit 43c767f

Please sign in to comment.