1 | package edu.ucsb.cs156.courses.controllers; | |
2 | ||
3 | import edu.ucsb.cs156.courses.entities.GradeData; | |
4 | ||
5 | import edu.ucsb.cs156.courses.repositories.GradeDataRepository; | |
6 | import edu.ucsb.cs156.courses.services.UCSBGradeDataService; | |
7 | import edu.ucsb.cs156.courses.utilities.CourseUtilities; | |
8 | import io.swagger.annotations.Api; | |
9 | import io.swagger.annotations.ApiOperation; | |
10 | import lombok.extern.slf4j.Slf4j; | |
11 | ||
12 | import com.fasterxml.jackson.databind.ObjectMapper; | |
13 | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | |
15 | import org.springframework.http.HttpStatus; | |
16 | import org.springframework.http.ResponseEntity; | |
17 | import org.springframework.security.access.prepost.PreAuthorize; | |
18 | import org.springframework.web.bind.annotation.GetMapping; | |
19 | import org.springframework.web.bind.annotation.PostMapping; | |
20 | ||
21 | import org.springframework.web.bind.annotation.RequestMapping; | |
22 | import org.springframework.web.bind.annotation.RequestParam; | |
23 | import org.springframework.web.bind.annotation.RequestPart; | |
24 | ||
25 | import org.springframework.web.bind.annotation.RestController; | |
26 | import org.springframework.web.multipart.MultipartFile; | |
27 | import org.springframework.web.server.ResponseStatusException; | |
28 | ||
29 | import java.io.IOException; | |
30 | import java.io.InputStreamReader; | |
31 | import java.io.Reader; | |
32 | import java.util.List; | |
33 | ||
34 | @Slf4j | |
35 | @Api(description = "API for grade data data") | |
36 | @RequestMapping("/api/gradedata") | |
37 | @RestController | |
38 | public class GradeDataController extends ApiController { | |
39 | @Autowired | |
40 | GradeDataRepository gradeDataRepository; | |
41 | ||
42 | @Autowired | |
43 | ObjectMapper mapper; | |
44 | ||
45 | @ApiOperation(value = "Get grade data for a course") | |
46 | @GetMapping(value = "/search", produces = "application/json") | |
47 | public Iterable<GradeData> gradeDataBySubjectAreaAndCourseNumber( | |
48 | @RequestParam String subjectArea, | |
49 | @RequestParam String courseNumber | |
50 | ) { | |
51 | String course=CourseUtilities.makeFormattedCourseId(subjectArea, courseNumber); | |
52 | Iterable<GradeData> gradeDataRows = gradeDataRepository.findByCourse(course); | |
53 |
1
1. gradeDataBySubjectAreaAndCourseNumber : replaced return value with null for edu/ucsb/cs156/courses/controllers/GradeDataController::gradeDataBySubjectAreaAndCourseNumber → KILLED |
return gradeDataRows; |
54 | } | |
55 | ||
56 | } | |
Mutations | ||
53 |
1.1 |