CommitteeController.java

1
package org.cardanofoundation.explorer.api.controller;
2
3
import jakarta.validation.Valid;
4
5
import lombok.RequiredArgsConstructor;
6
7
import org.springframework.data.domain.Sort;
8
import org.springframework.http.ResponseEntity;
9
import org.springframework.validation.annotation.Validated;
10
import org.springframework.web.bind.annotation.GetMapping;
11
import org.springframework.web.bind.annotation.PathVariable;
12
import org.springframework.web.bind.annotation.RequestMapping;
13
import org.springframework.web.bind.annotation.RequestParam;
14
import org.springframework.web.bind.annotation.RestController;
15
16
import io.swagger.v3.oas.annotations.Operation;
17
import io.swagger.v3.oas.annotations.Parameter;
18
import io.swagger.v3.oas.annotations.tags.Tag;
19
import org.springdoc.core.annotations.ParameterObject;
20
21
import org.cardanofoundation.explorer.api.config.LogMessage;
22
import org.cardanofoundation.explorer.api.model.response.BaseFilterResponse;
23
import org.cardanofoundation.explorer.api.model.response.committee.CommitteeMemberResponse;
24
import org.cardanofoundation.explorer.api.model.response.committee.CommitteeOverviewResponse;
25
import org.cardanofoundation.explorer.api.model.response.drep.VotingProcedureChartResponse;
26
import org.cardanofoundation.explorer.api.service.CCommitteeService;
27
import org.cardanofoundation.explorer.api.service.GovernanceActionService;
28
import org.cardanofoundation.explorer.common.entity.enumeration.GovActionType;
29
import org.cardanofoundation.explorer.common.entity.ledgersync.CommitteeMember_;
30
import org.cardanofoundation.explorer.common.validation.pagination.Pagination;
31
import org.cardanofoundation.explorer.common.validation.pagination.PaginationDefault;
32
import org.cardanofoundation.explorer.common.validation.pagination.PaginationValid;
33
34
@RestController
35
@RequestMapping("/api/v1/committee")
36
@RequiredArgsConstructor
37
@Validated
38
@Tag(name = "committee", description = "The committee APIs")
39
public class CommitteeController {
40
41
  private final CCommitteeService cCommitteeService;
42
  private final GovernanceActionService governanceActionService;
43
44
  @GetMapping("/overview")
45
  @LogMessage
46
  @Operation(
47
      summary = "Current constitutional committee overview",
48
      tags = {"committee"})
49
  public ResponseEntity<CommitteeOverviewResponse> getCommitteeOverview() {
50 1 1. getCommitteeOverview : replaced return value with null for org/cardanofoundation/explorer/api/controller/CommitteeController::getCommitteeOverview → NO_COVERAGE
    return ResponseEntity.ok(cCommitteeService.getCommitteeOverview());
51
  }
52
53
  @GetMapping("/members")
54
  @LogMessage
55
  @Operation(
56
      summary = "Get committee members",
57
      tags = {"committee"})
58
  public ResponseEntity<BaseFilterResponse<CommitteeMemberResponse>> getCommitteeMembers(
59
      @ParameterObject
60
          @Valid
61
          @PaginationValid
62
          @PaginationDefault(sort = CommitteeMember_.EXPIRED_EPOCH, direction = Sort.Direction.DESC)
63
          Pagination pagination) {
64 1 1. getCommitteeMembers : replaced return value with null for org/cardanofoundation/explorer/api/controller/CommitteeController::getCommitteeMembers → NO_COVERAGE
    return ResponseEntity.ok(cCommitteeService.getCommitteeMembers(pagination.toPageable()));
65
  }
66
67
  @GetMapping("{publicKey}")
68
  @LogMessage
69
  @Operation(
70
      summary = "Get committee members",
71
      tags = {"committee"})
72
  public ResponseEntity<CommitteeMemberResponse> getCommitteeDetail(
73
      @PathVariable String publicKey) {
74 1 1. getCommitteeDetail : replaced return value with null for org/cardanofoundation/explorer/api/controller/CommitteeController::getCommitteeDetail → NO_COVERAGE
    return ResponseEntity.ok(cCommitteeService.getCommitteeMemberDetail(publicKey));
75
  }
76
77
  @GetMapping("/{publicKey}/vote-procedure-chart")
78
  @LogMessage
79
  @Operation(
80
      summary = "Get chart of committee vote on Governance Action",
81
      tags = {"committee"})
82
  public ResponseEntity<VotingProcedureChartResponse> getChartOfDRepVotesOnGovernanceAction(
83
      @PathVariable @Parameter(description = "CC public key") String publicKey,
84
      @RequestParam(value = "govActionType")
85
          @Parameter(description = "The type of Governance Action")
86
          GovActionType govActionType) {
87 1 1. getChartOfDRepVotesOnGovernanceAction : replaced return value with null for org/cardanofoundation/explorer/api/controller/CommitteeController::getChartOfDRepVotesOnGovernanceAction → NO_COVERAGE
    return ResponseEntity.ok(cCommitteeService.getVoteProcedureChart(publicKey, govActionType));
88
  }
89
}

Mutations

50

1.1
Location : getCommitteeOverview
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/controller/CommitteeController::getCommitteeOverview → NO_COVERAGE

64

1.1
Location : getCommitteeMembers
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/controller/CommitteeController::getCommitteeMembers → NO_COVERAGE

74

1.1
Location : getCommitteeDetail
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/controller/CommitteeController::getCommitteeDetail → NO_COVERAGE

87

1.1
Location : getChartOfDRepVotesOnGovernanceAction
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/controller/CommitteeController::getChartOfDRepVotesOnGovernanceAction → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.14.2