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: clubMember.size() -> countByClubClubTokenAndDeletedFalse 로 변경 #442

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public ClubDetailsInfo readClub(String clubToken) {
var club = clubService.readClub(clubToken);
Map<Member.MemberTier, Long> memberCountByTier = club.getClubMemberCountByTier();

int clubMembersCount = club.clubMembers().size();
int clubMembersCount = clubMemberService.countExistingClub(clubToken);
clubStatisticsService.increaseVisitedClubCount(clubToken);
return ClubDetailsInfo.from(club, memberCountByTier,
clubMembersCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void approveClubMemberCount() {
Map<Long, Integer> countByClubIdRegisterMemberCount = new HashMap<>();
List<Long> clubIds = clubStatisticsService.clubIdByList();
for (Long clubId : clubIds) {
Integer count = clubMemberService.countByClubClubIdAndDeletedFalse(clubId);
Integer count = clubMemberService.countExistingClub(clubId);
countByClubIdRegisterMemberCount.put(clubId, count);
}
for (Map.Entry<Long, Integer> entry : countByClubIdRegisterMemberCount.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public interface ClubMemberReader {

Integer getClubMemberCounts(Long clubId);

Integer getClubMemberCountsByClubToken(String clubToken);
Integer getClubMemberCountByClubToken(String clubToken);

ClubMember getClubOwner(String clubToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public interface ClubMemberService {

void deleteAllClubMembers(String clubToken);

Integer countByClubClubIdAndDeletedFalse(Long clubId);
Integer countExistingClub(String clubToken);

Integer countExistingClub(Long clubId);

List<ClubCardInfo> getClubsByMemberToken(String memberToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public ClubMemberWithdrawInfo withdrawClubMember(Long clubMemberId, String clubT

private void checkClubOwner(ClubMember clubMember, String clubToken) {
if (clubMember.getRole() == ClubMember.ClubMemberRole.ROLE_OWNER
&& clubMemberReader.getClubMemberCountsByClubToken(clubToken) > 1) {
&& clubMemberReader.getClubMemberCountByClubToken(clubToken) > 1) {
throw new ClubOwnerCannotWithdraw(clubMember.getClubMemberId());
}
}
Expand All @@ -149,7 +149,12 @@ public void deleteAllClubMembers(String clubToken) {
}

@Override
public Integer countByClubClubIdAndDeletedFalse(Long clubId) {
public Integer countExistingClub(String clubToken) {
return clubMemberReader.getClubMemberCountByClubToken(clubToken);
}

@Override
public Integer countExistingClub(Long clubId) {
return clubMemberReader.getClubMemberCounts(clubId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Integer getClubMemberCounts(Long clubId) {
}

@Override
public Integer getClubMemberCountsByClubToken(String clubToken) {
public Integer getClubMemberCountByClubToken(String clubToken) {
return clubMemberRepository.countByClubClubTokenAndDeletedFalse(clubToken);
}

Expand Down