99import io .swagger .v3 .oas .annotations .responses .ApiResponses ;
1010import io .swagger .v3 .oas .annotations .tags .Tag ;
1111import jakarta .validation .Valid ;
12+ import jakarta .validation .constraints .NotBlank ;
1213import lombok .RequiredArgsConstructor ;
1314import org .springdoc .core .annotations .ParameterObject ;
1415import org .springframework .data .domain .Pageable ;
2728import ssu .eatssu .domain .auth .security .CustomUserDetails ;
2829import ssu .eatssu .domain .partnership .dto .PartnershipResponse ;
2930import ssu .eatssu .domain .partnership .service .PartnershipService ;
31+ import ssu .eatssu .domain .review .service .ReviewServiceV2 ;
3032import ssu .eatssu .domain .slice .dto .SliceResponse ;
3133import ssu .eatssu .domain .slice .service .SliceService ;
3234import ssu .eatssu .domain .user .dto .DepartmentResponse ;
35+ import ssu .eatssu .domain .user .dto .GetCollegeResponse ;
36+ import ssu .eatssu .domain .user .dto .GetDepartmentResponse ;
37+ import ssu .eatssu .domain .user .dto .MyMealReviewResponse ;
3338import ssu .eatssu .domain .user .dto .MyPageResponse ;
3439import ssu .eatssu .domain .user .dto .MyReviewDetail ;
3540import ssu .eatssu .domain .user .dto .NicknameUpdateRequest ;
@@ -48,6 +53,7 @@ public class UserController {
4853 private final UserService userService ;
4954 private final SliceService sliceService ;
5055 private final PartnershipService partnershipService ;
56+ private final ReviewServiceV2 reviewServiceV2 ;
5157
5258 @ Operation (summary = "이메일 중복 체크" , description = """
5359 이메일 중복 체크 API 입니다.<br><br>
@@ -97,6 +103,16 @@ public BaseResponse<?> updateNickname(
97103 public BaseResponse <Boolean > withdraw (@ AuthenticationPrincipal CustomUserDetails userDetails ) {
98104 return BaseResponse .success (userService .withdraw (userDetails ));
99105 }
106+ @ Operation (summary = "유저 탈퇴 v2" , description = "유저 탈퇴 API 입니다." )
107+ @ ApiResponses (value = {
108+ @ ApiResponse (responseCode = "200" , description = "유저 탈퇴 성공" ),
109+ @ ApiResponse (responseCode = "404" , description = "존재하지 않는 유저" , content = @ Content (schema = @ Schema (implementation = BaseResponse .class )))
110+ })
111+ @ DeleteMapping ("/v2" )
112+ public BaseResponse <Boolean > withdrawV2 (@ RequestParam @ NotBlank String nickname , @ AuthenticationPrincipal CustomUserDetails userDetails ) {
113+ userService .withdrawV2 (nickname .trim (),userDetails );
114+ return BaseResponse .success (true );
115+ }
100116
101117 @ Operation (summary = "내가 쓴 리뷰 리스트 조회" , description = "내가 쓴 리뷰 리스트를 조회하는 API 입니다." )
102118 @ ApiResponses (value = {
@@ -180,4 +196,42 @@ public BaseResponse<List<PartnershipResponse>> getUserDepartmentPartnerships(
180196 public BaseResponse <DepartmentResponse > getDepartment (@ AuthenticationPrincipal CustomUserDetails userDetails ) {
181197 return BaseResponse .success (userService .getDepartment (userDetails ));
182198 }
199+
200+ @ Operation (summary = "내가 쓴 리뷰 리스트 조회" , description = "내가 쓴 리뷰 리스트를 조회하는 API V2 입니다." )
201+ @ ApiResponses (value = {
202+ @ ApiResponse (responseCode = "200" , description = "내가 쓴 리뷰 리스트 조회 성공" ),
203+ @ ApiResponse (responseCode = "404" , description = "존재하지 않는 유저" , content = @ Content (schema = @ Schema (implementation = BaseResponse .class )))
204+ })
205+ @ GetMapping ("/v2/reviews" )
206+ public BaseResponse <SliceResponse <MyMealReviewResponse >> getMyReviews (
207+ @ Parameter (description = "마지막으로 조회된 reviewId값(첫 조회시 값 필요 없음)" , in = ParameterIn .QUERY ) @ RequestParam (required = false ) Long lastReviewId ,
208+ @ ParameterObject @ PageableDefault (size = 20 , sort = "date" , direction = Sort .Direction .DESC ) Pageable pageable ,
209+ @ AuthenticationPrincipal CustomUserDetails customUserDetails ) {
210+ SliceResponse <MyMealReviewResponse > myReviews = reviewServiceV2 .findMyReviews (customUserDetails ,
211+ lastReviewId ,
212+ pageable );
213+ return BaseResponse .success (myReviews );
214+ }
215+
216+ @ Operation (summary = "단과대 조회" , description = "숭실대학교 단과대학 들을 조회하는 API입니다.(토큰 불필요)" )
217+ @ ApiResponses (value = {
218+ @ ApiResponse (responseCode = "200" , description = "단과대 리스트 조회 성공" ),
219+ @ ApiResponse (responseCode = "404" , description = "존재하지 않는 단과대" , content = @ Content (schema = @ Schema (implementation = BaseResponse .class )))
220+ })
221+ @ GetMapping ("/lookup/colleges" )
222+ public BaseResponse <List <GetCollegeResponse >> getColleges () {
223+ List <GetCollegeResponse > getCollegeResponses = userService .getCollegeList ();
224+ return BaseResponse .success (getCollegeResponses );
225+ }
226+
227+ @ Operation (summary = "단과대에 따른 학과 조회" , description = "단과대학을 입력하면 단과대에 속한 숭실대학교 학과를 조회하는 API입니다.(토큰 불필요)" )
228+ @ ApiResponses (value = {
229+ @ ApiResponse (responseCode = "200" , description = "단과대 리스트 조회 성공" ),
230+ })
231+ @ GetMapping ("/lookup/departments" )
232+ public BaseResponse <List <GetDepartmentResponse >> getDepartments (@ RequestParam Long collegeId ) {
233+ List <GetDepartmentResponse > getCollegeResponses = userService .getDepartmentList (collegeId );
234+ return BaseResponse .success (getCollegeResponses );
235+ }
236+
183237}
0 commit comments