1313import com .threestar .trainus .domain .lesson .student .dto .LessonApplicationResponseDto ;
1414import com .threestar .trainus .domain .lesson .student .dto .LessonDetailResponseDto ;
1515import com .threestar .trainus .domain .lesson .student .dto .LessonSearchListResponseDto ;
16+ import com .threestar .trainus .domain .lesson .student .dto .LessonSearchListWrapperDto ;
1617import com .threestar .trainus .domain .lesson .student .dto .LessonSimpleResponseDto ;
1718import com .threestar .trainus .domain .lesson .student .dto .MyLessonApplicationListResponseDto ;
19+ import com .threestar .trainus .domain .lesson .student .dto .MyLessonApplicationListWrapperDto ;
1820import com .threestar .trainus .domain .lesson .student .service .StudentLessonService ;
1921import com .threestar .trainus .global .exception .domain .ErrorCode ;
2022import com .threestar .trainus .global .exception .handler .BusinessException ;
2123import com .threestar .trainus .global .unit .BaseResponse ;
24+ import com .threestar .trainus .global .unit .PagedResponse ;
2225
2326import io .swagger .v3 .oas .annotations .Operation ;
2427import io .swagger .v3 .oas .annotations .tags .Tag ;
@@ -36,7 +39,7 @@ public class StudentLessonController {
3639
3740 @ GetMapping
3841 @ Operation (summary = "레슨 검색 api" , description = "category(필수, Default: \" ALL\" ) / search(선택) / 그외 법정동 선택 필수" )
39- public ResponseEntity <BaseResponse < LessonSearchListResponseDto >> searchLessons (
42+ public ResponseEntity <PagedResponse < LessonSearchListWrapperDto >> searchLessons (
4043 @ RequestParam (defaultValue = "1" ) @ Min (value = 1 , message = "페이지는 1 이상이어야 합니다." )
4144 @ Max (value = 1000 , message = "페이지는 1000 이하여야 합니다." ) int page ,
4245 @ RequestParam (defaultValue = "5" ) @ Min (value = 1 , message = "limit는 1 이상이어야 합니다." )
@@ -47,9 +50,13 @@ public ResponseEntity<BaseResponse<LessonSearchListResponseDto>> searchLessons(
4750 @ RequestParam String district ,
4851 @ RequestParam String dong
4952 ) {
50- LessonSearchListResponseDto lessonList = studentLessonService .searchLessons (page , limit , category , search , city ,
51- district , dong );
52- return BaseResponse .ok ("레슨 검색 조회 완료." , lessonList , HttpStatus .OK );
53+
54+ LessonSearchListResponseDto serviceResponse = studentLessonService .searchLessons (
55+ page , limit , category , search , city , district , dong
56+ );
57+ LessonSearchListWrapperDto response = new LessonSearchListWrapperDto (serviceResponse .lessons ());
58+
59+ return PagedResponse .ok ("레슨 검색 조회 완료." , response , serviceResponse .count (), HttpStatus .OK );
5360 }
5461
5562 @ GetMapping ("/{lessonId}" )
@@ -91,7 +98,7 @@ public ResponseEntity<BaseResponse<Void>> deleteLessonApplication(
9198
9299 @ GetMapping ("/my-applications" )
93100 @ Operation (summary = "나의 레슨 신청 목록 조회" , description = "현재 로그인한 사용자의 레슨 신청 목록을 조회합니다." )
94- public ResponseEntity <BaseResponse < MyLessonApplicationListResponseDto >> getMyLessonApplications (
101+ public ResponseEntity <PagedResponse < MyLessonApplicationListWrapperDto >> getMyLessonApplications (
95102 @ RequestParam (defaultValue = "1" ) @ Min (value = 1 , message = "페이지는 1 이상이어야 합니다." )
96103 @ Max (value = 1000 , message = "페이지는 1000 이하여야 합니다." ) int page ,
97104 @ RequestParam (defaultValue = "5" ) @ Min (value = 1 , message = "limit는 1 이상이어야 합니다." )
@@ -104,9 +111,12 @@ public ResponseEntity<BaseResponse<MyLessonApplicationListResponseDto>> getMyLes
104111 throw new BusinessException (ErrorCode .AUTHENTICATION_REQUIRED );
105112 }
106113
107- MyLessonApplicationListResponseDto response = studentLessonService .getMyLessonApplications (userId , page , limit ,
108- status );
109- return BaseResponse .ok ("나의 레슨 신청 목록 조회 완료." , response , HttpStatus .OK );
114+ MyLessonApplicationListResponseDto serviceResponse = studentLessonService .getMyLessonApplications (userId , page ,
115+ limit , status );
116+ MyLessonApplicationListWrapperDto response = new MyLessonApplicationListWrapperDto (
117+ serviceResponse .lessonApplications ());
118+
119+ return PagedResponse .ok ("나의 레슨 신청 목록 조회 완료." , response , serviceResponse .count (), HttpStatus .OK );
110120 }
111121
112122 @ GetMapping ("/summary/{lessonId}" )
0 commit comments