com.osomapps.pt.admin.ptuser.AdminPtUserResource   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 22
dl 0
loc 35
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A findAll() 0 3 1
A findOne(Long) 0 3 1
A AdminPtUserResource(AdminPtUserService) 0 3 1
A create(PtUserRequestDTO) 0 3 1
A delete(Long) 0 3 1
A update(Long,PtUserRequestDTO) 0 4 1
1
package com.osomapps.pt.admin.ptuser;
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/pt-user")
16
class AdminPtUserResource {
17
18
    private final AdminPtUserService ptUserService;
19
20
    @Autowired
21
    AdminPtUserResource(AdminPtUserService ptUserService) {
22
        this.ptUserService = ptUserService;
23
    }
24
25
    @GetMapping
26
    List<PtUserResponseDTO> findAll() {
27
        return ptUserService.findAll();
28
    }
29
30
    @GetMapping("{id}")
31
    PtUserResponseDTO findOne(@PathVariable Long id) {
32
        return ptUserService.findOne(id);
33
    }
34
35
    @PostMapping
36
    PtUserResponseDTO create(@RequestBody PtUserRequestDTO ptUserRequestDTO) {
37
        return ptUserService.create(ptUserRequestDTO);
38
    }
39
40
    @PutMapping("{id}")
41
    PtUserResponseDTO update(
42
            @PathVariable Long id, @RequestBody PtUserRequestDTO ptUserRequestDTO) {
43
        return ptUserService.update(id, ptUserRequestDTO);
44
    }
45
46
    @DeleteMapping("{id}")
47
    PtUserResponseDTO delete(@PathVariable Long id) {
48
        return ptUserService.delete(id);
49
    }
50
}
51