Skip to content

Commit

Permalink
Merge pull request #118 from Team-B1ND/Refactor/#117
Browse files Browse the repository at this point in the history
 refacotr: 사용하지 않는 서비스 메소드 삭제
  • Loading branch information
GayeongKimm authored Sep 20, 2024
2 parents 5f92579 + 5ab10c4 commit 77979b4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@ public Response status(String id, ActiveStatus status) {
return Response.ok("멤버 상태변경 성공");
}

@CacheEvict(value = "members-cache", key = "'activeMembers'")
public Response active(String id) {
updateStatus(id, ActiveStatus.ACTIVE);
return Response.ok("멤버 활성화 성공");
}

@CacheEvict(value = "members-cache", key = "'activeMembers'")
public Response deactivate(String id) {
updateStatus(id, ActiveStatus.DEACTIVATE);
return Response.ok("멤버 비활성화 성공");
}

@CacheEvict(value = "members-cache", key = "'activeMembers'")
public Response deactivate() {
Member member = memberAuthenticationHolder.current();
Expand All @@ -110,11 +98,6 @@ public Response deactivate() {
return Response.ok("멤버 비활성화 성공");
}

private void updateStatus(String id, ActiveStatus status) {
Member member = memberRepository.getById(id);
member.updateStatus(status);
}

public Response updatePassword(UpdatePasswordReq req) {
Member member = memberAuthenticationHolder.current();
member.updatePw(Sha512PasswordEncoder.encode(req.password()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,12 @@ public ResponseData<List<MemberInfoRes>> searchByName(String name) {
}

public ResponseData<List<MemberInfoRes>> getMembersByStatus(ActiveStatus status) {
return ResponseData.ok("상태변 멤버 조회 성공", memberRepository.findByStatusOrderByStudent(status)
return ResponseData.ok("상태별 멤버 조회 성공", memberRepository.findByStatusOrderByStudent(status)
.parallelStream()
.map(this::getMemberInfo)
.toList());
}

public ResponseData<List<MemberInfoRes>> getDeactivateMembers() {
return ResponseData.ok("비활성화된 멤버 조회 성공", memberRepository.findByStatusOrderByStudent(ActiveStatus.DEACTIVATE)
.parallelStream()
.map(this::getMemberInfo)
.toList());
}

public ResponseData<List<MemberInfoRes>> getPendingMembers(){
return ResponseData.ok("대기중인 멤버 조회 성공", memberRepository.findByStatusOrderByStudent(ActiveStatus.PENDING)
.parallelStream()
.map(this::getMemberInfo)
.toList());
}

@Cacheable(value = "members-cache", key = "'activeMembers'")
public List<MemberInfoRes> getAll() {
return memberRepository.findByStatusOrderByStudent(ActiveStatus.ACTIVE).parallelStream()
.map(this::getMemberInfo)
.toList();
}

private MemberInfoRes getMemberInfo(Member member) {
Student student = studentRepository.findByMember(member)
.orElse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,11 @@ public Response updateStatus(@PathVariable String id, @RequestParam ActiveStatus
return commandUseCase.status(id, status);
}

@PatchMapping("/active/{id}")
public Response active(@PathVariable("id") String id) {
return commandUseCase.active(id);
}

@PatchMapping("/deactivate")
public Response deactivate() {
return commandUseCase.deactivate();
}

@PatchMapping("/deactivate/{id}")
public Response deactivate(@PathVariable("id") String id) {
return commandUseCase.deactivate(id);
}

@PatchMapping("/password")
public Response updatePassword(@RequestBody @Valid UpdatePasswordReq req) {
return commandUseCase.updatePassword(req);
Expand Down Expand Up @@ -106,21 +96,6 @@ public ResponseData<List<MemberInfoRes>> getMembersByStatus(@RequestParam Active
return queryUseCase.getMembersByStatus(status);
}

@GetMapping("/deactivate")
public ResponseData<List<MemberInfoRes>> getDeactivateMembers() {
return queryUseCase.getDeactivateMembers();
}

@GetMapping("/pending")
public ResponseData<List<MemberInfoRes>> getPendingMembers(){
return queryUseCase.getPendingMembers();
}

@GetMapping("/all")
public ResponseData<List<MemberInfoRes>> getAll() {
return ResponseData.ok("모든 멤버 정보 조회 성공", queryUseCase.getAll());
}

@GetMapping("/check/broadcast-club-member")
public ResponseData<Boolean> checkBroadcastClubMember() {
return queryUseCase.checkBroadcastClubMember();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

public enum ActiveStatus {

ACTIVE, DEACTIVATE, PENDING, DEACTIVATED
ACTIVE, PENDING, DEACTIVATED

}

0 comments on commit 77979b4

Please sign in to comment.