Skip to content

Commit

Permalink
Merge pull request #1144 from cardano-foundation/1.2.0
Browse files Browse the repository at this point in the history
1.2.0
  • Loading branch information
nemo83 committed May 7, 2024
2 parents f0adfd6 + 6ea2a1b commit 1a765c9
Show file tree
Hide file tree
Showing 107 changed files with 1,707 additions and 1,771 deletions.
10 changes: 6 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
<version.sonarcube-maven-plugin>3.9.1.2184</version.sonarcube-maven-plugin>
<version.maven-project-info-reports-plugin>3.3.0</version.maven-project-info-reports-plugin>
<version.maven-site-plugin>4.0.0-M2</version.maven-site-plugin>
<version.spring-boot>3.0.5</version.spring-boot>
<version.bloxbean>0.4.3</version.bloxbean>
<version.spring-boot>3.1.6</version.spring-boot>
<version.bloxbean>0.5.1</version.bloxbean>
<version.lombok>1.18.26</version.lombok>
<version.springdoc-starter>2.1.0</version.springdoc-starter>
<version.springdoc-openapi-ui>1.7.0</version.springdoc-openapi-ui>
Expand All @@ -67,7 +67,7 @@
<version.snakeyaml>2.0</version.snakeyaml>
<version.mapstruct>1.5.3.Final</version.mapstruct>
<version.lombok-mapstruct-binding>0.2.0</version.lombok-mapstruct-binding>
<version.explorer-common>0.9.0-PR196</version.explorer-common>
<version.explorer-common>0.9.0-PR202</version.explorer-common>
<sonar.coverage.jacoco.xmlReportPaths>../cardano-explorer-api/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
<sonar.coverage.exclusions>**/entity/*, **/validation/*</sonar.coverage.exclusions>
Expand Down Expand Up @@ -234,11 +234,13 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.bloxbean.cardano</groupId>
<artifactId>cardano-client-lib</artifactId>
<artifactId>cardano-client-backend-blockfrost</artifactId>
<version>${version.bloxbean}</version>
</dependency>

<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public class CommonConstant {

public static final BigDecimal TOTAL_ADA = new BigDecimal(45000000000000000L);

public static final BigDecimal EPOCH_IN_YEARS = new BigDecimal(73);
public static final BigInteger MAX_VALUE_BIGINT = BigInteger.valueOf(Long.MAX_VALUE);

public static final Double MAX_PERCENT = 1.0;

public static final Double MIN_PERCENT = 0.0;

public static final String MAINNET_NETWORK = "mainnet";

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;

import org.cardanofoundation.explorer.api.common.enumeration.GovActionType;
import org.cardanofoundation.explorer.api.config.LogMessage;
import org.cardanofoundation.explorer.api.model.request.drep.DRepFilterRequest;
import org.cardanofoundation.explorer.api.model.response.BaseFilterResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepCertificateHistoryResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepDelegatorsResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepDetailsResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepFilterResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepOverviewResponse;
import org.cardanofoundation.explorer.api.model.response.drep.VotingProcedureChartResponse;
import org.cardanofoundation.explorer.api.service.DRepService;
import org.cardanofoundation.explorer.common.entity.enumeration.GovActionType;
import org.cardanofoundation.explorer.common.validation.pagination.Pagination;
import org.cardanofoundation.explorer.common.validation.pagination.PaginationDefault;
import org.cardanofoundation.explorer.common.validation.pagination.PaginationValid;
Expand Down Expand Up @@ -94,4 +97,33 @@ public ResponseEntity<BaseFilterResponse<DRepDelegatorsResponse>> getDRepDelegat
return ResponseEntity.ok(
dRepService.getDRepDelegators(dRepHashOrDRepId, pagination.toPageable()));
}

@GetMapping("/overview")
@LogMessage
@Operation(
summary = "Get overview of Delegated Representatives (DRep)",
tags = {"dRep"})
public ResponseEntity<DRepOverviewResponse> getDRepOverview() {
return ResponseEntity.ok(dRepService.getDRepOverview());
}

@GetMapping("/filter")
@LogMessage
@Operation(
summary = "Get list of DRep by filter",
tags = {"dRep"})
public ResponseEntity<BaseFilterResponse<DRepFilterResponse>> getDRepsByFilter(
@ParameterObject @Valid DRepFilterRequest dRepFilterRequest,
@ParameterObject
@PaginationValid
@PaginationDefault(
size = 20,
sort = {"createdAt"},
direction = Sort.Direction.DESC)
@Valid
Pagination pagination) {

return ResponseEntity.ok(
dRepService.getDRepsByFilter(dRepFilterRequest, pagination.toPageable()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.cardanofoundation.explorer.api.common.constant.CommonConstant;
import org.cardanofoundation.explorer.api.config.LogMessage;
import org.cardanofoundation.explorer.api.model.request.pool.PoolListFilter;
import org.cardanofoundation.explorer.api.model.response.BaseFilterResponse;
import org.cardanofoundation.explorer.api.model.response.DelegationResponse;
import org.cardanofoundation.explorer.api.model.response.PoolDetailDelegatorResponse;
Expand Down Expand Up @@ -79,14 +80,9 @@ public ResponseEntity<DelegationHeaderResponse> getDataForDelegationHeader() {
tags = {"delegation"})
public ResponseEntity<BaseFilterResponse<PoolResponse>> getDataForPoolTable(
@ParameterObject @PaginationValid @Valid Pagination pagination,
@RequestParam(value = "search", required = false)
@Parameter(description = "Query param for search pool by name or ticker name")
String search,
@RequestParam(value = "isShowRetired", defaultValue = "true")
@Parameter(description = "Query param for show retired pool")
boolean isShowRetired) {
@ParameterObject @Parameter(description = "The filter for pool") PoolListFilter filter) {
return ResponseEntity.ok(
delegationService.getDataForPoolTable(pagination.toPageable(), search, isShowRetired));
delegationService.getDataForPoolTable(pagination.toPageable(), filter));
}

@GetMapping("/pool-detail-header/{poolViewOrHash}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@

import org.cardanofoundation.explorer.api.config.LogMessage;
import org.cardanofoundation.explorer.api.model.response.BaseFilterResponse;
import org.cardanofoundation.explorer.api.model.response.pool.PoolRangeValuesResponse;
import org.cardanofoundation.explorer.api.model.response.pool.PoolTxResponse;
import org.cardanofoundation.explorer.api.model.response.pool.TxPoolCertificateHistory;
import org.cardanofoundation.explorer.api.service.PoolCertificateService;
import org.cardanofoundation.explorer.api.service.PoolRegistrationService;
import org.cardanofoundation.explorer.api.service.PoolService;
import org.cardanofoundation.explorer.common.entity.ledgersync.PoolRetire_;
import org.cardanofoundation.explorer.common.entity.ledgersync.PoolUpdate_;
import org.cardanofoundation.explorer.common.validation.pagination.Pagination;
Expand All @@ -38,6 +40,7 @@ public class PoolController {

private final PoolRegistrationService poolRegistrationService;
private final PoolCertificateService poolCertificateService;
private final PoolService poolService;

@GetMapping("/registration")
@LogMessage
Expand Down Expand Up @@ -94,4 +97,13 @@ public ResponseEntity<BaseFilterResponse<TxPoolCertificateHistory>> getTxPoolCer
poolCertificateService.getTxPoolCertificateHistory(
poolViewOrHash, pagination.toPageable()));
}

@GetMapping("/range-values-for-filter")
@LogMessage
@Operation(
summary = "Get range value to filter on pool overview page",
tags = {"pools"})
public ResponseEntity<PoolRangeValuesResponse> getPoolRangeValues() {
return ResponseEntity.ok(poolService.getPoolRangeValues());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.cardanofoundation.explorer.api.model.response.drep.DRepDelegatorsResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepDetailsResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepFilterResponse;
import org.cardanofoundation.explorer.api.projection.DRepDelegatorProjection;
import org.cardanofoundation.explorer.common.entity.explorer.DRepInfo;

Expand All @@ -21,6 +22,10 @@ public interface DRepMapper {
DRepDelegatorsResponse fromDRepDelegatorProjection(
DRepDelegatorProjection dRepDelegatorProjection);

@Mapping(target = "createdAt", expression = "java(fromLong(dRepInfo.getCreatedAt()))")
@Mapping(target = "updatedAt", expression = "java(fromLong(dRepInfo.getUpdatedAt()))")
DRepFilterResponse fromDRepInfo(DRepInfo dRepInfo);

default Date fromLong(Long value) {
return value == null ? null : new Date(value * 1000);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.cardanofoundation.explorer.api.mapper;

import org.mapstruct.Mapper;

import org.cardanofoundation.explorer.api.model.response.pool.PoolRangeValuesResponse;
import org.cardanofoundation.explorer.api.projection.PoolRangeProjection;

@Mapper(componentModel = "spring")
public interface PoolMapper {
PoolRangeValuesResponse fromPoolRangeProjection(PoolRangeProjection poolRangeProjection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
@Mapper(componentModel = "spring")
public interface ProtocolMapper {

String MAINNET = "mainnet";
String PREPROD = "preprod";
String PREVIEW = "preview";
String MAINNET_NAME = "Mainnet";
String TESTNET_NAME = "Testnet";

default ProtocolParamResponse mapProtocolParamResponse(List<ParamProposal> paramProposals) {
ProtocolParamResponse protocolParam = new ProtocolParamResponse();

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 1a765c9

Please sign in to comment.