create(String,WeightRequestDTO)   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
1
package com.osomapps.pt.reportweight;
2
3
import java.util.List;
4
import org.springframework.beans.factory.annotation.Autowired;
5
import org.springframework.web.bind.annotation.GetMapping;
6
import org.springframework.web.bind.annotation.PostMapping;
7
import org.springframework.web.bind.annotation.RequestBody;
8
import org.springframework.web.bind.annotation.RequestHeader;
9
import org.springframework.web.bind.annotation.RequestMapping;
10
import org.springframework.web.bind.annotation.RestController;
11
12
@RestController
13
@RequestMapping("api/v1/report-weight")
14
class ReportWeightResource {
15
16
    private final ReportWeightService reportWeightService;
17
18
    @Autowired
19
    ReportWeightResource(ReportWeightService reportWeightService) {
20
        this.reportWeightService = reportWeightService;
21
    }
22
23
    @GetMapping
24
    List<WeightResponseDTO> findAll(@RequestHeader(value = "X-Token") String token) {
25
        return reportWeightService.findAll(token);
26
    }
27
28
    @PostMapping
29
    WeightResponseDTO create(
30
            @RequestHeader(value = "X-Token") String token,
31
            @RequestBody WeightRequestDTO weightRequestDTO) {
32
        return reportWeightService.create(token, weightRequestDTO);
33
    }
34
}
35