Last change
on this file since 7e88e46 was 775e15e, checked in by Marko <Marko@…>, 2 years ago |
Added more controllers
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | package finki.it.phoneluxbackend.controllers;
|
---|
2 |
|
---|
3 | import finki.it.phoneluxbackend.entities.PhoneOffer;
|
---|
4 | import finki.it.phoneluxbackend.entities.User;
|
---|
5 | import finki.it.phoneluxbackend.services.UserService;
|
---|
6 | import lombok.AllArgsConstructor;
|
---|
7 | import org.springframework.http.ResponseEntity;
|
---|
8 | import org.springframework.web.bind.annotation.*;
|
---|
9 |
|
---|
10 | import java.util.Comparator;
|
---|
11 | import java.util.List;
|
---|
12 | import java.util.stream.Collectors;
|
---|
13 |
|
---|
14 | @RestController
|
---|
15 | @RequestMapping(path = "/management")
|
---|
16 | @AllArgsConstructor
|
---|
17 | public 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.