| 1 | package edu.ucsb.cs156.dining.controllers; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.dining.services.UCSBDiningMenuService; | |
| 4 | import io.swagger.v3.oas.annotations.Operation; | |
| 5 | import io.swagger.v3.oas.annotations.Parameter; | |
| 6 | import io.swagger.v3.oas.annotations.tags.Tag; | |
| 7 | import lombok.extern.slf4j.Slf4j; | |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | import org.springframework.http.ResponseEntity; | |
| 10 | import org.springframework.web.bind.annotation.GetMapping; | |
| 11 | import org.springframework.web.bind.annotation.PathVariable; | |
| 12 | import org.springframework.web.bind.annotation.RequestMapping; | |
| 13 | import org.springframework.web.bind.annotation.RestController; | |
| 14 | ||
| 15 | @Tag(name = "UCSBDiningMenuController") | |
| 16 | @RestController | |
| 17 | @RequestMapping("/api/diningcommons") | |
| 18 | @Slf4j | |
| 19 | public class UCSBDiningMenuController extends ApiController { | |
| 20 | ||
| 21 | @Autowired UCSBDiningMenuService ucsbDiningMenuService; | |
| 22 | ||
| 23 | @Operation(summary = "Get list of meals serving in given dining common on given date") | |
| 24 | @GetMapping(value = "/{date-time}/{dining-commons-code}", produces = "application/json") | |
| 25 | public ResponseEntity<String> menutimes( | |
| 26 | @Parameter( | |
| 27 | description = | |
| 28 | "date (in iso format, e.g. YYYY-mm-dd) or date-time (in iso format e.g. YYYY-mm-ddTHH:MM:SS)") | |
| 29 | @PathVariable("date-time") | |
| 30 | String datetime, | |
| 31 | @PathVariable("dining-commons-code") String diningcommoncode) | |
| 32 | throws Exception { | |
| 33 | ||
| 34 | String body = ucsbDiningMenuService.getJSON(datetime, diningcommoncode); | |
| 35 | ||
| 36 |
3
1. menutimes : negated conditional → KILLED 2. menutimes : negated conditional → KILLED 3. menutimes : negated conditional → KILLED |
if (body == null || body.isEmpty() || body.equals("[]")) { |
| 37 |
1
1. menutimes : replaced return value with null for edu/ucsb/cs156/dining/controllers/UCSBDiningMenuController::menutimes → KILLED |
return ResponseEntity.noContent().build(); |
| 38 | } | |
| 39 | ||
| 40 |
1
1. menutimes : replaced return value with null for edu/ucsb/cs156/dining/controllers/UCSBDiningMenuController::menutimes → KILLED |
return ResponseEntity.ok().body(body); |
| 41 | } | |
| 42 | } | |
Mutations | ||
| 36 |
1.1 2.2 3.3 |
|
| 37 |
1.1 |
|
| 40 |
1.1 |