update(Long,UserRequestDTO)   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
1
package com.osomapps.pt.admin.user;
2
3
import java.util.List;
4
import org.springframework.beans.factory.annotation.Autowired;
5
import org.springframework.web.bind.annotation.DeleteMapping;
6
import org.springframework.web.bind.annotation.GetMapping;
7
import org.springframework.web.bind.annotation.PathVariable;
8
import org.springframework.web.bind.annotation.PostMapping;
9
import org.springframework.web.bind.annotation.PutMapping;
10
import org.springframework.web.bind.annotation.RequestBody;
11
import org.springframework.web.bind.annotation.RequestMapping;
12
import org.springframework.web.bind.annotation.RestController;
13
14
@RestController
15
@RequestMapping("api/v1/admin/user")
16
class AdminUserResource {
17
18
    private final AdminUserService userService;
19
20
    @Autowired
21
    AdminUserResource(AdminUserService userService) {
22
        this.userService = userService;
23
    }
24
25
    @GetMapping
26
    List<UserResponseDTO> findAll() {
27
        return userService.findAll();
28
    }
29
30
    @GetMapping("{id}")
31
    UserResponseDTO findOne(@PathVariable Long id) {
32
        return userService.findOne(id);
33
    }
34
35
    @PostMapping
36
    UserResponseDTO create(@RequestBody UserRequestDTO userRequestDTO) {
37
        return userService.create(userRequestDTO);
38
    }
39
40
    @PutMapping("{id}")
41
    UserResponseDTO update(@PathVariable Long id, @RequestBody UserRequestDTO userRequestDTO) {
42
        return userService.update(id, userRequestDTO);
43
    }
44
45
    @DeleteMapping("{id}")
46
    UserResponseDTO delete(@PathVariable Long id) {
47
        return userService.delete(id);
48
    }
49
}
50