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