1 | package edu.ucsb.cs156.example.controllers; | |
2 | ||
3 | import edu.ucsb.cs156.example.entities.UCSBDate; | |
4 | import edu.ucsb.cs156.example.entities.UCSBDiningCommonsMenuItem; | |
5 | import edu.ucsb.cs156.example.errors.EntityNotFoundException; | |
6 | import edu.ucsb.cs156.example.repositories.UCSBDiningCommonsMenuItemRepository; | |
7 | ||
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 lombok.extern.slf4j.Slf4j; | |
12 | ||
13 | import com.fasterxml.jackson.core.JsonProcessingException; | |
14 | ||
15 | import org.springframework.beans.factory.annotation.Autowired; | |
16 | import org.springframework.format.annotation.DateTimeFormat; | |
17 | import org.springframework.security.access.prepost.PreAuthorize; | |
18 | import org.springframework.web.bind.annotation.DeleteMapping; | |
19 | import org.springframework.web.bind.annotation.GetMapping; | |
20 | import org.springframework.web.bind.annotation.PostMapping; | |
21 | import org.springframework.web.bind.annotation.PutMapping; | |
22 | import org.springframework.web.bind.annotation.RequestBody; | |
23 | import org.springframework.web.bind.annotation.RequestMapping; | |
24 | import org.springframework.web.bind.annotation.RequestParam; | |
25 | import org.springframework.web.bind.annotation.RestController; | |
26 | ||
27 | import javax.validation.Valid; | |
28 | ||
29 | import java.time.LocalDateTime; | |
30 | ||
31 | @Tag(name = "UCSBDiningCommonsMenuItem") | |
32 | @RequestMapping("/api/UCSBDiningCommonsMenuItem") | |
33 | @RestController | |
34 | @Slf4j | |
35 | ||
36 | public class UCSBDiningCommonsMenuItemController extends ApiController { | |
37 | | |
38 | @Autowired | |
39 | UCSBDiningCommonsMenuItemRepository ucsbDiningCommonsMenuItemRepository; | |
40 | ||
41 | @Operation(summary= "List all UCSB Dining Commons menu items") | |
42 | @PreAuthorize("hasRole('ROLE_USER')") | |
43 | @GetMapping("/all") | |
44 | public Iterable<UCSBDiningCommonsMenuItem> allUCSBDiningCommonsMenuItem() { | |
45 | Iterable<UCSBDiningCommonsMenuItem> UCSBDiningCommonsMenuItem = ucsbDiningCommonsMenuItemRepository.findAll(); | |
46 |
1
1. allUCSBDiningCommonsMenuItem : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemController::allUCSBDiningCommonsMenuItem → KILLED |
return UCSBDiningCommonsMenuItem; |
47 | } | |
48 | ||
49 | @Operation(summary= "Create a UCSB Dining Commons menu item") | |
50 | @PreAuthorize("hasRole('ROLE_ADMIN')") | |
51 | @PostMapping("/post") | |
52 | public UCSBDiningCommonsMenuItem postUCSBDiningCommonsMenuItem( | |
53 | @Parameter(name="diningCommonsCode") @RequestParam String diningCommonsCode, | |
54 | @Parameter(name="name") @RequestParam String name, | |
55 | @Parameter(name="station") @RequestParam String station | |
56 | ) | |
57 | { | |
58 | ||
59 | UCSBDiningCommonsMenuItem ucsbDiningCommonsMenuItem = new UCSBDiningCommonsMenuItem(); | |
60 |
1
1. postUCSBDiningCommonsMenuItem : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItem::setDiningCommonsCode → KILLED |
ucsbDiningCommonsMenuItem.setDiningCommonsCode(diningCommonsCode); |
61 |
1
1. postUCSBDiningCommonsMenuItem : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItem::setName → KILLED |
ucsbDiningCommonsMenuItem.setName(name); |
62 |
1
1. postUCSBDiningCommonsMenuItem : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItem::setStation → KILLED |
ucsbDiningCommonsMenuItem.setStation(station); |
63 | ||
64 | UCSBDiningCommonsMenuItem savedUcsbDiningCommonsMenuItem = ucsbDiningCommonsMenuItemRepository.save(ucsbDiningCommonsMenuItem); | |
65 | ||
66 |
1
1. postUCSBDiningCommonsMenuItem : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemController::postUCSBDiningCommonsMenuItem → KILLED |
return savedUcsbDiningCommonsMenuItem; |
67 | } | |
68 | ||
69 | @Operation(summary= "Get a single UCSB Dining Commons menu item") | |
70 | @PreAuthorize("hasRole('ROLE_USER')") | |
71 | @GetMapping("") | |
72 | public UCSBDiningCommonsMenuItem getById( | |
73 | @Parameter(name="id") @RequestParam Long id) { | |
74 | UCSBDiningCommonsMenuItem ucsbDiningCommonsMenuItem = ucsbDiningCommonsMenuItemRepository.findById(id) | |
75 |
1
1. lambda$getById$0 : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemController::lambda$getById$0 → KILLED |
.orElseThrow(() -> new EntityNotFoundException(UCSBDiningCommonsMenuItem.class, id)); |
76 | ||
77 |
1
1. getById : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemController::getById → KILLED |
return ucsbDiningCommonsMenuItem; |
78 | } | |
79 | ||
80 | @Operation(summary= "Delete a UCSB Dining Commons menu item") | |
81 | @PreAuthorize("hasRole('ROLE_ADMIN')") | |
82 | @DeleteMapping("") | |
83 | public Object deleteUCSBDiningCommonsMenuItem( | |
84 | @Parameter(name="id") @RequestParam Long id) { | |
85 | UCSBDiningCommonsMenuItem ucsbDiningCommonsMenuItem = ucsbDiningCommonsMenuItemRepository.findById(id) | |
86 |
1
1. lambda$deleteUCSBDiningCommonsMenuItem$1 : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemController::lambda$deleteUCSBDiningCommonsMenuItem$1 → KILLED |
.orElseThrow(() -> new EntityNotFoundException(UCSBDiningCommonsMenuItem.class, id)); |
87 | ||
88 |
1
1. deleteUCSBDiningCommonsMenuItem : removed call to edu/ucsb/cs156/example/repositories/UCSBDiningCommonsMenuItemRepository::delete → KILLED |
ucsbDiningCommonsMenuItemRepository.delete(ucsbDiningCommonsMenuItem); |
89 |
1
1. deleteUCSBDiningCommonsMenuItem : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemController::deleteUCSBDiningCommonsMenuItem → KILLED |
return genericMessage("UCSBDiningCommonsMenuItem with id %s deleted".formatted(id)); |
90 | } | |
91 | ||
92 | @Operation(summary= "Update a single UCSB Dining Commons menu item") | |
93 | @PreAuthorize("hasRole('ROLE_ADMIN')") | |
94 | @PutMapping("") | |
95 | public UCSBDiningCommonsMenuItem updateUCSBDiningCommonsMenuItem( | |
96 | @Parameter(name="id") @RequestParam Long id, | |
97 | @RequestBody @Valid UCSBDiningCommonsMenuItem incoming) { | |
98 | ||
99 | UCSBDiningCommonsMenuItem ucsbDiningCommonsMenuItem = ucsbDiningCommonsMenuItemRepository.findById(id) | |
100 |
1
1. lambda$updateUCSBDiningCommonsMenuItem$2 : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemController::lambda$updateUCSBDiningCommonsMenuItem$2 → KILLED |
.orElseThrow(() -> new EntityNotFoundException(UCSBDiningCommonsMenuItem.class, id)); |
101 | ||
102 |
1
1. updateUCSBDiningCommonsMenuItem : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItem::setDiningCommonsCode → KILLED |
ucsbDiningCommonsMenuItem.setDiningCommonsCode(incoming.getDiningCommonsCode()); |
103 |
1
1. updateUCSBDiningCommonsMenuItem : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItem::setName → KILLED |
ucsbDiningCommonsMenuItem.setName(incoming.getName()); |
104 |
1
1. updateUCSBDiningCommonsMenuItem : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItem::setStation → KILLED |
ucsbDiningCommonsMenuItem.setStation(incoming.getStation()); |
105 | ||
106 | ucsbDiningCommonsMenuItemRepository.save(ucsbDiningCommonsMenuItem); | |
107 | ||
108 |
1
1. updateUCSBDiningCommonsMenuItem : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemController::updateUCSBDiningCommonsMenuItem → KILLED |
return ucsbDiningCommonsMenuItem; |
109 | } | |
110 | } | |
Mutations | ||
46 |
1.1 |
|
60 |
1.1 |
|
61 |
1.1 |
|
62 |
1.1 |
|
66 |
1.1 |
|
75 |
1.1 |
|
77 |
1.1 |
|
86 |
1.1 |
|
88 |
1.1 |
|
89 |
1.1 |
|
100 |
1.1 |
|
102 |
1.1 |
|
103 |
1.1 |
|
104 |
1.1 |
|
108 |
1.1 |