1 | package org.cardanofoundation.explorer.api.controller; | |
2 | ||
3 | import jakarta.validation.Valid; | |
4 | ||
5 | import lombok.RequiredArgsConstructor; | |
6 | ||
7 | import org.springframework.http.ResponseEntity; | |
8 | import org.springframework.validation.annotation.Validated; | |
9 | import org.springframework.web.bind.annotation.GetMapping; | |
10 | import org.springframework.web.bind.annotation.PathVariable; | |
11 | import org.springframework.web.bind.annotation.RequestMapping; | |
12 | import org.springframework.web.bind.annotation.RestController; | |
13 | ||
14 | import io.swagger.v3.oas.annotations.Operation; | |
15 | import io.swagger.v3.oas.annotations.Parameter; | |
16 | import io.swagger.v3.oas.annotations.tags.Tag; | |
17 | import org.springdoc.core.annotations.ParameterObject; | |
18 | ||
19 | import org.cardanofoundation.explorer.api.config.LogMessage; | |
20 | import org.cardanofoundation.explorer.api.model.response.BaseFilterResponse; | |
21 | import org.cardanofoundation.explorer.api.model.response.token.PolicyResponse; | |
22 | import org.cardanofoundation.explorer.api.model.response.token.TokenFilterResponse; | |
23 | import org.cardanofoundation.explorer.api.service.PolicyService; | |
24 | import org.cardanofoundation.explorer.common.validation.pagination.Pagination; | |
25 | import org.cardanofoundation.explorer.common.validation.pagination.PaginationValid; | |
26 | ||
27 | @RestController | |
28 | @RequestMapping("/api/v1/policies") | |
29 | @RequiredArgsConstructor | |
30 | @Validated | |
31 | @Tag(name = "policies", description = "The policy APIs") | |
32 | public class PolicyController { | |
33 | ||
34 | private final PolicyService policyService; | |
35 | ||
36 | @GetMapping("/{policyId}") | |
37 | @LogMessage | |
38 | @Operation( | |
39 | summary = "Get detail information of policy", | |
40 | tags = {"policies"}) | |
41 | public ResponseEntity<PolicyResponse> getPolicyDetail( | |
42 | @PathVariable @Parameter(description = "The policy hash") String policyId) { | |
43 |
1
1. getPolicyDetail : replaced return value with null for org/cardanofoundation/explorer/api/controller/PolicyController::getPolicyDetail → KILLED |
return ResponseEntity.ok(policyService.getPolicyDetail(policyId)); |
44 | } | |
45 | ||
46 | @GetMapping("/{policyId}/tokens") | |
47 | @LogMessage | |
48 | @Operation( | |
49 | summary = "Get tokens of a policy", | |
50 | description = "Get all tokens of a policy", | |
51 | tags = {"policies"}) | |
52 | public ResponseEntity<BaseFilterResponse<TokenFilterResponse>> getTokens( | |
53 | @PathVariable @Parameter(description = "The policy hash") String policyId, | |
54 | @ParameterObject @PaginationValid @Valid Pagination pagination) { | |
55 |
1
1. getTokens : replaced return value with null for org/cardanofoundation/explorer/api/controller/PolicyController::getTokens → KILLED |
return ResponseEntity.ok(policyService.getTokens(policyId, pagination.toPageable())); |
56 | } | |
57 | } | |
Mutations | ||
43 |
1.1 |
|
55 |
1.1 |