Skip to content

Commit

Permalink
fix: 코드 삭제함에 따라 발생한 의존성 및 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
shkisme committed Feb 27, 2024
1 parent 1add667 commit 50edf4a
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import static com.keeper.homepage.global.error.ErrorCode.MEMBER_NOT_FOUND;

import com.keeper.homepage.domain.comment.dao.CommentRepository;
import com.keeper.homepage.domain.ctf.dao.CtfContestRepository;
import com.keeper.homepage.domain.ctf.dao.challenge.CtfChallengeRepository;
import com.keeper.homepage.domain.ctf.dao.team.CtfTeamRepository;
import com.keeper.homepage.domain.election.dao.ElectionRepository;
import com.keeper.homepage.domain.game.dao.GameRepository;
import com.keeper.homepage.domain.member.dao.MemberRepository;
Expand Down Expand Up @@ -41,9 +38,6 @@ public class MemberDeleteService {
private final MemberReadPostRepository readPostRepository;
private final StudyRepository studyRepository;
private final SeminarRepository seminarRepository;
private final CtfChallengeRepository ctfChallengeRepository;
private final CtfTeamRepository ctfTeamRepository;
private final CtfContestRepository ctfContestRepository;
private final ElectionRepository electionRepository;
private final GameRepository gameRepository;
private final FriendRepository friendRepository;
Expand All @@ -54,9 +48,6 @@ public void delete(Member member) {
commentRepository.updateVirtualMember(member, virtualMember);
studyRepository.updateVirtualMember(member, virtualMember);
seminarRepository.updateVirtualMember(member, virtualMember);
ctfChallengeRepository.updateVirtualMember(member, virtualMember);
ctfTeamRepository.updateVirtualMember(member, virtualMember);
ctfContestRepository.updateVirtualMember(member, virtualMember);
electionRepository.updateVirtualMember(member, virtualMember);

friendRepository.deleteAllByFollowee(member);
Expand Down
41 changes: 0 additions & 41 deletions src/main/java/com/keeper/homepage/domain/member/entity/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

import com.keeper.homepage.domain.attendance.entity.Attendance;
import com.keeper.homepage.domain.comment.entity.Comment;
import com.keeper.homepage.domain.ctf.entity.CtfContest;
import com.keeper.homepage.domain.ctf.entity.challenge.CtfChallenge;
import com.keeper.homepage.domain.ctf.entity.team.CtfTeam;
import com.keeper.homepage.domain.ctf.entity.team.CtfTeamHasMember;
import com.keeper.homepage.domain.election.entity.Election;
import com.keeper.homepage.domain.election.entity.ElectionCandidate;
import com.keeper.homepage.domain.election.entity.ElectionVoter;
Expand Down Expand Up @@ -162,24 +158,12 @@ public class Member {
@OneToMany(mappedBy = "starter")
private final List<Seminar> seminars = new ArrayList<>();

@OneToMany(mappedBy = "creator")
private final List<CtfChallenge> ctfChallenges = new ArrayList<>();

@OneToMany(mappedBy = "creator")
private final List<CtfTeam> ctfTeams = new ArrayList<>();

@OneToMany(mappedBy = "creator")
private final List<CtfContest> ctfContests = new ArrayList<>();

@OneToMany(mappedBy = "member")
private final List<Election> elections = new ArrayList<>();

@OneToMany(mappedBy = "member", cascade = ALL)
private final List<PointLog> pointLogs = new ArrayList<>();

@OneToMany(mappedBy = "member", cascade = ALL, orphanRemoval = true)
private final Set<CtfTeamHasMember> ctfTeamHasMembers = new HashSet<>();

@OneToMany(mappedBy = "member", cascade = REMOVE)
private final List<SeminarAttendance> seminarAttendances = new ArrayList<>();

Expand Down Expand Up @@ -327,17 +311,6 @@ public void join(Study study) {
studyMembers.add(studyMember);
}

public void join(CtfTeam ctfTeam) {
ctfTeamHasMembers.add(CtfTeamHasMember.builder()
.ctfTeam(ctfTeam)
.member(this)
.build());
}

public void leave(CtfTeam ctfTeam) {
ctfTeamHasMembers.removeIf(ctfTeamMember -> ctfTeamMember.getCtfTeam().equals(ctfTeam));
}

public Long getId() {
return this.id;
}
Expand Down Expand Up @@ -397,20 +370,6 @@ public long getCountWaitOrInBorrowing() {
.count();
}

public boolean hasTeam(CtfContest contest) {
return ctfTeamHasMembers.stream()
.anyMatch(ctfTeamHasMember -> ctfTeamHasMember.getCtfTeam().getCtfContest().equals(contest));
}

public boolean isJoin(CtfTeam ctfTeam) {
return ctfTeamHasMembers.stream()
.anyMatch(ctfTeamHasMember -> ctfTeamHasMember.getCtfTeam().equals(ctfTeam));
}

public boolean isCreator(CtfTeam ctfTeam) {
return this.equals(ctfTeam.getCreator());
}

public boolean isDualLateness() {
long countLateness = this.seminarAttendances.stream()
.filter(SeminarAttendance::isLateness)
Expand Down
40 changes: 0 additions & 40 deletions src/test/java/com/keeper/homepage/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@
import com.keeper.homepage.domain.comment.CommentTestHelper;
import com.keeper.homepage.domain.comment.application.CommentService;
import com.keeper.homepage.domain.comment.dao.CommentRepository;
import com.keeper.homepage.domain.ctf.CtfChallengeTestHelper;
import com.keeper.homepage.domain.ctf.CtfContestTestHelper;
import com.keeper.homepage.domain.ctf.CtfFlagTestHelper;
import com.keeper.homepage.domain.ctf.CtfTeamTestHelper;
import com.keeper.homepage.domain.ctf.application.CtfTeamService;
import com.keeper.homepage.domain.ctf.dao.CtfContestRepository;
import com.keeper.homepage.domain.ctf.dao.challenge.CtfChallengeCategoryRepository;
import com.keeper.homepage.domain.ctf.dao.challenge.CtfChallengeRepository;
import com.keeper.homepage.domain.ctf.dao.challenge.CtfChallengeTypeRepository;
import com.keeper.homepage.domain.ctf.dao.team.CtfTeamRepository;
import com.keeper.homepage.domain.election.ElectionCandidateTestHelper;
import com.keeper.homepage.domain.election.ElectionTestHelper;
import com.keeper.homepage.domain.election.ElectionVoterTestHelper;
Expand Down Expand Up @@ -280,21 +270,6 @@ public class IntegrationTest {
@Autowired
protected MeritTypeRepository meritTypeRepository;

@Autowired
protected CtfChallengeCategoryRepository ctfChallengeCategoryRepository;

@Autowired
protected CtfChallengeTypeRepository ctfChallengeTypeRepository;

@Autowired
protected CtfChallengeRepository ctfChallengeRepository;

@Autowired
protected CtfTeamRepository ctfTeamRepository;

@Autowired
protected CtfContestRepository ctfContestRepository;

/******* Service *******/
@SpyBean
protected MemberService memberService;
Expand Down Expand Up @@ -362,9 +337,6 @@ public class IntegrationTest {
@SpyBean
protected SeminarAttendanceService seminarAttendanceService;

@SpyBean
protected CtfTeamService ctfTeamService;

@SpyBean
protected MeritTypeService meritTypeService;

Expand Down Expand Up @@ -438,24 +410,12 @@ public class IntegrationTest {
@Autowired
protected ElectionCandidateTestHelper electionCandidateTestHelper;

@Autowired
protected CtfTeamTestHelper ctfTeamTestHelper;

@Autowired
protected CtfContestTestHelper ctfContestTestHelper;

@Autowired
protected MeritLogTestHelper meritLogTestHelper;

@Autowired
protected MeritTypeHelper meritTypeHelper;

@Autowired
protected CtfChallengeTestHelper ctfChallengeTestHelper;

@Autowired
protected CtfFlagTestHelper ctfFlagTestHelper;

@Autowired
protected PointLogTestHelper pointLogTestHelper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ResultActions callGetPointRankingApi(String accessToken, MultiValueMap<String, S

FieldDescriptor[] getPointRankResponse() {
return new FieldDescriptor[]{
fieldWithPath("memberId").description("회원의 ID"),
fieldWithPath("realName").description("회원의 실명"),
fieldWithPath("generation").description("회원의 기수"),
fieldWithPath("point").description("회원의 포인트"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

import com.keeper.homepage.IntegrationTest;
import com.keeper.homepage.domain.comment.entity.Comment;
import com.keeper.homepage.domain.ctf.entity.CtfContest;
import com.keeper.homepage.domain.ctf.entity.challenge.CtfChallenge;
import com.keeper.homepage.domain.ctf.entity.team.CtfTeam;
import com.keeper.homepage.domain.election.entity.Election;
import com.keeper.homepage.domain.election.entity.ElectionCandidate;
import com.keeper.homepage.domain.election.entity.ElectionChartLog;
Expand Down Expand Up @@ -194,9 +191,6 @@ void setUp() {
Study study = studyTestHelper.builder().headMember(member).build();
Seminar seminar = seminarTestHelper.builder().build();
seminar.setStarter(member);
CtfChallenge challenge = ctfChallengeTestHelper.builder().creator(member).build();
CtfTeam team = ctfTeamTestHelper.builder().creator(member).build();
CtfContest contest = ctfContestTestHelper.builder().creator(member).build();
Election election = electionTestHelper.builder().member(member).build();
em.flush();
em.clear();
Expand All @@ -212,19 +206,13 @@ void setUp() {
comment = commentRepository.findById(comment.getId()).orElseThrow();
study = studyRepository.findById(study.getId()).orElseThrow();
seminar = seminarRepository.findById(seminar.getId()).orElseThrow();
challenge = ctfChallengeRepository.findById(challenge.getId()).orElseThrow();
team = ctfTeamRepository.findById(team.getId()).orElseThrow();
contest = ctfContestRepository.findById(contest.getId()).orElseThrow();
election = electionRepository.findById(election.getId()).orElseThrow();

Member virtualMember = memberFindService.getVirtualMember();
assertThat(post.getMember()).isEqualTo(virtualMember);
assertThat(comment.getMember()).isEqualTo(virtualMember);
assertThat(study.getHeadMember()).isEqualTo(virtualMember);
assertThat(seminar.getStarter()).isEqualTo(virtualMember);
assertThat(challenge.getCreator()).isEqualTo(virtualMember);
assertThat(team.getCreator()).isEqualTo(virtualMember);
assertThat(contest.getCreator()).isEqualTo(virtualMember);
assertThat(election.getMember()).isEqualTo(virtualMember);
}

Expand All @@ -244,8 +232,6 @@ void setUp() {
member.read(post); // O
Study study = studyTestHelper.generate();
member.join(study); // O
CtfTeam ctfTeam = ctfTeamTestHelper.generate();
member.join(ctfTeam); // O
Seminar seminar = seminarTestHelper.generate();
Long seminarAttendanceId = seminarAttendanceRepository.save(SeminarAttendance.builder()
.seminar(seminar)
Expand Down

0 comments on commit 50edf4a

Please sign in to comment.