/
dmuruz
/
Course_Service
Обзор
Документация
Войти
/
dmuruz
/
Course_Service
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
src/main/java/org/example/controller/UserProgressController.java
40 строк
1 KB
Danil Muruz
MVP
24 апр 2025, 09:39
24 апр 2025, 09:39
16b1c45
Код
Авторство
О чём код?
package org.example.controller; import org.example.dto.UserProgressDTO; import org.example.manager.UserProgressManager; import org.example.model.LessonStatus; import org.example.model.User; import org.example.model.UserLesson; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/user-progress") public class UserProgressController { @Autowired private UserProgressManager userProgressManager; @GetMapping("/progress") public ResponseEntity<UserProgressDTO> getTrainingProgress(@AuthenticationPrincipal User user, @RequestParam Long courseId) { Long userId = user.getId(); UserProgressDTO progress = userProgressManager.getTrainingProgress(userId, courseId); return ResponseEntity.ok(progress); } @PutMapping public ResponseEntity<UserLesson> updateUserLesson( @RequestParam Long userId, @RequestParam Long lessonId, @RequestParam LessonStatus status, @RequestParam Integer completedSteps) { UserLesson updated = userProgressManager .updateUserLessonStatus(userId, lessonId, status, completedSteps); return ResponseEntity.ok(updated); } }