com.osomapps.pt.admin.user.AdminUserResource   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 21
dl 0
loc 34
c 0
b 0
f 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A update(Long,UserRequestDTO) 0 3 1
A findOne(Long) 0 3 1
A findAll() 0 3 1
A AdminUserResource(AdminUserService) 0 3 1
A create(UserRequestDTO) 0 3 1
A delete(Long) 0 3 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