| 1 | package edu.ucsb.cs156.dining.controllers; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.dining.repositories.UserRepository; | |
| 4 | import edu.ucsb.cs156.dining.services.DiningMenuAPIService; | |
| 5 | import io.swagger.v3.oas.annotations.Operation; | |
| 6 | import io.swagger.v3.oas.annotations.tags.Tag; | |
| 7 | ||
| 8 | import java.time.OffsetDateTime; | |
| 9 | import lombok.extern.slf4j.Slf4j; | |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | import org.springframework.http.ResponseEntity; | |
| 12 | import org.springframework.web.bind.annotation.GetMapping; | |
| 13 | import org.springframework.web.bind.annotation.RequestMapping; | |
| 14 | import org.springframework.web.bind.annotation.RequestParam; | |
| 15 | import org.springframework.web.bind.annotation.RestController; | |
| 16 | ||
| 17 | @Tag(name = "DiningMenuAPIController") | |
| 18 | @RestController | |
| 19 | @RequestMapping("/api/dining") | |
| 20 | @Slf4j | |
| 21 | public class DiningMenuAPIController extends ApiController { | |
| 22 | ||
| 23 | @Autowired UserRepository userRepository; | |
| 24 | @Autowired DiningMenuAPIService diningMenuAPIService; | |
| 25 | ||
| 26 | @Operation(summary = "Get list of days with meal service") | |
| 27 | @GetMapping(value = "/getDays", produces = "application/json") | |
| 28 | public ResponseEntity<String> getDays() throws Exception { | |
| 29 | String body = diningMenuAPIService.getDays(); | |
| 30 |
1
1. getDays : replaced return value with null for edu/ucsb/cs156/dining/controllers/DiningMenuAPIController::getDays → KILLED |
return ResponseEntity.ok().body(body); |
| 31 | } | |
| 32 | ||
| 33 | @Operation(summary = "Get list of dining commons serving meals on given date") | |
| 34 | @GetMapping(value = "/getCommons", produces = "application/json") | |
| 35 | public ResponseEntity<String> getCommons( @RequestParam OffsetDateTime dateTime) throws Exception { | |
| 36 | String body = diningMenuAPIService.getCommons(dateTime); | |
| 37 |
1
1. getCommons : replaced return value with null for edu/ucsb/cs156/dining/controllers/DiningMenuAPIController::getCommons → KILLED |
return ResponseEntity.ok().body(body); |
| 38 | } | |
| 39 | ||
| 40 | @Operation(summary = "Get list of meals served in given dining commons on given date") | |
| 41 | @GetMapping(value = "/getMeals", produces = "application/json") | |
| 42 | public ResponseEntity<String> getMeals (@RequestParam OffsetDateTime dateTime, @RequestParam String diningCommonsCode) throws Exception { | |
| 43 | String body = diningMenuAPIService.getMeals(dateTime, diningCommonsCode); | |
| 44 |
1
1. getMeals : replaced return value with null for edu/ucsb/cs156/dining/controllers/DiningMenuAPIController::getMeals → KILLED |
return ResponseEntity.ok().body(body); |
| 45 | } | |
| 46 | } | |
Mutations | ||
| 30 |
1.1 |
|
| 37 |
1.1 |
|
| 44 |
1.1 |