| 1 | package edu.ucsb.cs.scaffold.controller; | |
| 2 | ||
| 3 | import edu.ucsb.cs.scaffold.model.Assessment; | |
| 4 | import edu.ucsb.cs.scaffold.model.Question; | |
| 5 | import edu.ucsb.cs.scaffold.repository.AssessmentRepository; | |
| 6 | import edu.ucsb.cs.scaffold.repository.QuestionRepository; | |
| 7 | import io.swagger.v3.oas.annotations.Operation; | |
| 8 | import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | import io.swagger.v3.oas.annotations.tags.Tag; | |
| 10 | import java.util.List; | |
| 11 | import java.util.UUID; | |
| 12 | import lombok.RequiredArgsConstructor; | |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | import org.springframework.web.bind.annotation.GetMapping; | |
| 15 | import org.springframework.web.bind.annotation.PathVariable; | |
| 16 | import org.springframework.web.bind.annotation.RestController; | |
| 17 | ||
| 18 | @Tag(name = "Assessments") | |
| 19 | @RestController | |
| 20 | @RequiredArgsConstructor | |
| 21 | public class AssessmentController { | |
| 22 | ||
| 23 | @Autowired private final AssessmentRepository assessmentRepository; | |
| 24 | ||
| 25 | @Autowired private final QuestionRepository questionRepository; | |
| 26 | ||
| 27 | @Operation(summary = "List all assessments ordered by name") | |
| 28 | @GetMapping("/api/assessments") | |
| 29 | public List<Assessment> getAssessments() { | |
| 30 |
1
1. getAssessments : replaced return value with Collections.emptyList for edu/ucsb/cs/scaffold/controller/AssessmentController::getAssessments → KILLED |
return assessmentRepository.findAllByOrderByNameAsc(); |
| 31 | } | |
| 32 | ||
| 33 | @Operation(summary = "List questions for an assessment ordered by title") | |
| 34 | @GetMapping("/api/assessments/{assessmentId}/questions") | |
| 35 | public List<Question> getQuestions( | |
| 36 | @Parameter(description = "UUID of the assessment") @PathVariable UUID assessmentId) { | |
| 37 |
1
1. getQuestions : replaced return value with Collections.emptyList for edu/ucsb/cs/scaffold/controller/AssessmentController::getQuestions → KILLED |
return questionRepository.findByAssessmentIdOrderByTitleAsc(assessmentId); |
| 38 | } | |
| 39 | } | |
Mutations | ||
| 30 |
1.1 |
|
| 37 |
1.1 |