source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/controllers/SuperAdminController.java

Last change on this file was 775e15e, checked in by Marko <Marko@…>, 2 years ago

Added more controllers

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package finki.it.phoneluxbackend.controllers;
2
3import finki.it.phoneluxbackend.entities.PhoneOffer;
4import finki.it.phoneluxbackend.entities.User;
5import finki.it.phoneluxbackend.services.UserService;
6import lombok.AllArgsConstructor;
7import org.springframework.http.ResponseEntity;
8import org.springframework.web.bind.annotation.*;
9
10import java.util.Comparator;
11import java.util.List;
12import java.util.stream.Collectors;
13
14@RestController
15@RequestMapping(path = "/management")
16@AllArgsConstructor
17public class SuperAdminController {
18 private final UserService userService;
19
20 @GetMapping(path = "/users")
21 public List<User> getUsers(@RequestParam(name = "searchValue", required = false) String searchValue){
22 return userService.getUsers(searchValue);
23 }
24
25 @PutMapping(path = "/addadmin/{userId}")
26 public ResponseEntity<Object> giveAdminRoleToUser(@PathVariable("userId") Long userId){
27 return userService.giveAdminRoleToUser(userId);
28 }
29
30 @PutMapping(path = "/removeadmin/{userId}")
31 public ResponseEntity<Object> removeAdminRoleFromUser(@PathVariable("userId") Long userId){
32 return userService.removeAdminRoleFromUser(userId);
33 }
34
35}
Note: See TracBrowser for help on using the repository browser.