com.osomapps.pt.activecertificate.ActiveCertificateResource   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 ActiveCertificateResource(ActiveCertificateService) 0 3 1
A create(String,ActiveCertificateRequestDTO) 0 5 1
A firstActive(String) 0 3 1
1
package com.osomapps.pt.activecertificate;
2
3
import org.springframework.beans.factory.annotation.Autowired;
4
import org.springframework.web.bind.annotation.GetMapping;
5
import org.springframework.web.bind.annotation.PostMapping;
6
import org.springframework.web.bind.annotation.RequestBody;
7
import org.springframework.web.bind.annotation.RequestHeader;
8
import org.springframework.web.bind.annotation.RequestMapping;
9
import org.springframework.web.bind.annotation.RestController;
10
11
@RestController
12
@RequestMapping("api/v1/active-certificate")
13
class ActiveCertificateResource {
14
15
    private final ActiveCertificateService certificateService;
16
17
    @Autowired
18
    ActiveCertificateResource(ActiveCertificateService certificateService) {
19
        this.certificateService = certificateService;
20
    }
21
22
    @GetMapping
23
    ActiveCertificateResponseDTO firstActive(@RequestHeader(value = "X-Token") String token) {
24
        return certificateService.firstActive(token);
25
    }
26
27
    @PostMapping
28
    ActiveCertificateResponseDTO create(
29
            @RequestHeader(value = "X-Token") String token,
30
            @RequestBody ActiveCertificateRequestDTO certificateRequestDTO) {
31
        return certificateService.create(token, certificateRequestDTO);
32
    }
33
}
34