11package inha .gdgoc .domain .recruit .controller ;
22
3+ import static inha .gdgoc .domain .recruit .controller .message .RecruitMemberMessage .MEMBER_LIST_RETRIEVED_SUCCESS ;
34import static inha .gdgoc .domain .recruit .controller .message .RecruitMemberMessage .MEMBER_RETRIEVED_SUCCESS ;
45import static inha .gdgoc .domain .recruit .controller .message .RecruitMemberMessage .MEMBER_SAVE_SUCCESS ;
6+ import static inha .gdgoc .domain .recruit .controller .message .RecruitMemberMessage .PAYMENT_MARKED_COMPLETE_SUCCESS ;
7+ import static inha .gdgoc .domain .recruit .controller .message .RecruitMemberMessage .PAYMENT_MARKED_INCOMPLETE_SUCCESS ;
58import static inha .gdgoc .domain .recruit .controller .message .RecruitMemberMessage .PHONE_NUMBER_DUPLICATION_CHECK_SUCCESS ;
69import static inha .gdgoc .domain .recruit .controller .message .RecruitMemberMessage .STUDENT_ID_DUPLICATION_CHECK_SUCCESS ;
710
811import inha .gdgoc .domain .recruit .dto .request .ApplicationRequest ;
12+ import inha .gdgoc .domain .recruit .dto .request .PaymentUpdateRequest ;
913import inha .gdgoc .domain .recruit .dto .response .CheckPhoneNumberResponse ;
1014import inha .gdgoc .domain .recruit .dto .response .CheckStudentIdResponse ;
15+ import inha .gdgoc .domain .recruit .dto .response .RecruitMemberSummaryResponse ;
1116import inha .gdgoc .domain .recruit .dto .response .SpecifiedMemberResponse ;
17+ import inha .gdgoc .domain .recruit .entity .RecruitMember ;
1218import inha .gdgoc .domain .recruit .service .RecruitMemberService ;
1319import inha .gdgoc .global .dto .response .ApiResponse ;
20+ import inha .gdgoc .global .dto .response .PageMeta ;
1421import io .swagger .v3 .oas .annotations .Operation ;
22+ import io .swagger .v3 .oas .annotations .Parameter ;
1523import io .swagger .v3 .oas .annotations .security .SecurityRequirement ;
24+ import io .swagger .v3 .oas .annotations .tags .Tag ;
1625import jakarta .validation .constraints .NotBlank ;
1726import jakarta .validation .constraints .Pattern ;
27+ import java .util .List ;
1828import lombok .RequiredArgsConstructor ;
29+ import org .springframework .data .domain .Page ;
30+ import org .springframework .data .domain .PageRequest ;
31+ import org .springframework .data .domain .Pageable ;
32+ import org .springframework .data .domain .Sort ;
33+ import org .springframework .data .domain .Sort .Direction ;
1934import org .springframework .http .ResponseEntity ;
2035import org .springframework .security .access .prepost .PreAuthorize ;
2136import org .springframework .web .bind .annotation .GetMapping ;
37+ import org .springframework .web .bind .annotation .PatchMapping ;
2238import org .springframework .web .bind .annotation .PathVariable ;
2339import org .springframework .web .bind .annotation .PostMapping ;
2440import org .springframework .web .bind .annotation .RequestBody ;
2541import org .springframework .web .bind .annotation .RequestMapping ;
2642import org .springframework .web .bind .annotation .RequestParam ;
2743import org .springframework .web .bind .annotation .RestController ;
2844
45+ @ Tag (name = "Recruit - Members" , description = "리크루팅 지원자 관리 API" )
2946@ RequestMapping ("/api/v1" )
3047@ RequiredArgsConstructor
3148@ RestController
@@ -67,7 +84,7 @@ public ResponseEntity<ApiResponse<CheckPhoneNumberResponse, Void>> duplicatedPho
6784 return ResponseEntity .ok (ApiResponse .ok (PHONE_NUMBER_DUPLICATION_CHECK_SUCCESS , response ));
6885 }
6986
70- @ Operation (summary = "특정 멤버 가입 신청서 조회" , security = { @ SecurityRequirement (name = "BearerAuth" ) })
87+ @ Operation (summary = "특정 멤버 가입 신청서 조회" , security = {@ SecurityRequirement (name = "BearerAuth" )})
7188 @ PreAuthorize ("hasRole('ADMIN')" )
7289 @ GetMapping ("/recruit/members/{memberId}" )
7390 public ResponseEntity <ApiResponse <SpecifiedMemberResponse , Void >> getSpecifiedMember (
@@ -78,9 +95,64 @@ public ResponseEntity<ApiResponse<SpecifiedMemberResponse, Void>> getSpecifiedMe
7895 return ResponseEntity .ok (ApiResponse .ok (MEMBER_RETRIEVED_SUCCESS , response ));
7996 }
8097
81- // TODO 전체 응답 조회 및 검색
98+ @ Operation (
99+ summary = "입금 상태 변경" ,
100+ description = "설정하려는 상태(NOT 현재 상태)를 body에 보내주세요. true=입금 완료, false=입금 미완료" ,
101+ security = { @ SecurityRequirement (name = "BearerAuth" ) }
102+ )
103+ @ PreAuthorize ("hasRole('ADMIN')" )
104+ @ PatchMapping ("/recruit/members/{memberId}/payment" )
105+ public ResponseEntity <ApiResponse <Void , Void >> updatePayment (
106+ @ PathVariable Long memberId ,
107+ @ RequestBody PaymentUpdateRequest paymentUpdateRequest
108+ ) {
109+ recruitMemberService .updatePayment (memberId , paymentUpdateRequest .isPayed ());
110+
111+ return ResponseEntity .ok (
112+ ApiResponse .ok (
113+ paymentUpdateRequest .isPayed ()
114+ ? PAYMENT_MARKED_COMPLETE_SUCCESS
115+ : PAYMENT_MARKED_INCOMPLETE_SUCCESS
116+ )
117+ );
118+ }
119+
120+ @ Operation (
121+ summary = "지원자 목록 조회" ,
122+ description = "전체 목록 또는 이름 검색 결과를 반환합니다. 검색어(question)를 주면 이름 포함 검색, 없으면 전체 조회. sort랑 dir은 example 값 그대로 코딩하는 것 추천..." ,
123+ security = { @ SecurityRequirement (name = "BearerAuth" ) }
124+ )
125+ @ PreAuthorize ("hasRole('ADMIN')" )
126+ @ GetMapping ("/recruit/members" )
127+ public ResponseEntity <ApiResponse <List <RecruitMemberSummaryResponse >, PageMeta >> getMembers (
128+ @ Parameter (description = "검색어(이름 부분 일치). 없으면 전체 조회" , example = "소연" )
129+ @ RequestParam (required = false ) String question ,
130+
131+ @ Parameter (description = "페이지(0부터 시작)" , example = "0" )
132+ @ RequestParam (defaultValue = "0" ) int page ,
82133
83- // TODO 입금 완료
134+ @ Parameter (description = "페이지 크기" , example = "20" )
135+ @ RequestParam (defaultValue = "20" ) int size ,
136+
137+ @ Parameter (description = "정렬 필드" , example = "createdAt" )
138+ @ RequestParam (defaultValue = "createdAt" ) String sort ,
139+
140+ @ Parameter (description = "정렬 방향 ASC/DESC" , example = "DESC" )
141+ @ RequestParam (defaultValue = "DESC" ) String dir
142+ ) {
143+ Direction direction = "ASC" .equalsIgnoreCase (dir ) ? Direction .ASC : Direction .DESC ;
144+ Pageable pageable = PageRequest .of (page , size , Sort .by (direction , sort ));
145+
146+ Page <RecruitMember > memberPage = (question == null || question .isBlank ())
147+ ? recruitMemberService .findAllMembersPage (pageable )
148+ : recruitMemberService .searchMembersByNamePage (question , pageable );
149+
150+ List <RecruitMemberSummaryResponse > list = memberPage
151+ .map (RecruitMemberSummaryResponse ::from )
152+ .getContent ();
153+ PageMeta meta = PageMeta .of (memberPage );
154+
155+ return ResponseEntity .ok (ApiResponse .ok (MEMBER_LIST_RETRIEVED_SUCCESS , list , meta ));
156+ }
84157
85- // TODO 입금 미완료
86158}
0 commit comments