| 1 | package edu.ucsb.cs156.happiercows.controllers; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.happiercows.entities.UserCommons; | |
| 4 | import edu.ucsb.cs156.happiercows.repositories.UserCommonsRepository; | |
| 5 | import io.swagger.v3.oas.annotations.Operation; | |
| 6 | import io.swagger.v3.oas.annotations.tags.Tag; | |
| 7 | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | import org.springframework.security.access.prepost.PreAuthorize; | |
| 10 | import org.springframework.web.bind.annotation.*; | |
| 11 | ||
| 12 | @Tag(name = "Dashboard") | |
| 13 | @RequestMapping("/api/dashboard") | |
| 14 | @RestController | |
| 15 | public class DashboardController { | |
| 16 | ||
| 17 | @Autowired | |
| 18 | UserCommonsRepository userCommonsRepository; | |
| 19 | ||
| 20 | @Operation(summary = "Get cow count histogram data for a commons") | |
| 21 | @PreAuthorize("hasRole('ROLE_ADMIN')") | |
| 22 | @GetMapping("/histogram/{id}") | |
| 23 | public Iterable<UserCommons> histogram(@PathVariable Long id) { | |
| 24 |
1
1. histogram : replaced return value with Collections.emptyList for edu/ucsb/cs156/happiercows/controllers/DashboardController::histogram → KILLED |
return userCommonsRepository.findByCommonsId(id); |
| 25 | } | |
| 26 | } | |
Mutations | ||
| 24 |
1.1 |