com.osomapps.pt.reportworkout.ReportWorkoutResource   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 14
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create(String,WorkoutReportRequestDTO) 0 5 1
A ReportWorkoutResource(ReportWorkoutService) 0 3 1
A findAll(String) 0 3 1
1
package com.osomapps.pt.reportworkout;
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-workout")
14
class ReportWorkoutResource {
15
16
    private final ReportWorkoutService reportWorkoutService;
17
18
    @Autowired
19
    ReportWorkoutResource(ReportWorkoutService reportWorkoutService) {
20
        this.reportWorkoutService = reportWorkoutService;
21
    }
22
23
    @GetMapping
24
    List<WorkoutReportResponseDTO> findAll(@RequestHeader(value = "X-Token") String token) {
25
        return reportWorkoutService.findAll(token);
26
    }
27
28
    @PostMapping
29
    WorkoutReportResponseDTO create(
30
            @RequestHeader(value = "X-Token") String token,
31
            @RequestBody WorkoutReportRequestDTO workoutReportRequestDTO) {
32
        return reportWorkoutService.create(token, workoutReportRequestDTO);
33
    }
34
}
35