firstActive(String)   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 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