Class CourseController
java.lang.Object
com.nicholasalfonso.lato.controller.CourseController
REST controller for user course management.
Provides endpoints for listing, retrieving, and updating user courses.
-
Constructor Summary
ConstructorsConstructorDescriptionCourseController(CourseService courseService, CurrentUserService currentUserService, CourseMapper courseMapper) Creates the course controller with required services and mappers. -
Method Summary
Modifier and TypeMethodDescriptionhandleCourseUpdateRequest(Long id, UpdateCourseRequest request) Updates editable course details.Retrieves all courses for the authenticated user.Retrieves all assignments for a specific course.Retrieves details for a specific course.Calculates the completion progress for a course.
-
Constructor Details
-
CourseController
public CourseController(CourseService courseService, CurrentUserService currentUserService, CourseMapper courseMapper) Creates the course controller with required services and mappers.- Parameters:
courseService- service for course operationscurrentUserService- service to resolve the current authenticated usercourseMapper- mapper for course response DTOs
-
-
Method Details
-
handleGetAllCoursesRequest
Retrieves all courses for the authenticated user.- Returns:
- list of course responses
-
handleGetCourseDetailsRequest
Retrieves details for a specific course.- Parameters:
id- the course ID- Returns:
- course response
-
handleCourseUpdateRequest
@PutMapping("/{id}") public CourseResponse handleCourseUpdateRequest(@PathVariable Long id, @RequestBody UpdateCourseRequest request) Updates editable course details.- Parameters:
id- the course IDrequest- update details- Returns:
- updated course response
-
handleGetCourseProgressRequest
@GetMapping("/{id}/progress") public CourseProgressResponse handleGetCourseProgressRequest(@PathVariable Long id) Calculates the completion progress for a course.- Parameters:
id- the course ID- Returns:
- course progress with completion statistics
-
handleGetCourseAssignmentsRequest
@GetMapping("/{id}/assignments") public List<AssignmentResponse> handleGetCourseAssignmentsRequest(@PathVariable Long id) Retrieves all assignments for a specific course.- Parameters:
id- the course ID- Returns:
- list of assignment responses for the course
-