| 1 | package edu.ucsb.cs156.dining.controllers; | |
| 2 | ||
| 3 | import com.fasterxml.jackson.core.JsonProcessingException; | |
| 4 | import com.fasterxml.jackson.databind.ObjectMapper; | |
| 5 | import edu.ucsb.cs156.dining.models.DiningCommons; | |
| 6 | import edu.ucsb.cs156.dining.errors.EntityNotFoundException; | |
| 7 | import edu.ucsb.cs156.dining.services.DiningCommonsService; | |
| 8 | import io.swagger.v3.oas.annotations.Operation; | |
| 9 | import io.swagger.v3.oas.annotations.Parameter; | |
| 10 | import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | import java.util.List; | |
| 12 | import lombok.extern.slf4j.Slf4j; | |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | import org.springframework.web.bind.annotation.DeleteMapping; | |
| 16 | import org.springframework.web.bind.annotation.GetMapping; | |
| 17 | import org.springframework.web.bind.annotation.PostMapping; | |
| 18 | import org.springframework.web.bind.annotation.RequestMapping; | |
| 19 | import org.springframework.web.bind.annotation.RequestParam; | |
| 20 | import org.springframework.web.bind.annotation.RestController; | |
| 21 | ||
| 22 | @Slf4j | |
| 23 | @Tag(name = "API to handle get all dining commons from UCSB developer API website") | |
| 24 | @RequestMapping("/api/dining") | |
| 25 | @RestController | |
| 26 | public class DiningCommonsController extends ApiController /* implements ApplicationRunner */ { | |
| 27 | ||
| 28 |   @Autowired ObjectMapper mapper; | |
| 29 | ||
| 30 |   @Autowired DiningCommonsService diningCommonsService; | |
| 31 | ||
| 32 |   @Operation(summary = "Get all Dining Commons") | |
| 33 |   @GetMapping(value = "/all", produces = "application/json") | |
| 34 |   public Iterable<DiningCommons> allDiningCommons() throws Exception { | |
| 35 |     Iterable<DiningCommons> diningCommons = diningCommonsService.get(); | |
| 36 |      | |
| 37 | 
1
1. allDiningCommons : replaced return value with Collections.emptyList for edu/ucsb/cs156/dining/controllers/DiningCommonsController::allDiningCommons → KILLED | 
    return diningCommons; | 
| 38 |   } | |
| 39 | } | |
Mutations | ||
| 37 | 
 
 1.1  |