22
33import com .example .enjoy .dto .TrackProgressDto ;
44import com .example .enjoy .service .TrackService ;
5+ import io .swagger .v3 .oas .annotations .Operation ;
6+ import io .swagger .v3 .oas .annotations .tags .Tag ;
57import lombok .RequiredArgsConstructor ;
68import org .springframework .web .bind .annotation .GetMapping ;
79import org .springframework .web .bind .annotation .RestController ;
8-
910import java .util .List ;
1011
12+ @ Tag (name = "홈 컨트롤러" , description = "메인 화면 API" )
1113@ RestController
1214@ RequiredArgsConstructor
1315public class HomeController {
1416
1517 private final TrackService trackService ;
1618
19+ @ Operation (summary = "트랙 진행률 조회" , description = "현재 학생의 전체 트랙 진행률을 조회합니다." )
1720 @ GetMapping ("/home" )
18- public String showMyProgress (Model model ) { // 1. Model 객체를 파라미터로 추가
21+ public List < TrackProgressDto > showMyProgress () {
1922 // TODO: 추후 Spring Security 등과 연동하여 실제 로그인한 사용자 ID를 가져와야 함
20- String currentStudentId = "1" ; // 2. 테스트용 임시 학생 ID 사용
21-
22- // 3. 학생의 이수 현황을 계산하는 새로운 서비스 메서드 호출
23- List <TrackProgressDto > progressData = trackService .calculateTrackProgress (currentStudentId );
24-
25- // 4. 조회된 데이터를 "progressData"라는 이름으로 모델에 추가
26- //model.addAttribute("progressData", progressData);
27-
28- // 5. 데이터를 표시할 뷰(html)의 이름을 반환
29- return "home" ;
30- public List <TrackProgressDto > getProgress () {
31- // 1. 반환 타입을 List<TrackProgressDto>로 변경
3223 String currentStudentId = "1" ;
33- // 2. 서비스 호출 후 데이터를 바로 반환
3424 return trackService .calculateTrackProgress (currentStudentId );
3525 }
36- }
26+ }
0 commit comments