1 | package edu.ucsb.cs156.gauchoride.controllers; | |
2 | ||
3 | import com.fasterxml.jackson.core.JsonProcessingException; | |
4 | import com.fasterxml.jackson.databind.ObjectMapper; | |
5 | ||
6 | import edu.ucsb.cs156.gauchoride.entities.User; | |
7 | import edu.ucsb.cs156.gauchoride.repositories.UserRepository; | |
8 | import edu.ucsb.cs156.gauchoride.entities.DriverShift; | |
9 | import edu.ucsb.cs156.gauchoride.repositories.DriverShiftRepository; | |
10 | import edu.ucsb.cs156.gauchoride.entities.DriverShift.Weekday; | |
11 | ||
12 | import edu.ucsb.cs156.gauchoride.errors.EntityNotFoundException; | |
13 | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | |
15 | import org.springframework.http.ResponseEntity; | |
16 | import org.springframework.security.access.prepost.PreAuthorize; | |
17 | import org.springframework.web.bind.annotation.DeleteMapping; | |
18 | import org.springframework.web.bind.annotation.GetMapping; | |
19 | import org.springframework.web.bind.annotation.PostMapping; | |
20 | import org.springframework.web.bind.annotation.PutMapping; | |
21 | import org.springframework.web.bind.annotation.PathVariable; | |
22 | import org.springframework.web.bind.annotation.RequestMapping; | |
23 | import org.springframework.web.bind.annotation.RequestParam; | |
24 | import org.springframework.web.bind.annotation.RestController; | |
25 | ||
26 | import org.springframework.web.bind.annotation.RequestBody; | |
27 | import javax.validation.Valid; | |
28 | ||
29 | import io.swagger.annotations.Api; | |
30 | import io.swagger.annotations.ApiOperation; | |
31 | import io.swagger.annotations.ApiParam; | |
32 | ||
33 | import com.fasterxml.jackson.annotation.JsonFormat; | |
34 | import java.time.LocalDateTime; | |
35 | ||
36 | @Api(description = "Driver shift information") | |
37 | @RequestMapping("/api/drivershifts") | |
38 | @RestController | |
39 | public class DriverShiftController extends ApiController { | |
40 | @Autowired | |
41 | DriverShiftRepository driverShiftRepository; | |
42 | ||
43 | @Autowired | |
44 | ObjectMapper mapper; | |
45 | ||
46 | @ApiOperation(value = "Get a list of all driver shifts") | |
47 | @PreAuthorize("hasRole('ROLE_ADMIN') || hasRole('ROLE_DRIVER')") | |
48 | @GetMapping("/all") | |
49 | public Iterable<DriverShift> getAllDriverShifts() { | |
50 | Iterable<DriverShift> driverShifts = driverShiftRepository.findAll(); | |
51 |
1
1. getAllDriverShifts : replaced return value with null for edu/ucsb/cs156/gauchoride/controllers/DriverShiftController::getAllDriverShifts → KILLED |
return driverShifts; |
52 | } | |
53 | } | |
Mutations | ||
51 |
1.1 |