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

feat: 상태별 회원 조회 목록 api 구현 #371

Merged
merged 6 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
@@ -1,6 +1,7 @@
package com.gdschongik.gdsc.domain.member.api;

import com.gdschongik.gdsc.domain.member.application.AdminMemberService;
import com.gdschongik.gdsc.domain.member.domain.MemberRole;
import com.gdschongik.gdsc.domain.member.dto.request.MemberQueryOption;
import com.gdschongik.gdsc.domain.member.dto.request.MemberUpdateRequest;
import com.gdschongik.gdsc.domain.member.dto.response.AdminMemberResponse;
Expand All @@ -14,13 +15,7 @@
import org.springframework.http.ContentDisposition;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@Tag(name = "Admin Member", description = "어드민 회원 관리 API입니다.")
@RestController
Expand All @@ -30,10 +25,13 @@ public class AdminMemberController {

private final AdminMemberService adminMemberService;

@Operation(summary = "전체 회원 목록 조회", description = "전체 회원 목록을 조회합니다.")
@Operation(summary = "회원 역할별 목록 조회", description = "정회원, 준회원, 게스트별로 조회합니다.")
@GetMapping
public ResponseEntity<Page<AdminMemberResponse>> getMembers(MemberQueryOption queryOption, Pageable pageable) {
Page<AdminMemberResponse> response = adminMemberService.findAll(queryOption, pageable);
public ResponseEntity<Page<AdminMemberResponse>> getMembers(
@RequestParam(name = "role", required = false) MemberRole memberRole,
MemberQueryOption queryOption,
Pageable pageable) {
Page<AdminMemberResponse> response = adminMemberService.findAllByRole(queryOption, pageable, memberRole);
return ResponseEntity.ok().body(response);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.gdschongik.gdsc.domain.member.dao.MemberRepository;
import com.gdschongik.gdsc.domain.member.domain.Member;
import com.gdschongik.gdsc.domain.member.domain.MemberRole;
import com.gdschongik.gdsc.domain.member.dto.request.MemberQueryOption;
import com.gdschongik.gdsc.domain.member.dto.request.MemberUpdateRequest;
import com.gdschongik.gdsc.domain.member.dto.response.AdminMemberResponse;
Expand All @@ -31,6 +32,12 @@ public Page<AdminMemberResponse> findAll(MemberQueryOption queryOption, Pageable
return members.map(AdminMemberResponse::from);
}

public Page<AdminMemberResponse> findAllByRole(
MemberQueryOption queryOption, Pageable pageable, MemberRole memberRole) {
Page<Member> members = memberRepository.findAllByRole(queryOption, pageable, memberRole);
return members.map(AdminMemberResponse::from);
}

@Transactional
public void withdrawMember(Long memberId) {
Member member = memberRepository.findById(memberId).orElseThrow(() -> new CustomException(MEMBER_NOT_FOUND));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static com.gdschongik.gdsc.global.exception.ErrorCode.*;

import com.gdschongik.gdsc.domain.common.model.BaseTimeEntity;
import com.gdschongik.gdsc.domain.common.model.RequirementStatus;
import com.gdschongik.gdsc.global.exception.CustomException;
import jakarta.persistence.Column;
import jakarta.persistence.Embedded;
Expand Down Expand Up @@ -214,6 +215,14 @@ public void verifyDiscord(String discordUsername, String nickname) {
registerEvent(new MemberAssociateEvent(this.id));
}

/**
* deprecated
*/
public void updatePaymentStatus(RequirementStatus status) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 로직 의미는 뭔가요...?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 merge되면서 문제 생겼나봐요..!! 왜 저기에 들어갔는지 모르겠네요 지우겠습니다

validateStatusUpdatable();
this.updatePaymentStatus(status);
}

public void verifyBevy() {
validateStatusUpdatable();
this.associateRequirement.verifyBevy();
Expand Down