11package com .threestar .trainus .domain .lesson .student .controller ;
22
3+ import java .util .List ;
4+
35import org .springframework .http .HttpStatus ;
46import org .springframework .http .ResponseEntity ;
57import org .springframework .web .bind .annotation .DeleteMapping ;
1315import com .threestar .trainus .domain .lesson .student .dto .LessonApplicationResponseDto ;
1416import com .threestar .trainus .domain .lesson .student .dto .LessonDetailResponseDto ;
1517import com .threestar .trainus .domain .lesson .student .dto .LessonSearchListResponseDto ;
18+ import com .threestar .trainus .domain .lesson .student .dto .LessonSearchResponseDto ;
1619import com .threestar .trainus .domain .lesson .student .dto .LessonSimpleResponseDto ;
1720import com .threestar .trainus .domain .lesson .student .dto .MyLessonApplicationListResponseDto ;
21+ import com .threestar .trainus .domain .lesson .student .dto .MyLessonApplicationResponseDto ;
1822import com .threestar .trainus .domain .lesson .student .service .StudentLessonService ;
1923import com .threestar .trainus .global .exception .domain .ErrorCode ;
2024import com .threestar .trainus .global .exception .handler .BusinessException ;
2125import com .threestar .trainus .global .unit .BaseResponse ;
26+ import com .threestar .trainus .global .unit .PagedResponse ;
2227
2328import io .swagger .v3 .oas .annotations .Operation ;
2429import io .swagger .v3 .oas .annotations .tags .Tag ;
@@ -36,7 +41,7 @@ public class StudentLessonController {
3641
3742 @ GetMapping
3843 @ Operation (summary = "레슨 검색 api" , description = "category(필수, Default: \" ALL\" ) / search(선택) / 그외 법정동 선택 필수" )
39- public ResponseEntity <BaseResponse < LessonSearchListResponseDto >> searchLessons (
44+ public ResponseEntity <PagedResponse < List < LessonSearchResponseDto > >> searchLessons (
4045 @ RequestParam (defaultValue = "1" ) @ Min (value = 1 , message = "페이지는 1 이상이어야 합니다." )
4146 @ Max (value = 1000 , message = "페이지는 1000 이하여야 합니다." ) int page ,
4247 @ RequestParam (defaultValue = "5" ) @ Min (value = 1 , message = "limit는 1 이상이어야 합니다." )
@@ -49,7 +54,7 @@ public ResponseEntity<BaseResponse<LessonSearchListResponseDto>> searchLessons(
4954 ) {
5055 LessonSearchListResponseDto lessonList = studentLessonService .searchLessons (page , limit , category , search , city ,
5156 district , dong );
52- return BaseResponse .ok ("레슨 검색 조회 완료." , lessonList , HttpStatus .OK );
57+ return PagedResponse .ok ("레슨 검색 조회 완료." , lessonList . data (), lessonList . count () , HttpStatus .OK );
5358 }
5459
5560 @ GetMapping ("/{lessonId}" )
@@ -91,7 +96,7 @@ public ResponseEntity<BaseResponse<Void>> deleteLessonApplication(
9196
9297 @ GetMapping ("/my-applications" )
9398 @ Operation (summary = "나의 레슨 신청 목록 조회" , description = "현재 로그인한 사용자의 레슨 신청 목록을 조회합니다." )
94- public ResponseEntity <BaseResponse < MyLessonApplicationListResponseDto >> getMyLessonApplications (
99+ public ResponseEntity <PagedResponse < List < MyLessonApplicationResponseDto > >> getMyLessonApplications (
95100 @ RequestParam (defaultValue = "1" ) @ Min (value = 1 , message = "페이지는 1 이상이어야 합니다." )
96101 @ Max (value = 1000 , message = "페이지는 1000 이하여야 합니다." ) int page ,
97102 @ RequestParam (defaultValue = "5" ) @ Min (value = 1 , message = "limit는 1 이상이어야 합니다." )
@@ -104,9 +109,10 @@ public ResponseEntity<BaseResponse<MyLessonApplicationListResponseDto>> getMyLes
104109 throw new BusinessException (ErrorCode .AUTHENTICATION_REQUIRED );
105110 }
106111
107- MyLessonApplicationListResponseDto response = studentLessonService .getMyLessonApplications (userId , page , limit ,
112+ MyLessonApplicationListResponseDto result = studentLessonService .getMyLessonApplications (userId , page , limit ,
108113 status );
109- return BaseResponse .ok ("나의 레슨 신청 목록 조회 완료." , response , HttpStatus .OK );
114+
115+ return PagedResponse .ok ("나의 레슨 신청 목록 조회 완료." , result .data (), result .count (), HttpStatus .OK );
110116 }
111117
112118 @ GetMapping ("/summary/{lessonId}" )
0 commit comments