1 | package edu.ucsb.cs156.example.controllers; | |
2 | ||
3 | import edu.ucsb.cs156.example.entities.UCSBDiningCommonsMenuItems; | |
4 | import edu.ucsb.cs156.example.errors.EntityNotFoundException; | |
5 | import edu.ucsb.cs156.example.repositories.UCSBDiningCommonsMenuItemsRepository; | |
6 | ||
7 | import io.swagger.v3.oas.annotations.Operation; | |
8 | import io.swagger.v3.oas.annotations.Parameter; | |
9 | import io.swagger.v3.oas.annotations.tags.Tag; | |
10 | import lombok.extern.slf4j.Slf4j; | |
11 | ||
12 | import org.springframework.beans.factory.annotation.Autowired; | |
13 | import org.springframework.security.access.prepost.PreAuthorize; | |
14 | import org.springframework.web.bind.annotation.DeleteMapping; | |
15 | import org.springframework.web.bind.annotation.GetMapping; | |
16 | import org.springframework.web.bind.annotation.PostMapping; | |
17 | import org.springframework.web.bind.annotation.PutMapping; | |
18 | import org.springframework.web.bind.annotation.RequestBody; | |
19 | import org.springframework.web.bind.annotation.RequestMapping; | |
20 | import org.springframework.web.bind.annotation.RequestParam; | |
21 | import org.springframework.web.bind.annotation.RestController; | |
22 | ||
23 | import javax.validation.Valid; | |
24 | ||
25 | @Tag(name = "UCSBDiningCommonsMenuItems") | |
26 | @RequestMapping("/api/ucsbdiningcommonsmenuitem") | |
27 | @RestController | |
28 | @Slf4j | |
29 | public class UCSBDiningCommonsMenuItemsController extends ApiController { | |
30 | ||
31 | @Autowired | |
32 | UCSBDiningCommonsMenuItemsRepository ucsbDiningCommonsMenuItemsRepository; | |
33 | ||
34 | @Operation(summary= "List all ucsb dining commonsmenuitem") | |
35 | @PreAuthorize("hasRole('ROLE_USER')") | |
36 | @GetMapping("/all") | |
37 | public Iterable<UCSBDiningCommonsMenuItems> allCommonsMenuItems() { | |
38 | Iterable<UCSBDiningCommonsMenuItems> commonsmenuitem = ucsbDiningCommonsMenuItemsRepository.findAll(); | |
39 |
1
1. allCommonsMenuItems : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemsController::allCommonsMenuItems → KILLED |
return commonsmenuitem; |
40 | } | |
41 | ||
42 | @Operation(summary= "Create a new commonsmenuitem") | |
43 | @PreAuthorize("hasRole('ROLE_ADMIN')") | |
44 | @PostMapping("/post") | |
45 | public UCSBDiningCommonsMenuItems postCommonsMenuItems( | |
46 | @Parameter(name="code") @RequestParam String code, | |
47 | @Parameter(name="name") @RequestParam String name, | |
48 | @Parameter(name="station") @RequestParam String station | |
49 | ) | |
50 | { | |
51 | ||
52 | UCSBDiningCommonsMenuItems commonsmenuitem = new UCSBDiningCommonsMenuItems(); | |
53 |
1
1. postCommonsMenuItems : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItems::setCode → KILLED |
commonsmenuitem.setCode(code); |
54 |
1
1. postCommonsMenuItems : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItems::setName → KILLED |
commonsmenuitem.setName(name); |
55 |
1
1. postCommonsMenuItems : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItems::setStation → KILLED |
commonsmenuitem.setStation(station); |
56 | ||
57 | UCSBDiningCommonsMenuItems savedCommonsMenuItems = ucsbDiningCommonsMenuItemsRepository.save(commonsmenuitem); | |
58 | ||
59 |
1
1. postCommonsMenuItems : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemsController::postCommonsMenuItems → KILLED |
return savedCommonsMenuItems; |
60 | } | |
61 | ||
62 | @Operation(summary= "Get a single commonsmenuitem") | |
63 | @PreAuthorize("hasRole('ROLE_USER')") | |
64 | @GetMapping("") | |
65 | public UCSBDiningCommonsMenuItems getById( | |
66 | @Parameter(name="id") @RequestParam Long id) { | |
67 | UCSBDiningCommonsMenuItems commonsmenuitem = ucsbDiningCommonsMenuItemsRepository.findById(id) | |
68 |
1
1. lambda$getById$0 : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemsController::lambda$getById$0 → KILLED |
.orElseThrow(() -> new EntityNotFoundException(UCSBDiningCommonsMenuItems.class, id)); |
69 | ||
70 |
1
1. getById : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemsController::getById → KILLED |
return commonsmenuitem; |
71 | } | |
72 | ||
73 | @Operation(summary= "Delete a UCSBDiningCommonsMenuItems") | |
74 | @PreAuthorize("hasRole('ROLE_ADMIN')") | |
75 | @DeleteMapping("") | |
76 | public Object deleteCommonsMenuItems( | |
77 | @Parameter(name="id") @RequestParam Long id) { | |
78 | UCSBDiningCommonsMenuItems commonsmenuitem = ucsbDiningCommonsMenuItemsRepository.findById(id) | |
79 |
1
1. lambda$deleteCommonsMenuItems$1 : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemsController::lambda$deleteCommonsMenuItems$1 → KILLED |
.orElseThrow(() -> new EntityNotFoundException(UCSBDiningCommonsMenuItems.class, id)); |
80 | ||
81 |
1
1. deleteCommonsMenuItems : removed call to edu/ucsb/cs156/example/repositories/UCSBDiningCommonsMenuItemsRepository::delete → KILLED |
ucsbDiningCommonsMenuItemsRepository.delete(commonsmenuitem); |
82 |
1
1. deleteCommonsMenuItems : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemsController::deleteCommonsMenuItems → KILLED |
return genericMessage("UCSBDiningCommonsMenuItems with id %s deleted".formatted(id)); |
83 | } | |
84 | ||
85 | @Operation(summary= "Update a single commonsmenuitem") | |
86 | @PreAuthorize("hasRole('ROLE_ADMIN')") | |
87 | @PutMapping("") | |
88 | public UCSBDiningCommonsMenuItems updateCommonsMenuItems( | |
89 | @Parameter(name="id") @RequestParam Long id, | |
90 | @RequestBody @Valid UCSBDiningCommonsMenuItems incoming) { | |
91 | ||
92 | UCSBDiningCommonsMenuItems commonsmenuitem = ucsbDiningCommonsMenuItemsRepository.findById(id) | |
93 |
1
1. lambda$updateCommonsMenuItems$2 : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemsController::lambda$updateCommonsMenuItems$2 → KILLED |
.orElseThrow(() -> new EntityNotFoundException(UCSBDiningCommonsMenuItems.class, id)); |
94 | ||
95 | ||
96 |
1
1. updateCommonsMenuItems : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItems::setName → KILLED |
commonsmenuitem.setName(incoming.getName()); |
97 |
1
1. updateCommonsMenuItems : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItems::setCode → KILLED |
commonsmenuitem.setCode(incoming.getCode()); |
98 |
1
1. updateCommonsMenuItems : removed call to edu/ucsb/cs156/example/entities/UCSBDiningCommonsMenuItems::setStation → KILLED |
commonsmenuitem.setStation(incoming.getStation()); |
99 | ||
100 | ucsbDiningCommonsMenuItemsRepository.save(commonsmenuitem); | |
101 | ||
102 |
1
1. updateCommonsMenuItems : replaced return value with null for edu/ucsb/cs156/example/controllers/UCSBDiningCommonsMenuItemsController::updateCommonsMenuItems → KILLED |
return commonsmenuitem; |
103 | } | |
104 | } | |
Mutations | ||
39 |
1.1 |
|
53 |
1.1 |
|
54 |
1.1 |
|
55 |
1.1 |
|
59 |
1.1 |
|
68 |
1.1 |
|
70 |
1.1 |
|
79 |
1.1 |
|
81 |
1.1 |
|
82 |
1.1 |
|
93 |
1.1 |
|
96 |
1.1 |
|
97 |
1.1 |
|
98 |
1.1 |
|
102 |
1.1 |