1 | package edu.ucsb.cs156.spring.backenddemo.controllers; | |
2 | ||
3 | import org.springframework.web.bind.annotation.RestController; | |
4 | ||
5 | import edu.ucsb.cs156.spring.backenddemo.services.CollegeSubredditQueryService; | |
6 | import io.swagger.v3.oas.annotations.Operation; | |
7 | import io.swagger.v3.oas.annotations.tags.Tag; | |
8 | ||
9 | import org.springframework.web.bind.annotation.GetMapping; | |
10 | import org.springframework.web.bind.annotation.RequestMapping; | |
11 | import org.springframework.beans.factory.annotation.Autowired; | |
12 | import org.springframework.http.ResponseEntity; | |
13 | ||
14 | import com.fasterxml.jackson.core.JsonProcessingException; | |
15 | import com.fasterxml.jackson.databind.ObjectMapper; | |
16 | ||
17 | ||
18 | ||
19 | @Tag(name="College Subreddits from https://github.com/karlding/college-subreddits/") | |
20 | @RestController | |
21 | @RequestMapping("/api/collegesubreddits") | |
22 | public class CollegeSubredditsController { | |
23 | | |
24 | ObjectMapper mapper = new ObjectMapper(); | |
25 | ||
26 | @Autowired | |
27 | CollegeSubredditQueryService collegeSubredditQueryService; | |
28 | ||
29 | @Operation(summary = "Get a list of college subreddits") | |
30 | @GetMapping("/get") | |
31 | public ResponseEntity<String> getSubreddits() throws JsonProcessingException { | |
32 | String result = collegeSubredditQueryService.getJSON(); | |
33 |
1
1. getSubreddits : replaced return value with null for edu/ucsb/cs156/spring/backenddemo/controllers/CollegeSubredditsController::getSubreddits → KILLED |
return ResponseEntity.ok().body(result); |
34 | } | |
35 | ||
36 | } | |
Mutations | ||
33 |
1.1 |