-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomeController.java
More file actions
28 lines (24 loc) · 1.14 KB
/
HomeController.java
File metadata and controls
28 lines (24 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.example.enjoy.controller;
import com.example.enjoy.dto.TrackProgressDto;
import com.example.enjoy.service.TrackService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Tag(name = "홈 컨트롤러", description = "메인 화면 API")
@RestController
@RequiredArgsConstructor
public class HomeController {
private final TrackService trackService;
@Operation(summary = "트랙 진행률 조회", description = "현재 학생의 전체 트랙 진행률을 조회합니다.")
@GetMapping("/home")
public List<TrackProgressDto> showMyProgress() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String currentStudentId = authentication.getName();
return trackService.calculateTrackProgress(currentStudentId);
}
}